Skip to content

Instantly share code, notes, and snippets.

@snim2 snim2/keywords.tex
Created Aug 25, 2014

Embed
What would you like to do?
Example LaTeX listings with mixed alphanumeric keywords
\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage{listings}
\renewcommand{\ttdefault}{pcr}
\definecolor{Black}{gray}{0.0}
\definecolor{Blue}{rgb}{0.12,0.29,0.53}
\lstset{
basicstyle=\color{Black}\ttfamily, %
keywordstyle=[1]\color{Blue}\ttfamily\bfseries, %
}
\lstdefinelanguage{mylang}{ %
% keywords={FOO,BAR,BAZ,ARG}, %
% otherkeywords={1234,XYZ1234,XYZ1234HelloWorld}, %
alsoletter=0123456789,
keywords={FOO,BAR,BAZ,ARG,1234,XYZ1234,XYZ1234HelloWorld}, %
}
\begin{document}
\begin{lstlisting}[numbers=none,breaklines=true,caption={},language=mylang]
FOO
BAR
BAZ
ARG
1234
XYZ1234
XYZ1234HelloWorld
\end{lstlisting}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.