The following mathmatical expression is not being displayed the way I expect it to be.
\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
$3x\sqrt{y}-4-2\sqrt{y}+6x$
\end{document}
Note in the output above, the square root symbol is not "base aligned" (Don't know how to describe it better in LaTex language). I have tried the \smash
command but haven't been successful. I know it shouldn't be anything hard to achieve, but seemingly I can't at the moment.
I know that there exists the \smash[b]{$math input$}
and \smash[t]{$math input$}
.
EDIT:
Is the code below sufficient? (The answer is NO and that is why I seeked clarification to understand the typographical effects explained below.)
$3x\mathord{\raisebox{0.5\depth}{$\sqrt{y}$}}-4-2\mathord{\raisebox{0.5\depth}{$\sqrt{y}$}}+6x$
which yields:
Best Answer
Square roots are often a cause for small, but annoying, problems. Something like
will show a variety of ways the surd is typeset
Particularly problematic are the characters with a descender, but also "j":
The decision about how to treat such a formula depends on the symbol involved; for example, if there are only characters with descenders, a
\smash[b]
(requiresamsmath
) can solve the problem:One can see that the white space above the letter is not too much (and the lower angle of the surd is slighly below the baseline).
However this can't be the solution for the first formula, where there's a letter with an ascender: we need to pretend that the ascender is in all square roots, but the depth of
y
should be masked offAlternatively, one can use
\mathstrut
that inserts a "phantom parenthesis":but this uses a sligthly larger surd.
Beware of a related problem:
gives the wrong
If such formulas are possible in our document, I recommend to change the definition of
\cos
:so that the formula will by typeset correctly as
As it can be clearly seen, there's little hope to get an automatic solution, as a good treatment depends on what's in the formula, not only on the particular square root.