[XeTeX] Special characters: how to handle cleanly

Joseph Wright joseph.wright at morningstar2.co.uk
Sat May 24 20:58:09 CEST 2008


Hello all,

I'm trying to work out how to handle a small set of special characters
cleanly.  Consider the following:

\documentclass{article}
% Need something clever here!
\begin{document}
  Some text $°Åμ$ °Åμ
\end{document}

If I compile with xelatex, only "Some text" shows up.  The same problem
with pdflatex plus inputenc (latin1) can be handled as the characters
end up active, and I can do:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{textcomp,amstext,upgreek}
\newcommand*{\handlesymbol}[1]{%
  \bgroup
    \uccode`\~#1%
    \uppercase{%
      \egroup
      \def~}}
\handlesymbol{176}{\text{\textdegree}}
\handlesymbol{181}{\ensuremath{\upmu}}
\handlesymbol{197}{\text{\AA}}
\begin{document}
  Some text $°Åµ$ °Åµ
\end{document}

I'm sure there is an xetex way to do the same thing, but I don't know
what it is!  I'd rather avoid using the symbols themselves in the
handler code (i.e. before \begin{document}) for various reasons.

Thanks for any clues,

Joseph Wright


More information about the XeTeX mailing list