[XeTeX] A small tip
Will Robertson
will at guerilla.net.au
Wed Nov 16 14:04:20 CET 2005
Hello,
Don't know how I've used XeTeX for so long without realising the
following.
Since LaTeX can now handle UTF-8 with the inputenc package, it's
possible to create a smart em-dash (OPT SHIFT -) that looks good in
the source document, only has thin spaces surrounding it, and will
allow line breaks after but not before it:
\documentclass{article}
\def\dash{\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\expandafter\ifx\csname XeTeXversion\endcsname\relax
% if pdfLaTeX:
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{2014}{\dash}
\else
% if XeLaTeX:
\usepackage{fontspec,xunicode}
\catcode`\^^^^2014=\active % or just \catcode`\—=\active
\let^^^^2014\dash % or just \let—\dash
\setromanfont{Georgia}
\fi
\begin{document}
meow — meow
\end{document}
Yay. I should do something similar for real unicode curly quotes and
Philipp Lehman's great csquotes package...
Will
More information about the XeTeX
mailing list