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 :


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 ?

  • whereas '\modelica{modelica}' works fine, so the problem seems to concern the use of ' " ' ... – ruben baetens Aug 4 '11 at 12:44

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

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

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...

| improve this answer | |
  • it indeed (only) depends on " which defines the look of the text as this denotes a string in the code, if i put something in front it and behind it as a "test";, it also works perfectly fine ... – ruben baetens Aug 4 '11 at 13:23
  • That is odd. And might have something to do with " sometimes being active. (I'm out of my depth here, we'll have to wait for someone smarter to answer this one, I'm afraid...) – Seamus Aug 4 '11 at 13:33
  • @ruben: It'd be better to wait for a minimal working example (MWE). – Andrey Vihrov Aug 4 '11 at 13:57

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.