Skip to content

Instantly share code, notes, and snippets.

@snim2
Created August 25, 2014 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snim2/99937f8377968ff1439a to your computer and use it in GitHub Desktop.
Save snim2/99937f8377968ff1439a to your computer and use it in GitHub Desktop.
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