TransWikia.com

Package inputenc Error: Unicode char ̀ (U+300) (inputenc) not set up for use with LaTeX

TeX - LaTeX Asked on May 7, 2021

I am struggling understanding how to solve this error:

Package inputenc Error: Unicode char ̀ (U+300) (inputenc) not set up
for use with LaTeX.

I have seen this related question, but the problem is that I have no idea where I have used this character and it seems I can’t find it with find command.

One Answer

U+0300 is a combining grave accent. PDFTeX and the 8-bit inputenc package cannot handle combining Unicode characters, only precomposed characters (NFC form).

The following MWE will reproduce your bug, if compiled in PDFTeX:

documentclass{article}
tracinglostchars=2
usepackage[T1]{fontenc}

begin{document}
à
end{document}

This is because à is in decomposed form (U+0061 U+0300) instead of the NFC form, à (U+00E0). This is just one example, and there are several other places it could appear. (The most-famous example in English probably is Shakespare’s use of “punishèd.”)

If you compile with LuaLaTeX instead of PDFLaTeX, the engine will understand the combining character, but your 8-bit font will not contain it, so it will not display. The tracinglostchars=2 line will at least give you a warning message about it.

This gives you the following options:

Use a Unicode Engine

If you remove the 8-bit font packages such as fontenc and inputenc, and compile with LuaTeX or XeTeX, it works:

documentclass{article}
tracinglostchars=2
usepackage{fontspec}

begin{document}
à
end{document}

Convert to Precomposed Characters

I happen to have written a little program that normalizes UTF-8 input to NFC form, or you can do a search-and-replace.

This works, because it contains no combining characters, only precomposed characters:

documentclass{article}
tracinglostchars=2
usepackage[T1]{fontenc}

begin{document}
à
end{document}

Use Accent Macros

If you must use PDFTeX, and there is no precomposed character for the the grapheme you want, you could write it as

documentclass{article}
tracinglostchars=2
usepackage[T1]{fontenc}

begin{document}
`{a}
end{document}

Correct answer by Davislor on May 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP