rendering tex: sqrt: placement of root

EDIT: after reading egreg's comment, changing from \sqrt[3]{x} to \root 3 \of{x}, to indicate using plain TeX, not LaTeX

Consider $$\sqrt{x}$$ vs $$\root 3 \of{x}$$.

The latter has a 'root' of 3.

How do we typeset this?

On page 443 of the TeX Book, rule 11, it describes typesetting the radical atom: \radcal and \sqrt. However, it only describes "root-less" types, like \sqrt{x}, and not the ones with a root, like \root 3 \of{x}

Question: how is the root/3 in a sqrt typeset?

• In plain TeX (as opposed to LaTeX) it is \root 3\of{x}. The TeXbook, page 130 (bottom). Do you mean you want a description of how LaTeX implements \sqrt[3]{x}? – egreg Sep 20 '17 at 10:26
• @egreg: thanks for clarification, changed to \root 3 of{x} . (source of confusion: reading TeX book, but used LaTeX most of my life) – user47368 Sep 20 '17 at 10:47
• @egreg : so I'm reading the bottom of page 130. It's describing how I can use \root -- but how do I implement \root ? (I'm writing a WYSIWYG math equation editor -- and I'm trying to figure out how TeX renders roots) – user47368 Sep 20 '17 at 10:50
• The description of the macro is on page 360, starting from \newbox\rootbox. – egreg Sep 20 '17 at 10:53
• @egreg: \newbox\rootbox \def\root#1\of{\setbox\rootbox= \hbox{$\m@th \scriptscriptstyle{#1}$}\mathpalette\r@@t} \def\r@@t#1#2{\setbox0=\hbox{$\m@th #1\sqrt{#2}$} \dimen@=\ht0 \advance\dimen@ by-\dp0 \mkern5mu \raise.6\dimen@\copy\rootbox \mkern-10mu \box0} . ... fascinating, wasn't aware the TeX macro system was this "powerful" – user47368 Sep 20 '17 at 10:56