The
listings package for LaTeX allows you to prettyprint sourcecode that you include in your LaTeX document. It supports a stack of languages out of the box, but adding a new language is pretty straightforward. Here is an example of how you might add syntax highlighting for
SPICE (it does not include the full set of SPICE keywords):
\usepackage{color}
\usepackage{listings}
...
\lstdefinelanguage{spice}{
morekeywords={SUBCKT,MODEL,ENDS,END,PROBE,AC,NOISE,STEP,LIB,END},%
sensitive=false,%
morecomment=[f]*,%
morestring=[m]",%
}
\def\lstbasicfont{\fontfamily{pcr}\selectfont}
\lstset{language=spice,
keywordstyle=\bfseries,
commentstyle=\color[gray]{0.6}\itshape,
stringstyle=\color[gray]{0.5},
basicstyle={\lstbasicfont\scriptsize},
showstringspaces=false,
}
...
% some example SPICE
\begin{lstlisting}
*Analysis directives:
.AC DEC 1 10k 10k
.NOISE V([N00258],[N00261]) V_V3
.STEP LIN V_V4 0 15 0.25
.PROBE
\end{lstlisting}
