之前一直用 listings 宏包来设置代码高亮,需要手动设置一下参数,比如我的如下:
\usepackage{
listings}
\newfontfamily\courier{
Courier New}
\lstset{
linewidth=1.1\textwidth,
numbers=left, %设置行号位置
basicstyle=\small\courier,
numberstyle=\tiny\courier, %设置行号大小
keywordstyle=\color{
blue}\courier, %设置关键字颜色
%identifierstyle=\bf,
commentstyle=\it\color[cmyk]{
1,0,1,0}\courier, %设置注释颜色
stringstyle=\it\color[RGB]{
128,0,0}\courier,
%framexleftmargin=10mm,
frame=single, %设置边框格式
backgroundcolor=\color[RGB]{
245,245,244},