12

I found a solution (3rd \sqrt), but am curious as to why the \smash{} in {\sum_{\smash{ij}} (2nd \sqrt) is ignored.

enter image description here

Notes:

Code:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
    \sqrt{\sum_{ij} f(i,j)}
    \sqrt{\sum_{\smash{ij}} f(i,j)}
    \sqrt{\vphantom{\sum}\smash{\sum_{ij}} f(i,j)}
\]
\end{document}
15

You get the same as in the second example with an empty subscript, because TeX reserves the space and it forces the next size, which happens to be the same as when the subscript is present. The only difference is that in the first case the radical is lowered because of the depth of j.

The “real” solution is

\[
  \vphantom{\sum_{ij}}\sqrt{\vphantom{\sum}\mathop{\smash{\sum_{ij}}} f(i,j)}
\]

enter image description here

The outer phantom is to ensure the real depth is taken care of.

However, I'd suggest one of the following two realizations.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
  \Bigl(\,\sum_{ij}f(i,j)\Bigr)^{1/2}
  \qquad
  \biggl(\,\sum_{ij}f(i,j)\biggr)^{\!1/2}
\]
\end{document}

enter image description here

Here's a visual proof of the top statement.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\fbox{$\displaystyle{\mathop{{}{=}}_{}}$}
\fbox{$\displaystyle=$}

\end{document}

enter image description here

The {}{=} is to ensure the Op atom is not centered with respect to the math axis and not to add spaces around =.

With \showlists we see the first formula is

\displaystyle
\mathord
.\mathop
..\mathord
...{}
..\mathord
...\mathrel
....\fam0 =
._{}

and the empty subscript is clearly visible and adds the vertical space.

|improve this answer|||||
  • I would like to know why in the "real'' solution it is necessary to have both \vphantom{\sum} and \mathop{\smash{\sum_{ij}}} at once; after some tests, the latter seems to yield pretty much the same as just \vphantom{\sum}\smash{\sum_{ij}}, i.e., the OP's own suggestion. – Fitzcarraldo Feb 1 '19 at 1:11
  • 1
    @Fitzcarraldo You get different spacing. Slightly different, but not negligible. – egreg Feb 1 '19 at 7:46
  • So, in the case of the square root of a product of two families or series, namely, \sqrt{\Bigl(\sum_{i\in I} a_i^2\Bigr) \Bigl(\sum_{i\in I} b_i^2\Bigr)} or \sqrt{\biggl(\sum_{i=1}^\infty a_i^2\biggr) \biggl(\sum_{i=1}^\infty b_i^2\biggr)}, what would you suggest in the same vein? Would you treat the entire inner bunch as a whole, and would you use \mathord instead of \mathop? – Fitzcarraldo Feb 1 '19 at 8:52
  • @Fitzcarraldo Not sure what you mean. \mathop{\smash{...}} is necessary to get the proper spacing around the summation sign. – egreg Feb 1 '19 at 8:57
  • That part is clear to me; what I wanted to know is what to do when you don't have one summation sign, but two, and even more, surrounded both by parentheses. Would you apply \mathop{\smash{...}} twice only to each such sign, or would you put the whole brick I wrote, parentheses and all, inside just one \mathop{\smash{...}}, which in that case might turn into \mathord{\smash{...}}, since its content wouldn't be, strictly speaking, an operator anymore? – Fitzcarraldo Feb 1 '19 at 9:10
4

If using \sqrt I propose this as a nicer looking (in my view) way:

\documentclass{article}

% \usepackage{mathtools}

\begin{document}
\[
    \sqrt{\sum\nolimits_{ij} f(i,j)}
\]
\[
    \sqrt{\,\sum\nolimits_{ij} f(i,j)}
\]
\end{document}

enter image description here

I find the square root too close to the top angle of sum symbol, hence the second line which adds a bit of space.

|improve this answer|||||
2

FWIW, the nath package ignores the subscripts which calculating the height of the square root:

\documentclass{article}
\usepackage{nath}

\begin{document}
\[
  \sqrt{\sum_{ij} f(i,j)}
\]
\end{document}

which gives

enter image description here

Note that nath is incompatible with the display math environments of amsmath, which can severely limits its usability.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.