參考: http://www.tjansson.dk/?p=419

套件:
\usepackage{listings}
\usepackage{color}

\usepackage{textcomp}

宣告:

\lstset{

language=[Visual]C++,

keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},

identifierstyle=\ttfamily,

commentstyle=\color[rgb]{0.133,0.545,0.133},

stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},

showstringspaces=false,

basicstyle=\small,

numberstyle=\footnotesize,

numbers=left,

stepnumber=1,

numbersep=10pt,

tabsize=2,

breaklines=true,

prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},

breakatwhitespace=false,

aboveskip={1.5\baselineskip},

columns=fixed,

upquote=true,

extendedchars=true,

% frame=single, %邊線

% backgroundcolor=\color{lbcolor}, %背景顏色

}

 

正文:

 

\begin{lstlisting}

int main()

{

int a=123;

}

\end{lstlisting}

讓地獄深紅的天亮 發表在 痞客邦 PIXNET 留言(0) 人氣()