[XeTeX] Single glyphs from a font
Ross Moore
ross at ics.mq.edu.au
Tue Jun 9 06:31:43 CEST 2009
Hi Joel,
On 09/06/2009, at 12:11 PM, Joel C. Salomon wrote:
> Ross Moore wrote:
>> \makeatletter
>> \let\UnicodeMathSymbol\um at mathsymbol@noparse
>> \UnicodeMathSymbol{"02026}{\mathellipsis}{\mathrel}{ellipsis}%
>> \UnicodeMathSymbol{"02032}{\prime}{\mathord}{prime}%
>
> OK, we’re filling what’s missing from unicode-math.tex. I tried
> that,
> but I missed the
> \let\UnicodeMathSymbol\um at mathsymbol@noparse
> that makes the command work!
Yes, indeed.
>> \let\prime ′
>> \let\mathellipsis …
>
> Noting for the record that defining \mathellipsis causes amsmath’s
> \dotsc &c. to use that symbol. (You know that, but I only found that
> out by searching my MiKTeX installation tree.)
Use TeX's internal tracing, and study the resulting output
--- either in a Console/Log window, or view the .log file.
e.g.
\[ x_0, x_1, \ldots, x_n, {\tracingall\dotsc} \]
should reveal how \@ldots arises.
\[ x_0 + x_1 + \cdots + x_n, {\tracingall\dotsb} \]
should reveal how \@cdots arises.
Do these without the \let\@.... commands above,
or by using expandable macros instead; viz.
\def\@ldots{…}
\def\@cdots{⋯}
>
>> \let\@ldots …
>> \let\@cdots ⋯
>> \makeatother
>
> What are these definitions for? These commands are about to be
> unaccessible after \makeatother. Is there some package that’s
> expecting
> these names?
They are part of the expansion, as defined in amsmath.sty
of the user-level commands \ldots and \cdots .
\tracingall is a good way to find out what is happening
to macros, without trying to read the coding inside packages.
Beware though, it can produce *lots* of output, even when
you use braces {\tracingall ... } to limit the scope.
>
> (B.T.W., unicode-math.tex already declares ‘⋯’ to be a
> \mathrel, so I
> omitted that line.)
Fair enough. No need to repeat it.
>
> So basically, the reason \tag{\ref*{abc}$′$} didn’t work before
> was that
> the TeX didn’t know what math category the prime character fell
> into, so
> it got ignored?
Yes, sort of.
Tracing with \tag{$\ref{abc}\tracingall′$}
gives:
>> {into \tracingonline=1}
>> {the character ′}
>> {math shift character $}
>> Missing character: There is no ′ in font cmr10!
So unless a character has been declared for math by unicode-math,
it will have its default meaning from non-XeTeX LaTeX.
But there is no such character in those old-style fonts, so it
just gets left out, and takes up no typesetting space.
>
>> Now even this works: \tag{$\ref{abc}'$}
>> using the ordinary ASCII single-quote/apostrophe.
> Not quite; $'$ has some superscripting magic associated with it. Try
> $\prime{}'$ and you’ll see the difference. (Without the ‘{}’,
> you’ll
> get a weird primed prime.)
That is TeX's \mathcode"8000 trick, which allows ordinary
letters to become macros when in math-mode.
Use \tracingall to see what happens.
>> '->^\bgroup \prim at s
>> {superscript character ^}
>> {entering math group (level 6) at line 40}
>>
>> \prim at s ->\prime \futurelet \@let at token \pr at m@s
>> {the character ′}
>> {\futurelet}
>> {changing \@let at token=the character *}
>> {into \@let at token=blank space }
>>
>> \pr at m@s ->\ifx '\@let at token \expandafter \pr@@@s \else \ifx ^
>> \@let at token \expandafter \expandafter \expandafter \pr@@@t \else
>> \egroup \fi \fi
It is "looking ahead" to see if the next character is another prime,
or the ^ symbol.
This makes it very convenient to do f'' and f''' etc.
But other complicated superscripting should not be done this way.
>
> (B.T.W., re. the ‘*’: I’m using hyperref; Ignore it.)
Aaah; OK. I should have guessed this.
>
> Thanks for the help,
> —Joel Salomon
Hope this helps,
Ross
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
More information about the XeTeX
mailing list