Possible duplicate of this question


  parskip=full,% empty line after each paragraph.
  twoside=false% not a 2-sided print for a book.

% \usepackage[utf8]{inputenc} % For non-English languages
\usepackage[latin1]{inputenc} % listings needs this encoding instead!

\usepackage{listings, tcolorbox}

\NewTotalTCBox{\inlinebox}{ O{white} v}
{ tcbox raise base,
  nobeforeafter,% makes the box inline
  colback=#1!10!white,% pales given color for background


\cil|\TeX| (\TeX) is a control word because it is made up of letters. Any non-letter will end the sequence.


This all works if I do \UseRawInputEncoding, as per this answer.

Should I do that? Or is there something more correct that I should do?

\usepackage[latin1]{inputenc} also works, by the way.

  • How can it work? That's not a complete document anybody could compile, but just a fragment. Please complete it.
    – cfr
    Jun 7 '18 at 0:14
  • No. You should declare the input encoding you're using, as David's answer says.
    – cfr
    Jun 7 '18 at 0:15

The problematic part is:


The character § is not an ASCII character.

8-bit TeX engines (TeX, pdfTeX)

Since package listings does not support multi-byte encodings, the text encoding is limited to an 8-bit encoding as latin1. This encoding should then be declared by


For greater portability, I recommend to use a different fence character from the ASCII range (|, &, ...). This avoids problems, when the input file encoding is changed to UTF-8.

Unicode engines (LuaTeX, XeTeX)

Here, the character § is just one character (big char) and it can be used as fence character for \lstinline of package listings.

However, the best supported input encoding for LuaTeX or XeTeX is UTF-8. Therefore, the input file should be re-encoded from Latin-1 to UTF-8.

  • Which UTF-8 fence character do you recommend? Should I use the minted package instead if I need UTF-8 support?
    – user152148
    Jun 10 '18 at 1:51
  • @JonWong It depends on the characters used inside the verbatim text. If | is free, then it looks nice in the source code. Jun 10 '18 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy