# Adjust vertical size of \sqrt contating terms with subscript and superscript

In the second \sqrt,

both the subscript and superscript are \smashed:

a_{\smash{0}}^{\smash{2}


Yet, the sqrt are of different sizes?

How do I get the second \sqrt to be the exact vertical size of the first?

## Notes:

• The tikz drawing is only to show that the two \sqrt are of different size.
• I do not want to adjust the size of the first \sqrt to match the second.

## Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}% <--- ONLY to show that the symbols are of different size

\newcommand{\MyTikzMark}[2]{%
\tikz[baseline,remember picture] \node[anchor=base,inner sep=0pt] (#1) {$\displaystyle#2$};%
}%

\begin{document}
$\MyTikzMark{Left Marker}{\sqrt{\overline{q}}} \sqrt{\overline{q}a_{\smash{0}}^{\smash{2}}}$
\begin{tikzpicture}[remember picture, overlay, dotted]
\draw [red] ([shift={(-2ex,-1pt)}]Left Marker.north) -- ++(10.0ex,0);
\draw [red] ([shift={(-2ex,+0pt)}]Left Marker.south) -- ++(10.0ex,0);
\end{tikzpicture}%
\end{document}

• You've stipulated, "I do not want to adjust the size of the first \sqrt to match the second." Why not? Do you want the horizontal bar of the square root symbol to (a) intersect the superscript numeral 2 or (b) become a tangent line to the upper curve of the numeral 2? – Mico Apr 29 '17 at 9:02
• @Mico: Hmmm... Good point. In my actual use case it seems that there would be room above the superscript, so that this is not an exact reproduction of my problem. But I think having a solution to this (with it touching the superscript) should help me fix my issue. So, effectively, I want to be able to get the \sqrt to ignore the height/depth of the superscript/subscript. – Peter Grill Apr 29 '17 at 9:07
• I think you have succeded allready. Your command \MyTikzMark that is used to set the first \sqrt is in \textstyle while the other \sqrt is in \displaystyle. Try to add \displaystyle to \MyTikzMark. Or add \sqrt{\overline{q}a_{0}^{2}} as a third version. – StefanH Apr 29 '17 at 9:16
• @StefanH: Oppps.. Can't belive I missed that. However, that seems to make the second one not quite as high as the first one. Have corrected the question. – Peter Grill Apr 29 '17 at 9:21
• @Mico: Revised question based on StefanH's feedback. Now need to make the second one larger to match the first. – Peter Grill Apr 29 '17 at 9:24

You do get the same square root sign; contrary to what you believe, TikZ enters in the picture. However, you have to smash the full new contents.

\documentclass{article}
\usepackage{amsmath}

\usepackage{tikz}% <--- ONLY to show that the symbols are of different size

\newcommand{\MyTikzMark}[2]{%
\tikz[baseline,remember picture] \node[anchor=base,inner sep=0pt] (#1) {$#2$};%
}%

\begin{document}
\begin{gather*}
\sqrt{\overline{q}} \sqrt{\overline{q}\smash{a_{0}^{2}}}
\\
\MyTikzMark{Left Marker}{\displaystyle\sqrt{\overline{q}}}
\sqrt{\overline{q}\smash{a_{0}^{2}}}
\\
\MyTikzMark{Left Marker B}{\sqrt{\overline{q}}}
\textstyle\sqrt{\overline{q}\smash{a_{0}^{2}}}
\end{gather*}
\begin{tikzpicture}[remember picture, overlay, dotted]
\draw [red] ([xshift=-2ex]Left Marker.north) -- ++(10.0ex,0);
\draw [red] ([xshift=-2ex]Left Marker.south) -- ++(10.0ex,0);
\draw [red] ([xshift=-2ex]Left Marker B.north) -- ++(10.0ex,0);
\draw [red] ([xshift=-2ex]Left Marker B.south) -- ++(10.0ex,0);
\end{tikzpicture}

\end{document}


• Yeah, I was missing \displaystyle in \MyTikzmark. Am curious, why did the a also need to be \smashed? It seems that it is just the subscript and superscript that were the cause of the vertical height issue. – Peter Grill Apr 29 '17 at 9:32
• @PeterGrill The placement of square root signs is a very hairy area. – egreg Apr 29 '17 at 9:34