Thursday, March 6, 2008

用Listings高亮代码

http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
pdf

例子

\documentclass{article}
\usepackage{listings}

\begin{document}

\begin{lstlisting}[language=C]
int main(int argc, char ** argv)
{
/* print a string "Hello world!"
printf("Hello world!\n");

return 0;
}
\end{lstlisting}

\end{document}

效果: