[Tex/LaTex] lstinline error “ended by EOL” in dtsyntax

listings

I'm using the package dtsyntax to highlight code text based on listings. For in-line annotation they make a new command \modelica{ } based on lstinline as follows :

\newcommand{\modelica}[1]{\lstinline[basicstyle=\ttfamily,language=modelica]|#1|}

But when i use this as follows

this is a test concerning highlighting \modelica{"modelica"} in LaTeX ...

I get the following error which i can not trace back :

Package Listings Error: lstinline ended by EOL.

can anyone help me with this ?

Best Answer

If you only have the one language in your document, you could add the following to your preamble:

\lstset{basicstyle=\ttfamily, language=modelica}
\lstMakeShortInline{|}

And then you can just write |"modelica"| and that should work. (I haven't tested this because I don't have dtsyntax)

The \lstset macro sets up global formatting options for all instances of \lstinline and lstlistings and similar environments. The \lstMakeShortVerb is optional, and allows you to specify a symbol that can be quickly used to enclose text to be "lstinlined".

The "ended by EOL" error suggests that the problem has something to do with linebreaks, but if the code is as you say it is, and if removing the " makes things work, then I am stumped...

Related Question