I am trying to define new unicode chars for country flags. Unfortunately flags are encoded using two regional indicator symbols according to the ISO 3166-1 alpha-2 two-letter country codes. So π©πͺ for example is π© πͺ. (To make it visible here I just added a space between the two characters.)
The problem is, that both \DeclareUnicodeCharacter
(pdfTeX) and \newunicodechar
(XeTeX and LuaTeX) only accept one char. That's why
\documentclass{article}
\usepackage{newunicodechar}
\newunicodechar{π©πͺ}{\rule{1.3em}{1em}}
\begin{document}
π©πͺ
\end{document}
for example does not work. Can I trick TeX into thinking a combination of two chars is one char? Or are there any other ideas for a workaround?
Best Answer
You can emulate what basically
utf8
does:A version that works also with
pdflatex
(weird errors are to be expected if regional indicator symbols not appear in pairs.It would be possible to add a check on the next character also for Unicode engines, but it seems more crucial for
pdflatex
.