Closed lupinchen closed 1 year ago
I get the same error with v3.65.
You seem to be using pdftex in which case \def€
can not do anything useful, it does not define € but byte E2
so prevents utf-8 decoding of an entire block of characters
If you need to define non-ascii characters in pdflatex you need to define them via latex inputenc declarations not \def
\documentclass{beamer}
\usepackage{newunicodechar}
\newunicodechar{€}{\qqq}
\def\qqq#1€{{\bfseries #1}}
\begin{document}
€test€
\end{document}
I must say that I don't really understand your answer but this version works fine. Thanks a lot.
Regarding your answer: \def€ cannot do anything useful... The code works as expected (by me) if I replace the \documentclass by article; then the \def€#1€ does seem to do something useful.
@lupinchen
\def€#1€
does seem to do something useful.
UTF-8 € is the three bytes E2 82 AC so you are defining byte E2 and so every character with leading byte E2 can no longer be decoded as a Unicode character and all of them except € will give low level tex errors.
so all characters from U+2000 (E2 80 80) to U+2FFF (E2 BF BF)
This typesets a dagger with pdflatex, but completely breaks if you uncomment the euro definition. Almost all common math symbols such as ∀ are in this U+2xxx range and similary broken by the definition. (over 4000 characters are broken)
\documentclass{article}
\usepackage{newunicodechar}
\newunicodechar{€}{}
% NO!!!!!
% \def€#1€{{\bfseries #1}}
\begin{document}
dagger †
\end{document}
Ok. So the initial code with documentclass article was only working because I didn't use other unicode characters. Thanks a lot.
Result
Package newunicodechar Warning: Redefining Unicode character on input line 4.
Environment
Texlive 2022 with beamer v3.68 (works on a different system with beamer v3.65)