jlistingを利用する
http://akita-nct.jp/yamamoto/comp/latex/make_doc/source/source.htmlやhttp://debian.fam.cx/index.php?Software%2FTeXを参考にしました。
http://mytexpert.sourceforge.jp/index.php?Listingsから、
jlisting 本体 ver. 0.2 (bzip2)を落としてくる。
bunzip2 jlisting.sty.bz2
して出てきたjlisting.styを
~/texmf/ptex/platex/jlisting/
とかに移動。で、
mktexlsr
あとは、なんたら.texのプリアンブルに
\usepackage{listings,jlisting}
\usepackage[dvips]{color}\renewcommand{\lstlistingname}{リスト}
\lstset{%
language={C++},
backgroundcolor={\color[gray]{.97}},%
tabsize=2,%
basicstyle={\small},%
identifierstyle={\small},%
commentstyle={\small},%
keywordstyle={\small\bfseries},%
ndkeywordstyle={\small},%
stringstyle={\small\ttfamily},
frame={tb},
breaklines=true,
columns=[l]{fullflexible},%
xrightmargin=0zw,%
xleftmargin=0zw,%
numberstyle={\footnotesize},%
numbers=left,%
numbersep=0.2zw,%
stepnumber=1,%
showstringspaces=false,%
lineskip=-0.2ex%
}
で、あとは
\lstinputlisting[caption=なんたら.cpp,label=なんたら]{なんたら.cpp}
とすれば、できる。
設定はテキトーにパクリました。