I have an external JSON-File that contains the character Δ. A document can be built but I get the error: LaTeX Error: Invalid UTF-8 byte sequence (�\lst@FillFixed@). As it's external I am using:


It is shown and formatted. However the Deltas are not there. Just shown as empty brackets.

As suggested here I tried adding \UseRawInputEncoding - the brackets are not empty any more, now they are filled with: "ΡT"

Here it's recommended to add \usepackage[utf8]{inputenc} \usepackage{listingsutf8} Brackets are empty again. Using \usepackage[greek]{babel} doesn't do anything either.

There are some posts dealing specifically with the listing like this. Of course I replaced the entire line of Umlaute with: literate={Δ}{{\"Delta}}. However, this just results in no document being built and the error: LaTeX Error: Invalid UTF-8 byte sequence (�\lst@FillFixed@). This here (doing the same, just also replacing portuguese with greek) modified the font a bit but still, the character can't be displayed.

I managed to display a Δ inside regular text using (not math mode):


However, this doesn't affect the box of code.

The full code:

\usepackage{bera}% optional: just to have a nice mono-spaced font



The JSON in Vertices.json (Which is an external file):

  "Description":"2018 maximum braking distance",

And here to view: https://www.overleaf.com/read/fkkcsyfppppj

  • 4
    don't show lots of snippets. Combine your problem into a small but complete example. That makes it much easier to test. (probably you only need to add your char with a suitable definition to the literate list). Commented Jan 19, 2023 at 11:14
  • 3
    sure, if you provide a small but complete example for a test. I don't have the time to assemble your snippets. Commented Jan 19, 2023 at 11:20
  • 3
    no I won't start to debug some external overleaf projects, provide the example here. Commented Jan 19, 2023 at 11:30
  • 3
    sorry but it is not about what you prefer generally in your documents. You can do there what you want. But if you want help from us, you should put the code in the question in a format that makes it for us easy and comfortable to help you. Commented Jan 19, 2023 at 15:05
  • 3
    literate={Δ}{{\ensuremath{\Delta}}}{1}, appears to work for me. \Delta alone is not enough, because we need to go into math mode. {\ensuremath{\Delta}} does not appear to work, because the listings documentation says "Each ‘printing unit’ in <replacement text> must be in braces unless it’s a single character." So we end up with {\ensuremath{\Delta}} as the contents of the replacement text braces.
    – moewe
    Commented Jan 19, 2023 at 15:27

1 Answer 1


You'll need


The literate is needed because listings can't natively deal with non-ASCII characters and needs help (UTF8 for listings).

The form of the second argument is explained as follows

  • \Delta is not enough, because it needs to be in math mode
  • \ensuremath{\Delta} does not work because according to the listings documentation (p. 52)

    Each ‘printing unit’ in <replacement text> must be in braces unless it’s a single character.

  • so {\ensuremath{\Delta}} it is.

You must log in to answer this question.

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