[XeTeX] vertically aligned sub and superscript

Manuel Souto Pico m.soutopico at gmail.com
Fri Aug 3 21:58:16 CEST 2007


Hi,

I see that I forgot to reply this mail from Alan.

>
> Hi Manuel, in the thread that you mentioned I posted some code from
> Alexis Dimitriadis which solves this problem.  Here it is again.
> After loading gb4e etc., put the following in your preamble.  Now the
> super/subscripts should align properly inside examples.  -Alan
>
>
> \makeatletter
> %% Activate super- and sub-scripts outside of math mode.
>
> % \automath make _, ^ work outside math mode
> % \noautomath restore normal sub/superscript behavior
>
> { % Temporarily change catcodes
>    \catcode`\_=\active
>    \catcode`\^=\active
>
>    \global\def\automath{%
>      \catcode`\_=\active
>      \catcode`\^=\active
>      \def_##1{\@ifnextchar^{\automath at two_{##1}}{\ensuremath{\sb{##1}}}}%
>      \def^##1{\@ifnextchar_{\automath at two^{##1}}{\ensuremath{\sp{##1}}}}%
>    }
>    \def\automath at two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}
> }
> % Restore default categories for ^, _
> \def\noautomath{\catcode`\_=8 \catcode`\^=7 }
>
> % Turn the feature on by default
> \automath
>
> \makeatother
>

Thanks for this solution. What I did was this (taken from a thread in
the liest ling-tex called "gb4e.sty interaction with math
environments"):

Writing the two lines

\catcode`^=7
\catcode`_=8

after calling the package gb4e seems to fix the problem.

Thanks anyway!

Cheers, Manuel


More information about the XeTeX mailing list