Code:
\documentclass{article}
\usepackage{parskip}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
keepspaces=true,
upquote=true,
numbers=left,
numberstyle=\ttfamily\color{gray},
language=c,
moredelim=*[is][\itshape]{((:}{:))},
showstringspaces=false,
commentstyle=\color{olive},
keywordstyle=\color{blue},
identifierstyle=\color{violet},
stringstyle=\color{purple},
directivestyle=\color{teal},
}
\begin{document}
Here is the skeleton of the proposed solution:
\begin{lstlisting}
int f(int x)
{
if (x <= 0) {
return 0;
}
if ((x | CONNECT_FLAG) != 0) {
((:statements:))
} else if ((x | DROP_FlAG) != 0) {
((:statements:))
} ((:if else if ladder continues:))
return result;
}
\end{lstlisting}
\end{document}
Output:
Problem:
In line 11 of the source code output, if
and else
are syntax highlighted as keywords. I was expecting them to be highlighted with the moredelim
style.
How can I prevent them from being syntax highlighted as keywords and be highlighted with the moredelim
style instead?