[XeTeX] vertically aligned sub and superscript

Manuel Souto Pico m.soutopico at gmail.com
Thu Jul 26 20:10:03 CEST 2007


Thank you so much, William.

2007/7/20, William Adams <will.adams at frycomm.com>:
>
> On Jul 20, 2007, at 9:50 AM, Manuel Souto Pico wrote:
>
> > I would like to know if it's possible to have a subscript and a
> > superscript
> > at the same and vertically aligned.
> >
> > What I'm doing now is x_{a}^{b} o x^{b}_{a} but a and b are not
> > aligned.
>
> You'll need a strut or invisible box of some sort to make the box for
> the ``a'' as tall as that for the ``b'' --- probably the best thing
> to do is to define a macro which takes three arguments, e.g.:
>
> \documentclass{minimal}
> \newcommand{\supersub}[3]{#1^{#2\vphantom{b}}_{#3\vphantom{b}}}
> \begin{document}
> $x^a_b$ $x^b_a$ $\supersub{x}{a}{b}$ $\supersub{x}{b}{a}$
> \end{document}


Your code works perfectly.

I was surprised to see that, if I compile the file using those five lines
and nothing else, I can get aligned scripts by simply typing $x^a_b$.
However, in my document, this is not so.

So I run a few tests and it seems there's an incompatibility with the
package gb4e, which is used for glosses and examples in linguistics. If I
remove it, the scripts a and b are aligned in $x^a_b$.

I believe.
>
> I'd suggest checking out Gratzer's Math Into LaTeX to be sure of a
> good answer though.


Thanks so much again.

Cheers, Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20070726/c630e49e/attachment-0001.html 


More information about the XeTeX mailing list