\usepackage{listings}
\definecolor{identifiercolor}{rgb}{.4,.6,.56}
\definecolor{stringcolor}{rgb}{170,55,241}
\definecolor{inactivecolor}{rgb}{28,172,0}
\lstset{
basicstyle={\footnotesize\def\fvm@Scale{.85}\fontfamily{fvm}\selectfont},
breaklines=true,
frame=single,%
% escapeinside={\%*}{*)},
keywordstyle={\bfseries\color{blue}},
stringstyle={\bfseries\color{stringcolor}},
identifierstyle={\bfseries\color{black}},
commentstyle=\color{identifiercolor},
showstringspaces=false}
\renewcommand{\lstlistingname}{Listing}
定义之后
\begin{lstlisting[extendedchars=true,caption="trackingexample.m",language=Matlab]
function result_txt_vis()
clear all
t = importdata('result.txt'); Ani = 1;
switch Ani
case 1
\end{lstlisting}
importdata('result.txt')
缺少了一些东西!
如果我像这样使用 C
\begin{lstlisting}[extendedchars=true,caption="Ex1.c",language=C]
#ifndef DEBUG
clock_t end = clock();
double time_spent = (double) (end - begin) / CLOCKS_PER_SEC;
printf("running-time: %e\n", time_spent); //display running-time
#endif
return 0;
}
\end{lstlisting}
答案1
按照@PaulGaborit 评论,使用RGB
而不是rgb
,
\definecolor{identifiercolor}{RGB}{120,15,21}
\definecolor{stringcolor}{RGB}{170,55,241}
\definecolor{inactivecolor}{RGB}{28,172,0}
那么问题就解决了。