Math & Scienceunequal superscript heights

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

unequal superscript heights

Post by php1ic »

Hi All,

If you compile the below MWE you will see that the superscript 2s are at different heights

Code: Select all

\documentclass[a4paper,11pt]{article}

\begin{document}
\[
E_{_{qp}} = \sqrt{\left(E_{_{sp}} - E_{_{F}}\right)^{2} + \Delta^{2}}
\]
\end{document}
I've tried using \left.\Delta\right.^{2} to raise the second 2 but it has no effect.
Also \Delta_{_{\vphantom{F}}}^{2} doesn't change it.

Any ideas how to get them to the same level? I would prefer them both to be at the height the second one currently is, but if it's simpler to have both lower that is OK.

Thanks
Last edited by php1ic on Sat Sep 25, 2010 2:52 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

unequal superscript heights

Post by gmedina »

Hi, php1ic

you could try something like this:

Code: Select all

\documentclass[a4paper,11pt]{article}

\begin{document}

\[
  E_{_{qp}} = \sqrt{\left(E_{_{sp}} - E_{_{F}}\right)^{2} + \Delta\rule{0pt}{8.45pt}^{2}}
\]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

unequal superscript heights

Post by localghost »

It requires a (mathematical) strut to get the desired result.

Code: Select all

\documentclass[11pt,a4paper]{article}

\begin{document}
  \[
    E_{qp}=\sqrt{\left(E_{sp}-E_F\right)^2+{\Delta\mathstrut}^2}
  \]
\end{document}
Note the additional braces for grouping.

The problem settles if you drop the unnecessary automatic adjustment of the parentheses.

Code: Select all

\documentclass[11pt,a4paper]{article}

\begin{document}
  \[
    E_{qp}=\sqrt{(E_{sp}-E_F)^2+\Delta^2}
  \]
\end{document}
Addendum:
php1ic wrote:Any ideas how to get them to the same level? I would prefer them both to be at the height the second one currently is, but if it's simpler to have both lower that is OK.
Isn't that the same? I've seen that after I posted my solution which would do the opposite and raise the second superscripted »2«. The code below lowers the first one and keeps the scaled parentheses.

Code: Select all

\documentclass[11pt,a4paper]{article}

\begin{document}
  \[
    E_{_{qp}}=\sqrt{\left(E_{_{sp}}-E_{_{F}}\right){}\kern-1pt^{2}+\Delta^{2}}
  \]
\end{document}
It only requires an empty group to neglect the height of the right parenthesis. The negative kerning is necessary to move the superscript closer. By the way, a very interesting technique to get small subscripts.


Thorsten
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

unequal superscript heights

Post by gmedina »

localghost wrote:It requires a (mathematical) strut to get the desired result...
Of course, I don't know where my head was when I proposed that hideous solution using \rule.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

unequal superscript heights

Post by localghost »

gmedina wrote:Of course, I don't know where my head was when I proposed that hideous solution using \rule.
Likewise sometimes.
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: unequal superscript heights

Post by php1ic »

Thanks for the responses, I've dropped the automatic adjustment of the parentheses to get everything aligned.

I'll definitely remember the \mathstrut for the future.

Thanks again.
Post Reply