10

This is somehow a follow-up question to this one.

I've got the following math expression: \nabla_y u_0^{(i)}\nabla_y v^{(i)}

However, no matte, whether I enclose the v in curly brackets or not (as indirectly suggested in the linked question), the last superscript ((i)) is always on a lower vertical position than the first superscript ((i)).

What is the optimal and advised method for ensuring that the superscripts are always on the same vertical position throughout my whole document?


Edit
Thank's to karlkoeller's anwser, I ended up using two custom commands:

\newcommand{\supp}[1]{_{\vphantom{0}}^{#1}}
\newcommand{\subp}[2]{_{\vphantom{0}#1}^{#2}} 

The first is used when no sub-script should be printed and the latter is used for all combinations of super- and subscripts. E.g.

u\subp{\varepsilon}{(i)} \nabla v\supp{(i)}
Torbjörn
  • 761

1 Answers1

13

This is because the first term has a subscript and the latter not.

One solution is to put a "phantom" subscript in the second term:

\(\nabla_y u_0^{(i)}\nabla_y v_{\phantom{0}}^{(i)}\)

enter image description here

karlkoeller
  • 124,410
  • Thanks a lot. Now I only have to write a macro for automatically adding that phantom subscript. – Torbjörn Jul 14 '13 at 06:59
  • Something like \newcommand{\pha}[1]{_{\phantom{#1}}} if you want to specify the subscript: \pha{0} or something like \newcommand{\pha}{_{\phantom{0}}} if you don't want to specify the subscript: \pha – karlkoeller Jul 14 '13 at 07:10
  • Ok, a last little follow-up question: How can I ensure, that the subscript \varepsilon has the same hight as a number as 0? When using \varepsilon as a subscript, the superscript is still as low as without a phantom-subscript. – Torbjörn Jul 14 '13 at 07:37
  • I can not confirm this, the superscripts have all the same height. – karlkoeller Jul 14 '13 at 07:52
  • 1
    I didn't meant the height of the _super_scripts, but the subscripts. The number 0 has the same hight as \phantom{0}. Anyway, I fixed this problem by using \vphantom{0} for all subscripts. This ensures a consistent hight of the subscripts and consistent vertical positioning of the superscripts. – Torbjörn Jul 14 '13 at 08:06
  • i'm not sure it matters, but the pre-script "y" doesn't have the same baseline as the subscript "0". (however, the two pre-scripts are even with one another, which is surely more important.) – barbara beeton Jul 14 '13 at 12:57
  • pre-script? y is a subscript of \nabla. I just altered \nabla_y into \nabla_{\!y} in my document to reduce the space between the symbol and its subscript. – Torbjörn Jul 14 '13 at 16:20