# Should I use \mathsmaller with superscripts and subscripts in \frac?

I am stuck with how to best format this equation and would love if you stylish tex-heads could help me out.

It looks like this:

I am happy with it except for the:

I think the 2 and 0 are too big and close to the k. On first glance for me it looks messy. So I changed it so any superscript or subscript uses \mathsmaller{}. It looks like this:

I much prefer the k_0^2 now, but I am not sure the rest of the equation is as good. But If I remove /mathsmaller{} from the e^{ikr}, then it looks too big and not lined up with the 2. Should I just mix and match, or is there a better more consistent way I should approach this?

MWE:

\documentclass{article}
\usepackage{relsize,amsmath}
\begin{document}

\newcommand{\vecr}{{\bar{r}}}
\newcommand{\vecq}{{\bar{q}}}
\newcommand{\vecE}{{\bar{E}}}
\newcommand{\veck}{{\bar{k}}}
\newcommand{\ee}{\mathrm{e}}
\newcommand{\ii}{\mathrm{i}}
\newcommand{\II}{\mathrm{I}}
\newcommand{\kk}{\mathrm{k}}
\renewcommand{\ss}{\mathrm{s}}

$$%without mathsmaller \vecE_{s}(\vecr,t) = \frac{k_{0}^2}{4 \pi} \frac{\ee^{\ii kr}}{r} \left( \hat{\II} - \hat{\kk}_{\ss} \hat{\kk}_{\ss} \right) \int_{V} \ee^{\ii \veck^{\prime} \cdot \vecr^{\prime}} \vecE (\vecr^{\prime},t)$$

$$%with mathsmaller \vecE_{s}(\vecr,t) = \frac{k_{\mathsmaller{0}}^\mathsmaller{2}}{4 \pi} \frac{\ee^{\mathsmaller{\ii kr}}}{r} \left( \hat{\II} - \hat{\kk}_\mathsmaller{\ss} \hat{\kk}_\mathsmaller{\ss} \right) \int_{V} \ee^{\ii \veck^{\mathsmaller{\prime}} \cdot \vecr^{\mathsmaller{\prime}}} \vecE (\vecr^{\mathsmaller{\prime}},t)$$

\end{document}

-
If you think that the 2k_0 is too big then use \tfrac{k^2_0}{4\pi}. This typesets a "text-sized" fraction. Similarly, there is a \dfrac{}{} for display-sized fractions (for use outside of displays). –  Andrew Aug 10 '14 at 8:37
Can't you mathstrut the whole thing and rescale? –  1010011010 Aug 10 '14 at 9:53
I still don't understand people who do not trust TeX in how math fomulas look like by default. The first formula in the question looks by no means the best of all presented ones, including those in the answer. In like 80% of articles I typeset in the journal, I remove spurious added spaces, sizing commands etc. Why do you all insist that Knuth is stupid? –  yo' Aug 10 '14 at 11:45
@tohecz Its not that I don't trust it, but I want to learn how to control little things like this to improve my TeX knowledge. In this case though, I do feel that from a purely visual point of view, Mico's solution does look better. –  Steve Hatcher Aug 10 '14 at 12:15
@SteveHatcher I get that point. Still, the answer to the question "Should I use \mathsmaller with superscripts and subscripts in \frac?" is: No. –  yo' Aug 10 '14 at 12:16

In my (naturally not so humble and unapologetically subjective...) opinion, the improvements brought about by \mathsmaller in the subscript and superscript position of the expression k_0^2 do not go quite far enough. Specifically, I think both the subscript 0 and the superscript 2 "squat" too low. Consider adding the instruction \mathstrut to the numerator:

k_{\mathsmaller 0}^{\mathstrut \mathsmaller 2}


As the screenshot below shows, both the 0 and the 2 term no longer look like they're squatting after the insertion of \mathstrut.

If you like the look and have a lot of these terms, you could define a shortcut macro called, say, \kzerosq, to simplify the repeated typing of this term.

\documentclass{article}
\usepackage{relsize,amsmath}
\newcommand\kzerosq%
{k_{\mathsmaller 0}^{\mathstrut \mathsmaller 2}}

\begin{document}

$k_0^2$ vs.\ $k_{\mathsmaller 0}^{\mathsmaller 2}$ vs.\ $k_{\mathsmaller 0}^{\mathstrut \mathsmaller 2}$

\bigskip
$\displaystyle \frac{k_{0}^2}{4 \pi} \text{ vs.\ } \frac{k_{\mathsmaller0}^{\mathsmaller2}}{4 \pi} \text{ vs.\ } \frac{\kzerosq}{4 \pi}$

\end{document}

-
That's awesome. Without knowing which was which, my favorite of each example was the far right one. Looks like $\mathstrut$ to the rescue, guess I will have to read about exactly what it does. Thanks –  Steve Hatcher Aug 10 '14 at 11:41
@SteveHatcher - the macro \mathstrut is defined in both Plain-TeX and LaTeX as \vphantom(, i.e., as an object with no width (hence "invisible", like a phantom...) and the height and depth of (, i.e., a round parenthesis. The insertion of the strut, combined with TeX's algorithm for placing subscripts and superscripts of varying heights and depths, results in both the subscript and superscript terms being placed further up than would happen by default. –  Mico Aug 10 '14 at 11:46

Here is a solution that switches to \scriptscriptstyle instead of \scriptstyle for digits only, thanks to a code I borrowed and adapted from @egreg. Incdentally, I think that rather than using \bar, I would use \widebarfrom the mathx font (mathabx package, it doesn't exist in the basic fonts), and \widehat from the same font (the one from the basic font is too wide, in my opinion).

Compare:

\documentclass{article}
\usepackage{relsize,amsmath}

\makeatletter
\def\changedigit#1{%
\begingroup\uccode~=#1\uppercase{\endgroup
\edef~}{{\mathchoice
{\mathchar\the\mathcode#1}
{\mathchar\the\mathcode#1}
{\scriptscriptstyle\mathchar\the\mathcode#1}
{\mathchar\the\mathcode#1}
}}
\AtBeginDocument{\mathcode#1=\string"8000 }
}
\@for\next:=1,2,3,4,5,6,7,8,9,0\do{\expandafter\changedigit\next}
\let\changedigit\@undefined
\makeatother

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{ <->  mathx10}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}
\DeclareMathAccent{\widehat}{0}{mathx}{"70}

\newcommand{\vvecr}{{\widebar{r}}}
\newcommand{\vvecq}{{\widebar{q}}}
\newcommand{\vvecE}{{\widebar{E}}}
\newcommand{\vveck}{{\widebar{k}}}

\begin{document}

\newcommand{\vecr}{{\bar{r}}}
\newcommand{\vecq}{{\bar{q}}}
\newcommand{\vecE}{{\bar{E}}}
\newcommand{\veck}{{\bar{k}}}
\newcommand{\ee}{\mathrm{e}}
\newcommand{\ii}{\mathrm{i}}
\newcommand{\II}{\mathrm{I}}
\newcommand{\kk}{\mathrm{k}}
\renewcommand{\ss}{\mathrm{s}}

$$\vvecE_{s}(\vecr,t) = \frac{k_{0}^{2}}{4 \pi} \frac{\ee^{\ii kr}}{r} \left( \widehat{\II} - \widehat{\kk}_{\ss} \widehat{\kk}_{\ss} \right) \int_{V} \ee^{\ii \vveck^{\prime} \cdot \vvecr^{\prime}} \vvecE (\vecr^{\prime},t)$$
\vskip 1cm

With \texttt{\textbackslash mathsmaller}:
$$%with mathsmaller \vecE_{s}(\vecr,t) = \frac{k_{\mathsmaller{0}}^\mathsmaller{2}}{4 \pi} \frac{\ee^{\mathsmaller{\ii kr}}}{r} \left( \hat{\II} - \hat{\kk}_\mathsmaller{\ss} \hat{\kk}_\mathsmaller{\ss} \right) \int_{V} \ee^{\ii \veck^{\mathsmaller{\prime}} \cdot \vecr^{\mathsmaller{\prime}}} \vecE (\vecr^{\mathsmaller{\prime}},t)$$

\end{document}


-
The 4\pi term in the first denominator now looks badly mangled, with or without \mathsmaller in effect. –  Mico Aug 10 '14 at 10:58
You mean the use of oldstyle number in 4π? I didn't notice it, as I usually set my documents that way (oldstyle in text ans display style). I'll have to understand the details of @egreg's code, in order to only change the size, not switch oldstyle/lining. –  Bernard Aug 10 '14 at 11:06
With the adjustment, the denominator term currently looks more like 4^{\pi} rather than like 4\pi`: probably not desirable, right? As a separate matter, it's frequently a bad idea -- or, at the very least, not worth the complications -- of using oldstyle numerals in math mode. Much safer to use lining numerals in math mode, in my experience... –  Mico Aug 10 '14 at 11:10
I don't agree with you: one sees clearly π is the same size as the rest. It's a matter of being used to oldstyle numbers — and I confess I do appreciate old style typography in maths. Now I'll change the code in order to get lining numbers everywhere as soon as I understand all the details of @egreg's code. –  Bernard Aug 10 '14 at 11:20
I have to admit the code is confusing for me but it seems to be a way to automate a lot of the sizing of hats and scripts so I will have a look into this. Thanks –  Steve Hatcher Aug 10 '14 at 11:40