# Is there a way to get pdflatex to accept Unicode combining accents?

I typeset my work with pdflatex and UTF-8 input files with lots of Unicode characters. Most of them work with a simple \usepackage[utf8]{inputenc} in my preamble, and for the others I simply maintain a long list of \DeclareUnicodeCharacter.

However, I often paste into my LaTeX files some text that has combining accents (that results from Mac OS X’s copy/paste mechanism). I have to normalize that text, because combining accents don’t work out of the box. How could I manage to make them work? (once and for all, e.g. by adding good definitions near my big list of Unicode characters)

Minimal self-contained example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
Élève
Élève
\end{document}


where the text with accents is:

U+00C9  É  LATIN CAPITAL LETTER E WITH ACUTE
U+006C  l  LATIN SMALL LETTER L
U+00E8  è  LATIN SMALL LETTER E WITH GRAVE
U+0076  v  LATIN SMALL LETTER V
U+0065  e  LATIN SMALL LETTER E
U+000A     NEWLINE
U+0045  E  LATIN CAPITAL LETTER E
U+0301  ́  COMBINING ACUTE ACCENT
U+006C  l  LATIN SMALL LETTER L
U+0065  e  LATIN SMALL LETTER E
U+0300  ̀  COMBINING GRAVE ACCENT
U+0076  v  LATIN SMALL LETTER V
U+0065  e  LATIN SMALL LETTER E

-
See package newunicode – Marco Daniel Oct 27 '12 at 19:58
@MarcoDaniel (it's newunicodechar) I think it's only a convenience macro over \DeclareUnicodeCharacter, which can take one codepoint, but not a series of two codepoints. I tried, and it complains: Package newunicodechar Error: Invalid argument. – F'x Oct 27 '12 at 20:01
Indeed. I finished my comment to early ;-) – Marco Daniel Oct 27 '12 at 20:02
I think the answer is "No" (But the system wouldn't let me give an answer that short:-) – David Carlisle Oct 27 '12 at 20:11
yes but you can't go back, you can in simple case write a macro that parses the entire text stream re-ordering tokens when it sees a combining character, but it would be very fragile and likely break most other package commands. If your accented letters are single characters in Unicode form NFC then normalising the input before passing to TeX will be a lot more robust. – David Carlisle Oct 27 '12 at 20:17

Combine the standard preamble (recipe R0) followed by recipe R1 "Generic Unicode-savvy ﬁlter" (you can remove the ... } continue { part of the code). Put this in a file normalise.pl, give it excute premissions via chmod +x normalise.pl and use as normalise.pl file.tex >out.tex.
I would post such a script normalise.pl here, but my understanding of the license on the cookbook is that is not allowed.