I am trying to typeset a makefile using listings
.
Now I would like some differential highlighting, e.g. for variables and ordinary commands in the target body. In this snippet, want to have different highlighting for VAR
and for rm -rf
, but it seems the only classes one can style are identifierstyle
, stringstyle
and keywordstyle
. The latter is hardly useful and only highlights builtins (obviously), but identifierstyle
applies to basically everything, making it utterly useless here.
\documentclass{scrartcl}
\usepackage{listings}
\begin{document}
\lstset{language=[gnu] make}
\lstset{
language=[gnu] make,
keywordstyle=\color{teal}\textbf,
stringstyle=\color{blue},
identifierstyle=\itshape
}
\begin{lstlisting}
VAR=foo
clean:
rm -rf $(VAR)
\end{lstlisting}
\end{document}
Can anyone suggest either an explanation for why this is so (what use is the language definition for make
if there's no way around it?), or why it should be so, or – preferably – a workaround that does not involve manually specifying e.g. keywords?
Aucun commentaire:
Enregistrer un commentaire