# Correct use of smash with math and root signs

How can I get the same height on the second root-sign as the first?;

$$\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{16a^2}} =\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{(4a)^2}}$$


I've tried different methods using \smash, \vphantom and \rule[]{}{} but could not work out which was the best and most 'proper' way of solving this 'problem'. TIA.

• Thanks for all help, but I cannot understand why the ^2 cannot go under the \smash command in the solution suggested by Mico. The following two examples does not result in the same display: \smash{(4a)}^2 and \smash{(4a)^2} (Sorry, did not know how to type in the comment box to get better display of codes.) – mf67 Jul 24 at 10:31
• If you compare the outputs of \smash{(4a)}^2 and \smash{(4a)^2}, you'll notice that the exponent is placed higher relative to the baseline if the scope of \smash includes the exponent -- not by a huge amount, for sure, but by about 1 or 2 points. This difference results in a slight increase in the overall height of the denominator which, in turn, explains why LaTeX sees fit to employ a taller (and deeper) square root symbol when it processes \smash{(4a)^2}. – Mico Jul 24 at 12:31

## 3 Answers

What you need to do is replace (4a)^2 in the second denominator with either \smash{(4a)}^2 or \smash[b]{(4a)}^2. This yields compact-looking square root terms, and it works with both \tfrac and \dfrac.

Observe that if you, alternatively, replaced 16a^2 in the first denominator with 16a^2\mathstrut, the two square root symbols would also have equal sizes. However, they would be much taller -- excessively and unnecessarily so, IMNSHO -- than with the adjustment suggested above. \documentclass{article}
\usepackage{amsmath}
\begin{document}
$\sqrt{\dfrac{1+2\cdot4a^2+(4a^2)^2}{16a^2}} =\sqrt{\dfrac{1+2\cdot4a^2+(4a^2)^2}{\smash{(4a)}^2}}$

$\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{16a^2}} =\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{\smash{(4a)}^2}}$
\end{document}

• Please see comment in the question, I might have put it in the wrong place… Perhaps it should have been here. – mf67 Jul 24 at 10:34
• @mf67 - Please see the comment I left below your follow-up comment. Did I answer your question? Please advise. – Mico Jul 24 at 12:35
• I don't fully understand the effect of \smash it seems. I thought that \smash{(4a)^2} would remove any height and 'equal' it to, e.g. an "a" or "x" and thus not extend the root sign any deeper. Instead it seems like it, as you write, places the exponent higher, but normal, than in \smash{(4a)}^2 and thus forces down the base and therefore the depth of the root sign. A 0-height box, as I thought \smash{(4a)^2} was, would not do that? The \smash{(4a)}^2 'compress' the exponent and, although not extremely disturbingly 'ugly', it looks a bit different from the a^2 in the numerator. – mf67 Jul 24 at 17:12
• @mf67 - I don't thinks it's entirely correct to call \smash{(4a)^2} a "zero-height box". Please compile $\sqrt{\frac{1+2\cdot4a^2+(4a^2)^2}{\smash{(4a)}^2}} = \sqrt{\frac{1+2\cdot4a^2+(4a^2)^2}{\smash{(4a)^2}}} = \sqrt{\frac{1+2\cdot4a^2+(4a^2)^2}{\smash{\smash{(4a)^2}}}}$. You'll see that the square root term in the middle, which contains \smash{(4a)^2}, is taller than the other two. It looks like it's necessary to \smash the term (4a)^2 twice in order to obtain the compact square root expression shown on the left. That's why I recommended writing \smash{(4a)}^2... – Mico Jul 24 at 17:47
• @mf67 - If this topic continues to puzzle you, may I suggest that you post a new query, in which you would ask for an explanation of how exactly \smash works? There are some amazing TeX wizards on this site; they can explain how \smash works in all gory detail -- and much much better than I ever could. – Mico Jul 24 at 17:50

Equalizing radicals is something of a black art.

The difference is due to the right hand side having parentheses. We can cope with this by adding \mathstrut in the left hand side denominator. But this makes TeX choose the next size for the radical. Using \smash[b]{...} for the denominator doesn't help.

The problem is that \tfrac imposes \textstyle, which has raised denominators. One could use \cramped from mathtools, but there's a slicker solution:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\textstyle \sqrt{\frac{1+2\cdot4a^2+(4a^2)^2}{\mathstrut 16a^2}} =\sqrt{\frac{1+2\cdot4a^2+(4a^2)^2}{(4a)^2}}$

\end{document} A simple \vphantom will do the trick. And, please, don't use the plain TeX construct $$...$$ for unnumbered displayed equations. Use [ ... \] instead.

\documentclass[11pt, a4paper]{article}
\usepackage{amsmath}

\begin{document}

$\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{\vphantom{)}16a^2}} =\sqrt{\tfrac{1+2\cdot4a^2+(4a^2)^2}{(4a)^2}}$

\end{document} 