TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't like how the wide mn index of the roots is being displayed and am looking to see how others have handled this problem. I am using the closed square root from the references listed below which allows me to tweak the locations slightly and hence am able to get the m and n aligned on the left hand side, and tried moving the indices on the right, but am not pleased with the result:

enter image description here





  \setbox2=\hbox{\kern-0.375pt\vrule height\ht0 depth -\dimen0}%

\RenewDocumentCommand{\sqrt}{O{\hphantom{3}} O{0} O{0}  m}{\ClosedSqrt[\leftroot{#2}\uproot{#3}#1]{#4}}%

    \oldsqrt[m]{\oldsqrt[n]{x}} &= \oldsqrt[mn]{x} &\quad\text{original sqrt}\\
    \sqrt[m][-3]{\sqrt[n][-1][2]{x}} &= \sqrt[mn]{x} = \sqrt[mn][-3][2]{x} &\quad\text{closed sqrt}
share|improve this question
definitely not an answer, but I quite like to use rational exponents when the index gets too unruly :) – cmhughes Jul 5 '12 at 5:25
@cmhughes: Agreed, for general equations. But for the case where this radicals are being introduced to students, I think it is important to stick with radicals. – Peter Grill Jul 5 '12 at 5:57
The first example seems fine to me. Of course there's always $x^{1/(mn)}$. :) – egreg Jul 5 '12 at 8:43
Since you already have amsmath loaded the \uproot and \leftroot commands can be used for adjusting the position of the indices by small amounts – David Carlisle Jul 5 '12 at 13:59
@DavidCarlisle: I am already doing that in the above as the redefined \sqrt accepts two additional parameters which make use of the up and left movement. – Peter Grill Jul 5 '12 at 16:25
up vote 3 down vote accepted

This is what I can offer.



\RenewDocumentCommand{\sqrt}{ O{\hphantom{3}} O{0} O{0}  m }
   { #1 } % index
   { #4 } % main argument
   { \int_eval:n { #2 - 1 } } % left shift (default -1)
   { \int_eval:n { #3 + 1 } } % up shift (default 1)
\cs_new_protected:Npn \grill_root:nnnn #1 #2 #3 #4
  \latexsqrt[ \leftroot{#3} \uproot{#4} #1 ] { #2 }
\cs_generate_variant:Nn \grill_root:nnnn { nnxx }



\multicolumn{2}{l}{Original} \\
\latexsqrt[m]{\latexsqrt[n]{x}} &= \latexsqrt[mn]{x}\\
\latexsqrt[n]{\latexsqrt[m]{x}} &= \latexsqrt[nm]{x}\\
\latexsqrt[p]{\latexsqrt[q]{x}} &= \latexsqrt[pq]{x}\\

\multicolumn{2}{l}{New} \\
\sqrt[m]{\sqrt[n]{x}} &= \sqrt[mn]{x}\\
\sqrt[n]{\sqrt[m]{x}} &= \sqrt[nm]{x}\\
\sqrt[p]{\sqrt[q]{x}} &= \sqrt[pq]{x}


The renewed \sqrt command applies by default a \leftroot{-1} and a \uproot{1} to which the optional arguments add. This seems a good compromise in normal cases: an index with a descender doesn't touch the root symbol.

I'm afraid that something that works well with all sizes of the radical is impossible.

If you say


you clear off the default adjustment, but the optional arguments can be any integers.

Of course I won't consider the "closed" root, for reasons you should know. ;-)

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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