I am using TexMaker as editor and in a document I want to put some inline code so I am using lstinline{}. The command works but strangely the text of the document after the closing curly bracket is printed in the same font and colour of the text inside the bracket.

For example considering this [mcve]:

\documentclass[12pt, letterpaper]{article}

\lstset{language=C,keywordstyle={\bfseries \color{blue}}}
hey \lstinline{for}  asdasda

The output is fine, the source text appears as follow:enter image description here where as you can see the text asdasda and even the \end{document} are shown as if being part of the inline code.

A partial solution to this is to do \lstinline{for}\lstinline{} but it is really confusing and time consuming.

Does anyone have a better solution?

  • 1
    Try to use different delimiters for inline-listings. They have to be the same character. For example \lstinline+hello+
    – Wulle
    Apr 1, 2020 at 7:14
  • 1
    @Wulle it works thanks...if you answer it I will accept it Apr 1, 2020 at 7:57

1 Answer 1


As already stated in my comment: TeXMaker (and every other editor I know) expects the same delimiter for inline listings. If you try:

\lstinline+hello world+ or \lstinline|hello world|

It should be understood by \lstinline and your editor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .