Graphics, Figures & TablesVariable Coloring in the Listings Package

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rickcjmac
Posts: 3
Joined: Tue Jan 19, 2010 10:22 pm

Variable Coloring in the Listings Package

Post by rickcjmac »

I have looked and can't find an answer to this so far. I am using the Listings Package to include Fortran source code in a report. I can color the keywords with the option

Code: Select all

keywordstyle=\color{red}\textbf,
or something like this. I want to do the same thing for variables. Theoretically I think it would look something like this:

Code: Select all

variablestyle=\color{blue}\textbf,
but that spits back an error. I am at a loss. Thank you ahead of time for any and all help :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Variable Coloring in the Listings Package

Post by frabjous »

Perhaps you want identifierstyle= or stringstyle= ...? Take a look at the listings documentation. If you still have troubles, a minimal working example will be necessary for giving more concrete advice.
Post Reply