nuaatug / nuaathesis

LaTeX document class for NUAA, supporting bachelor/master/PH.D thesis in Chinese/English/Japanese. 南航本科、硕士、博士学位论文 LaTeX 模板
Apache License 2.0
311 stars 69 forks source link

插入代码没有高亮 #102

Closed yym68686 closed 1 year ago

yym68686 commented 1 year ago

使用

\begin{lstlisting}[language=C]
#include <stdio.h>
int main() {
    printf("Hello, world!");
    return 0;
}
\end{lstlisting}

编译后,代码时黑白的,没有高亮,有这个功能吗?

yym68686 commented 1 year ago
\usepackage{xcolor}
\lstset{
  language=Python,
  basicstyle=\ttfamily,
  keywordstyle=\color{blue},
  commentstyle=\color{green},
  stringstyle=\color{red},
  showstringspaces=false,
  frame=single
}

这样就好了。