4

In my document, I am using a font and size which just makes scriptscriptstyle too small, and it looks weird to me:

With scriptscriptstyle index

If instead of \sqrt[3]{...} I write \sqrt[\scriptstyle 3]{...} it looks better:

With scriptstyle

And I want to apply this to all the square roots in my document, without typing \scriptstyle every single time.

My first solution was this:

\let\oldsqrt\sqrt
\renewcommand{\sqrt}[2][\phantom{1}]{\oldsqrt[\scriptstyle#1]{#2}}

but then I can't use \uproot{} in \sqrt to adjust some fractions. (I'm not sure why, but it throws an error)

So, my next solution attempt was to look into the definition of \sqrt (using \show in a console)

> \sqrt =\long macro:
->\@ifnextchar [\@sqrt \sqrtsign .
<argument> \sqrt

then I looked into the \@sqrt definition:

> \@sqrt=macro:
[#1]->\root #1\of .
<argument> \@sqrt

finally I had a look at the \root definition and I found what I wanted:

> \root=macro:
#1\of ->\setbox \rootbox \hbox {$\m@th \scriptscriptstyle {#1}$}\mathpalette \r
@@t .
<argument> \root

so I just had to redefine \root to the exact same but changing \scriptscriptstyle to \scriptstyle. I tried the following:

\makeatletter
\renewcommand{\root}[1]{\setbox\rootbox\hbox{$\m@th\scriptstyle{#1}$}\mathpalette\r@@t}
\makeatother

but it just throws a ton of illegible errors and breaks the whole document. I don't think I understood correctly the definition of \root, so my code isn't okay. How would you do this?

I'd appreciate your help.

6

I do not recommend hacking these macros but I think you are looking for

\documentclass{article}
\makeatletter
\def\root#1\of{\setbox\rootbox\hbox{$\m@th\scriptstyle{#1}$}\mathpalette\r@@t}
\makeatother
\begin{document}
$\sqrt[3]{4}$
\end{document}

enter image description here

This is because from the definition you post

> \root=macro:
#1\of ->\setbox \rootbox \hbox {$\m@th \scriptscriptstyle {#1}$}\mathpalette \r
@@t .
<argument> \root

an \of is part of the \root definition.

| improve this answer | |
  • Thank you! The -> was confusing me. – Blaz Korecic May 29 at 6:32

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.