1

listings doesn't seem to recognize the Pascal comment syntax '//' ({...} works fine). The text isn't formatted correctly.

A minimum example to reproduce:

\lstdefinestyle{pascalstyle}{
    language=Pascal, 
    commentstyle=\color{red}
}
\begin{document}
    \begin{lstlisting}
       { this comment is correctly formatted}
       // that one isn't 
    \end{lstlisting}
\end{document}

Is there any oppurtunity to learn //to listings?

2

You can use morecomment.

\documentclass{Article}
\usepackage{listings,color}
\lstdefinestyle{pascalstyle}{
    language=Pascal,
    commentstyle=\color{red},
    sensitive=false,
    %morecomment=[l][\color{red}]{//},
    morecomment=[l]{//},
}
\begin{document}
    \begin{lstlisting}[style=pascalstyle]
       { this comment is correctly formatted}
       // that one isn't
    \end{lstlisting}
\end{document}

enter image description here

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.