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?

jub0bs
  • 58,916
  • 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 '13 at 09: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. – Andrew Swann Oct 19 '13 at 09:45
  • You might be interested in the matlab-prettifier package; see this answer. – jub0bs Apr 28 '14 at 15:55

1 Answers1

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}
Andrew Swann
  • 95,762