49

I get this error message, during compiling my .tex-document.

line 234 - ! Package inputenc Error: Unicode char ́ (U+301)(inputenc) not set up for use with LaTeX.See the inputenc package documentation for explanation.Type H <return> for immediate help.... \cleardoublepage

I am writing my thesis right now and I am very confused about this error message, since it seems to be connected to a special character, which I do not use in my manuscript. The solution up to now was the reloading of an older version of my manuscript...after some hours of work and after several times of successful compiling this error suddenly occurs again. I don't get it why, since I just write some text, add some figures and nothing more...

any suggestions, how I can solve that issue? I have no idea, what kind of MWE I should post here :( where does this comment "line234" refer to. Line 234 is normal text in my manuscript...

6
  • Check out the comments on this question here. There might be something in there that could solve your issue. In particular using \'e for accented characters.
    – Flexo013
    Commented Jul 24, 2018 at 13:31
  • I kind of solved the problem for now by using \DeclareUnicodeCharacter{0301}{\'{e}} before \begin{document}. Well, I am happy about it, but I am still not understand, what the actual problem was. Why do I have to declare some unicode and some not??? Commented Jul 24, 2018 at 13:48
  • @MariusKnapp That's wrong: U+0301 is a combining character; if you have the combination U+0065 U+0301, your definition would produce .
    – egreg
    Commented Jul 24, 2018 at 15:02
  • 12
    Experienced this problem with \'{\i} in a .bib file compiled with biblatex. Problem solved by using \'{i} instead, which is strange because the backslash in front of the i used to be recommended. Anyhow the i prints correctly that way.
    – PatrickT
    Commented Mar 31, 2021 at 12:45
  • We should really pick one of these questions to be the canonical question we redirect dupes to.
    – Davislor
    Commented Jan 28, 2022 at 0:52

7 Answers 7

23

If you copy/paste some source, it may happen that é had been coded as

U+0065 U+0301

which in Unicode aware environments is rendered as expected. Unfortunately pdflatex is not Unicode aware and cannot deal with combining characters, which are placed after the character they refer to.

The only method that gives correct results is to change the combination into the non composed character.

Doing \DeclareUnicodeCharacter{0301}{\'{e}} is wrong. Here's an example:

\documentclass{article}

\DeclareUnicodeCharacter{0301}{\'{e}}

\begin{document}

é % non composed character U+00E9
é % composed character U+0065 U+0301
ú % composed character U+0075 U+0301

\end{document}

enter image description here

You're removing the error message, but the output is completely off.

Note Copying from the above will not show the precomposed characters, because either my OS or this site does normalization.

7
  • 2
    @MariusKnapp Find the offending characters and retype the correct ones.
    – egreg
    Commented Jul 25, 2018 at 8:38
  • 1
    Use xelatex to complie and works fine.
    – zack
    Commented Nov 26, 2019 at 17:31
  • By "change the combination into the non composed character," could you write how you do that in the LaTeX code, instead of just mentioning what you should not do? Commented Oct 24, 2023 at 10:51
  • @StrawberryFieldsForever Search and replace with your favorite editor.
    – egreg
    Commented Oct 24, 2023 at 11:46
  • 1
    @StrawberryFieldsForever Replace e+combining accent into é.
    – egreg
    Commented Oct 24, 2023 at 16:14
91

I do this:

\DeclareUnicodeCharacter{0301}{*************************************}

and look into the pdf which char produces this and delete/correct it.

11
  • 9
    Excellent method to locate the culprit! :) Commented Feb 10, 2020 at 19:54
  • 5
    The line of asterisks is just here so you can easily find in the resulting pdf where is annoying unicode char... but you can use whatever char you want ;-).
    – Felix
    Commented Jun 15, 2020 at 7:45
  • 6
    i would give more upvotes if i could!
    – yoshi
    Commented Nov 30, 2020 at 20:57
  • 4
    @Tom, you stick this line of code in your preamble, compile, and then visually inspect the PDF for a line of stars. That's where the problem is. You go back to the source file and retype the offending characters. You can replace the stars by any other visually identifiable set of characters.
    – PatrickT
    Commented Mar 31, 2021 at 12:33
  • 6
    Very useful especially when the problem is in bibliography entries! Commented Apr 1, 2021 at 9:00
7

I had a very similar problem:

Error: Unicode char ́ (U+0301)(inputenc) not set up for use with LaTeX...; 

It seems the problem was not in my main text but in my .bib file instead. I had a citation in the line in which my compilation said I had the mistake, and after checking this reference inside the .bib file, I found that it had several accented vowels in curly brackets. I changed the vowel in curly brackets by the corresponding "normal accented" vowel (I mean, with the vowel accented using my keyboard) and the problem went away.

3
  • Why was this downvoted? I had the exact same issue and your approach worked for me. Thank you!
    – Hagbard
    Commented Oct 29, 2020 at 15:00
  • Same issue here; your fix worked. Thank you!
    – LunkRat
    Commented Jan 13, 2022 at 21:50
  • Also you might need to delete all auxiliary/temporary files when dealing with error in .bib files. I had the same error, but it persisted even after deleting all non-ascii characters from .bib file. The accented vowel was still in present in .aux file, which was not recreated for some reason. I recommend deleting every file except .tex and .bib files, than recompiling. (mentioning this for anyone googling the same issue like me)
    – herdek550
    Commented Mar 23 at 18:56
4

As others have already said, the issue is the accented characters, likely in the .bib file. Replace the culprit characters there with the corresponding latex-appropriate e.g. \'{i}.

1

Either compile in LuaLaTeX/XeLaTeX, or normalize your source file to NFC form. PDFTeX chokes on combining characters, but your accented character most likely has a canonical precomposed form that inputenc can handle.

You might be able to do this with iconv -f utf8-mac -t utf8, or here is a little program I wrote that does it.

0

As a rough workaround, you can use this:

\documentclass[12pt]{article}

\DeclareUnicodeCharacter{0301}{\hspace{-1ex}\'{ }}

\begin{document}

chaŕ cha\'r

\Huge

chaŕ cha\'r

charŔ cha\'R

\end{document}

However, the workaround is indeed rather rough (look at the left R):

enter image description here

-2

Compiling with XeTeX works for me, maybe because it works better with unicode.

Here a found some clarifications.

2
  • Welcome to TeX.SE! Please do not use a link to an external page, describe in your own words what you think is the solution here. From the accepted answer changing the engine seems not to be a solution here for the OP ...
    – Mensch
    Commented Aug 25, 2019 at 22:22
  • Ok, thanks for your help. I edited my answer following your advice. Commented Aug 26, 2019 at 1:31

You must log in to answer this question.

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