[XeTeX] A small tip

Bernhard Barkow bb at creativeeyes.at
Wed Nov 16 15:45:12 CET 2005


On 16.11.2005, at 14:04, Will Robertson wrote:
> 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}

Wow. Now that's smart...

Bernhard


____________________________________________________
_________________________________ Bernhard Barkow __
___________________ gpg key ID _ A89F09C45921020D __






More information about the XeTeX mailing list