[XeTeX] Special characters: how to handle cleanly
Will Robertson
wspr81 at gmail.com
Mon May 26 03:08:59 CEST 2008
On 25/05/2008, at 4:28 AM, Joseph Wright wrote:
> 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.
Hi Joseph,
Good question. There aren't many macro packages that yet explicitly
support XeTeX (or rather, accommodating plain unicode input). Maths
right now is a bit of a funny situation; if it's possible, it'd be
best if siunitx doesn't place those characters into running maths mode.
The good news for you is that you don't need to worry about things too
much. As you say, without any packages loaded means things don't
display correctly in XeTeX, but the same is true in LaTeX as well: you
need to load a font that will be able to display them.
So whether fontspec is loaded, or a font is loaded via any other
method, things kind of just work:
\documentclass{article}
\begin{document}
\font\1="Times"\1
10\,µm
\end{document}
If you want to ensure that these glyphs are actually available in the
font, you might want to make them active and check for them:
\documentclass{article}
\begin{document}
\makeatletter
\font\1="Times"\1
\catcode`\µ=13
\def\check at glyph@else#1{%
\@tempcnta=\XeTeXcharglyph #1\relax
\ifnum\@tempcnta>0
\XeTeXglyph\@tempcnta
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi}
\defµ{\check at glyph@else{`\µ}{\ERROR}}
10\,µm
\end{document}
But I'd be reasonably confident that all roman fonts should contain
those glyphs.
Hope this helps,
Will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20080526/112bd226/attachment.bin
More information about the XeTeX
mailing list