3

I have the following Matlab code in my Latex file:

\documentclass[a4paper,12pt]{article}

\begin{document}
 \begin{lstlisting}[frame=single,escapeinside={@}{@}]   
   gamma=[1/4,3/4];  
   alpha=[1/4,3/4]; 
 \end{lstlisting}
\end{document}

But in my Latex file the variable name gamma is in bold and alpha isn't. How can I get rid of the bold for one specific variablename?

3
  • Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem.
    – jub0bs
    Oct 19, 2013 at 9:18
  • Your updated code needs \usepackage{listings}, but with that neither word is bold, so there is more your set-up you need to tell us about. Oct 19, 2013 at 9:45
  • You might be interested in the matlab-prettifier package; see this answer.
    – jub0bs
    Apr 28, 2014 at 15:55

1 Answer 1

4

By default the language matlab treats gamma as a keyword. You can remove that via the deletekeywords option:

Sample output

\documentclass[a4paper,12pt]{article}

\usepackage{listings}

\begin{document}
 \begin{lstlisting}[frame=single,escapeinside={@}{@},language=matlab,deletekeywords={gamma}]   
   gamma=[1/4,3/4];  
   alpha=[1/4,3/4]; 
 \end{lstlisting}
\end{document}
0

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.