2011年9月8日星期四

Embed source code in Latex document with simple color

package needed:
\usepackage{listings}
\usepackage{color}

Content:
\lstset{caption=client.c, numbers=left, language=C++,
basicstyle=\small, keywordstyle=\color{blue}\bfseries,
stringstyle=\color{red}, showstringspaces=false}
\lstinputlisting{code/client.c}

\lstset{language=C, basicstyle=\small,
keywordstyle=\color{blue}\bfseries, stringstyle=\color{red},
showstringspaces=false}
\begin{lstlisting}
code...
\end{lstlisting}

没有评论:

发表评论