1

I have a problem with some of the UTF-8 characters that are in my Tex file. Although I am saving the file in UTF-8 and my text editor (Atom) is displaying all of the characters properly, LaTeX throws errors like these:

[no file]:824: Package inputenc Error: Unicode character Δ (U+394) [...tes $(x,y)$ are $x=x_0+Δx$ and $y=y_0+Δ]
[no file]:857: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]
[no file]:857: Package inputenc Error: Invalid UTF-8 byte 137. [ # calculate ω]
[no file]:889: Package inputenc Error: Unicode character θ (U+3B8) [...ce $r$. It was previously at an angle $θ]
[no file]:889: Package inputenc Error: Unicode character ω (U+3C9) [...ngle $θ$ and is now at an angle $θ + ω]
[no file]:976: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]

I have tried using utf (and utfx) package to no avail:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

Here is the entirety of the file: https://pastebin.com/dzzLtUmB.

The formatting might be a little rough on the eyes, because it's generated.

Is there something I could do to fix this?

  • 1
    Welcome to TeX.SX! Please consider adding a shortened version of your example document as code directly to your question (we call that an MWE: tex.meta.stackexchange.com/q/228/35864). That makes it easier for other people to help you (because they don't have to go to a different site to find your code) and avoids the issue of link rot. – moewe Jan 10 at 20:04
  • 1
    That said if you use pdfLaTeX (as opposed to the full Unicode engines LuaLaTeX and XeLaTeX) with inputenc only a limited subset of UTF-8 characters is set up for use (e.g. Latin-1 characters and other accented stuff). You'll have to add declarations for the one your are missing. See for example tex.stackexchange.com/q/429029/35864 or better tex.stackexchange.com/q/34604/35864, tex.stackexchange.com/q/83440/35864, tex.stackexchange.com/q/110042/35864 and tex.stackexchange.com/q/356958/35864 – moewe Jan 10 at 20:05
  • Thanks for the advice, I will keep that in mind the next time I post. With that being said, isn't there a simpler way? This is looks quite tedious. – Tomáš Sláma Jan 10 at 20:12
  • ... The alternative to declaring all the stuff is to use a Unicode engine (XeLaTeX or LuaLaTeX) with a font that has all the characters in it. Anyway, the Invalid UTF-8 byte sequence. and Invalid UTF-8 byte 137. errors don't sound good and probably need looking at. – moewe Jan 10 at 20:12
  • I will look into it. Thank you for the quick response! – Tomáš Sláma Jan 10 at 20:13
3

If I add draft so latex does not stop at the missing figures, there are several errors due to incorrect math mode markup, and some utf8 characters that need to be redefined but you do not get the error

[no file]:976: Package inputenc Error: Invalid UTF-8 byte sequence. [ # calculate ω]

I suspect that you have an older latex release and have a hit a bug in the UTF8 decoder, possibly

https://github.com/latex3/latex2e/pull/83

Make sure that you have an up to date latex.

After adding [draft] to skip past the missing images the remaining warnings are

$ grep -i 'invalid\|error' bb251.log | sort | uniq
! Package amsmath Error: Erroneous nesting of equation structures;
! Package inputenc Error: Unicode character Δ (U+0394)
! Package inputenc Error: Unicode character θ (U+03B8)
! Package inputenc Error: Unicode character ω (U+03C9)
LaTeX Font Warning: Command \large invalid in math mode on input line 659.
LaTeX Font Warning: Command \large invalid in math mode on input line 788.
LaTeX Font Warning: Command \large invalid in math mode on input line 792.
LaTeX Font Warning: Command \large invalid in math mode on input line 794.
LaTeX Font Warning: Command \large invalid in math mode on input line 820.
LaTeX Font Warning: Command \large invalid in math mode on input line 822.
LaTeX Font Warning: Command \large invalid in math mode on input line 900.
LaTeX Font Warning: Command \large invalid in math mode on input line 904.
LaTeX Font Warning: Command \large invalid in math mode on input line 908.
LaTeX Font Warning: Command \large invalid in math mode on input line 916.
LaTeX Font Warning: Command \large invalid in math mode on input line 920.
LaTeX Font Warning: Command \large invalid in math mode on input line 922.
LaTeX Font Warning: Command \large invalid in math mode on input line 926.
LaTeX Font Warning: Command \large invalid in math mode on input line 928.
LaTeX Font Warning: Command \large invalid in math mode on input line 932.
LaTeX Font Warning: Command \large invalid in math mode on input line 934.
  • I have tried this with both Tex Live on my Linux laptop and MiKTeX on my PC and see the same errors. – Tomáš Sláma Jan 10 at 20:16
  • 1
    @TomášSláma the operating system is not important, which version of latex did you use? I used the current release LaTeX2e <2018-12-01> – David Carlisle Jan 10 at 20:18
  • I am relatively new to LaTeX, but running tex -v gives "TeX 3.14159265 (TeX Live 2018/Arch Linux)" – Tomáš Sláma Jan 10 at 20:23
  • 1
    that is the tex system rather than latex, the top of the file log file will have a lien saying LaTeX2e <2018-12-01> or (since you have texlive 2018 208-04-01 there were some utf8 fixes in the December release, but actually I didn't get the invalid utf8 message even if i used an older latex) – David Carlisle Jan 10 at 20:37

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.