Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ?

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

1 Answer 1

up vote 1 down vote accepted

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

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.