Please look at the following MWE. I found an automatic solution for nice roots. The depth of letters ist ignored and subscripts do not influence the depth.

But when I nest the roots, it gets ugly. What am I doing wrong? What has to be done for nice nested roots?


Sorry for using \over, but I usually use Plain (Lua-)TeX. But loading OTF fonts with low level commands would give many extra lines in the code, so I write this MWE with LuaLaTeX and Unicode Math.

% Only for LuaTeX



% to get cramped style


    \Umathcodenum`j=`i % example for goobling depth of letters
    \setbox\z@\hbox{\scantokens{\catcode`\_=\active \let_=\@gobble
                    $\m@th#1{\vphantom{0}#2}$}} % Subscripts do not influence depth
    \Uradical"0"221A {\box\r@@tbox}}

This works fine for not nested roots:
$ \sqrt A \sqrt j $, $ \sqrt{Aj} $, $ \sqrt{1_{1_1}\over Aj_{A_A}} $

However, there is a problem with nested roots:
$ \sqrt{\sqrt{\sqrt{\sqrt{\sqrt{11}}}}} $

The base of the root signs alternates and the radical rules
are vertically spaced unequal. What am I doing wrong?

  • 3
    ` \global` looks suspicious in anything that can be nested – David Carlisle Jul 16 '19 at 22:33

If you avoid the global setting with


Then you get

enter image description here

| improve this answer | |
  • Good answer. I'm putting this question in my favorites. Why does this happen with root boxes? I've also tried mtpro2[lite] and the same thing happens. – Sebastiano Jul 16 '19 at 22:42
  • 2
    @Sebastiano it's nothing to do with roots, as I commented under the question anything using \global is likely to fail in a nested context as global definitions do not obey the nested scope. – David Carlisle Jul 16 '19 at 22:44
  • Thank you, this is what I wanted. On this website I have already learned more about TeX than in every book. – user125730 Jul 18 '19 at 13:53

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.