[XeTeX] Using the Unicode prime character (Was re. Single glyphs from a font)

Joel C. Salomon joelcsalomon at gmail.com
Wed Jun 10 00:22:35 CEST 2009


>
>> I suppose the fix for this would be to redefine the \mathcode"8000 macro
>> for ['] so that it directly evaluates to [′].  Or just to avoid the $x'$
>> form and directly use $x\prime$ or $x′$.
>
> I'd not mess with the \mathcode of ['].
> You'll surely break multiple primes. See my attached image.
>
> If you want to mess with anything, do some tracing to look at how
> $f''$ expands. Hook into the internal macros rather than change
> the user-interface.

Tried this with PDFLaTeX:

\documentclass{minimal}
\begin{document}
    ${\tracingall x''}$
\end{document}

Could not make sense of the trace:

{the letter x}
{the character '}

'->^\bgroup \prim at s
{superscript character ^}

\prim at s ->\prime \futurelet \@let at token \pr at m@s
{\mathchar"230}
{\futurelet}

\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
{\ifx}
{true}
{\expandafter}
{\else}

\pr@@@s #1->\prim at s
#1<-'

\prim at s ->\prime \futurelet \@let at token \pr at m@s
{\mathchar"230}
{\futurelet}

\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
{\ifx}
{false}
{\ifx}
{false}
{end-group character }}
{restoring \@let at token=begin-group character {}
{\fi}
{\fi}
{end-group character }}


I have very little idea of what this all means (though Ross’s
explanation of the look-ahead is somewhat enlightening), and almost no
idea where to start hooking things into the internal macros.  I can
guess it would involve redefining one or more of \prim at s, \pr at m@s,
\pr@@@s, and \pr@@@t., but beyond that…

—Joel Salomon


More information about the XeTeX mailing list