0

By default listings adds black and white code. How can I make them colorful. Language I work on are -> Python, Mathematica, IDL.

1

So it is resolved. Use the following code to add color to comment, keyword, and strings of your script. I used for IDL, you can change the language and the color preference according to your style.

\lstset{language=IDL,
    basicstyle=\ttfamily,
    keywordstyle=\color{red}\ttfamily,
    stringstyle=\color{magenta}\ttfamily,
    commentstyle=\color{blue}\ttfamily,
    morecomment=[1][\color{pink}]}{\#}
\lstinputlisting{codecurrentfree.pro}

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.