[XeTeX] Hoefler and slash-textsection
Jonathan Kew
jonathan_kew at sil.org
Wed Aug 25 20:25:29 CEST 2004
On 25 Aug 2004, at 6:27 pm, Bruno Voisin wrote:
> Le 25 août 04, à 19:03, Musa Furber a écrit :
>
>> If I want to use Hoefler's section glyph (§), I can call it manually
>> using
>>
>> \XeTeXglyph 134
>>
>> Is there an easy way to set \textsection so it does the same? When I
>> tried
>>
>> \renewcommand{\textsection}{\XeTeXglyph 134}
>>
>> I ended up with a blank space.
>
> Did you try without the space? The following works for me (with
> Trebuchet MS):
>
> \renewcommand{\textbullet}{\XeTeXglyph135}
Space after \XeTeXglyph should be irrelevant (just like with other
control sequences). My guess is that Musa's use of \textsection in the
document is immediately followed by a number, like "\textsection 2";
with macro expansion and the discarding of spaces after control
sequences, this will result in glyph 1342. A safer definition would be
\renewcommand{\textsection}{\XeTeXglyph 134\relax}
However....
>
> That said, Jonathan Kew recommanded once against such use of
> \XeTeXglyph, in a thread "[XeTeX] Maths and Symbols in Latex" on June
> 30:
>
>> I'd recommend using {\char"2022} rather than {\XeTeXglyph...}; that
>> should be less font-dependent and more robust. Glyph numbers could
>> easily change even from one version to another of the same typeface,
>> whereas the Unicode character code is standard.
>
> and similarly Ross Moore:
>
>> I'd recommend using \renewcommand{\textdollar}{{\char"0024}}
>> or \renewcommand{\textdollar}{{^^^^0024}}
>> with the extra braces.
>> The advantage is that the expansion of the macro acts as a single
>> token, if ever the \textdollar becomes a parameter to another macro,
>> after some expansion; e.g. when writing into the .aux or .toc file,
>> or for the index or bibliography.
>>
>> Even better is to use a declaration:
>>
>> \DeclareRobustCommand{\textdollar}{{\char"0024}}
>> or
>> \DeclareRobustCommand{\textdollar}{{^^^^0024}}
>
> BTW, did you also try (I never did myself):
>
> \renewcommand{\textsection}{§}
>
Or, if you want your source file to be plain ASCII, you could say
\DeclareRobustCommand{\textdollar}{{^^^^00a7}}
since U+00A7 is the Unicode character code of the section sign.
Don't use glyph numbers for things that have legitimate character
codes; they're inherently font- and version-specific, and therefore
fragile and non-portable, whereas Unicode character codes are defined
by an international standard. That \textdollar command will work with
any Unicode-compliant font; the \XeTeXglyph version will give
pseudo-random results if you ever change fonts, and possibly even next
time you get an OS upgrade (if Apple revises the font).
> And possibly Ross' package utf8accents.sty, posted to this list (in an
> archive utf8syms.tgz) in a thread "[XeTeX] OS X fonts" on July 22,
> could do the job as well (I haven't tried it yet).
>
Worth checking this out; I don't know exactly what inventory of
characters this supports.
JK
More information about the XeTeX
mailing list