I'm writing a Python program that reads some text files and writes the data to some TeX files. Unfortunately the TeX compilation stops with

Package inputenc Error: Unicode char \u8:´é« not set up for use with LaTeX.

and also with other characters.

Is there a list or an algorithm that tells me which UTF-8 characters I have to filter out?

  • 1
    You can add characters with the newunicodechar package. However, é is known to inputenc. The error (which is about ´é) suggests an erroneous input to me... – clemens Nov 20 '14 at 11:35
  • All are legal, but not all are predefined. What UTF-8 combination you should define is unclear from the error message, because the apostrophe ´ (0xB2) is not a valid UTF-8 prefix; can you look the output from a UTF-8 enabled terminal? – egreg Nov 20 '14 at 11:45
  • I don't know in advance which UTF-8 characters will appear in my generated file. I'm planning to filter out all chars unknown to LaTeX with the python script, before generating the TeX file. Therefore I would like to know which characters are defined in LaTeX. – marczellm Nov 20 '14 at 11:55
  • 3
    The defined characters depends on your input: by default inputenc loads ot1enc.dfu, t1enc.dfu, omsenc.dfu and XXenc.dfu for all font encodings XX you are loading with fontenc. The log-file gives you a list: defining Unicode char U+201D (decimal 8221). But this information won't help you if your input is no valid utf8 as your error message suggests. – Ulrike Fischer Nov 20 '14 at 12:19
  • 1
    You know which fonts and font encodings you are including in the document so you can arrange that all those encodings have utf8 definitions, so should never get that error. If you are supporting arbitrary unicode input such as hieroglyphics or box symbols or arabic or math operators.. then setting up the fonts is tricky and you would probably be better to use xelatex or lualatex (when decoding utf-8 is automatic) – David Carlisle Nov 20 '14 at 13:27

Your Answer

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

Browse other questions tagged or ask your own question.