I am writing my thesis in LaTeX and use \lstinline{} a lot. The problem is that the font on the output does not change to 'this', but rather continue like 'this'. How do I correct this behaviour?

I have compiled my document in Sublime Text 2 with LaTeXTools on Ubuntu and Windows, and with MikTeX on Windows. Everything gives the same output.

  • 1
    the manual said that \lstinline with { } is still experimental. – selwyndd21 Nov 5 '13 at 0:57
  • @selwyndd21 I have been using this for around 2 years now. I have used in project reports, seminar reports, etc. But, the thing is, I had not written the preamble there. I got it as a template. So I did not know about this. I thought it would be a default behavior of LaTex. – ctrl-shift-esc Nov 5 '13 at 9:16

listings sets the font style in the default font, unless you specify it to be different using the basicstyle key. For a global setting of the basic style to typewriter font, add


to your document preamble. It's use is discussed on p 30 of the listings documentation:

basicstyle=<basic style>

(default {}) is selected at the beginning of each listing. You could use \footnotesize, \small, \itshape, \ttfamily, or something like that. The last token of <basic style> must not read any following characters.

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.