0
\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}

After define that

\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}

Something in importdata('result.txt') is missing!

enter image description here

and if i use C like that

\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}

Something in printf("running-time: %e\n", time_spent) is also missing! enter image description here

  • 1
    To define colors by values between 0 and 255, use the RGB model (instead of the rgb model). – Paul Gaborit Nov 15 '18 at 7:06
  • yes, thank you,@PaulGaborit, i solve this problem by define RGB instead of rgb. – Ben Nov 15 '18 at 7:15
1

Follows @PaulGaborit comment, use RGB instead of rgb,

\definecolor{identifiercolor}{RGB}{120,15,21}
\definecolor{stringcolor}{RGB}{170,55,241}
\definecolor{inactivecolor}{RGB}{28,172,0}

then the problem will be solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.