TransWikia.com

How to use long radicals to write nested roots?

TeX - LaTeX Asked on January 11, 2021

Well, I understand that expressing something like this is much easier to achieve using exponents that are equally valid and mathematically correct. But while it’s the most obvious solution, I’m intrigued to know if there’s a way to typeset in LaTeX something like what’s shown in the following picture:

Weird nested roots.

My MNWE for solving the left side of the equality is the following:

documentclass{article}
usepackage{amsmath}
begin{document}
begin{math}
sqrt[-4]{sqrt[sqrt[-4]{left(dfrac{1}{4}right)^{sqrt[-4]{dfrac{1}{4}}}}]{dfrac{1}{4}} = 
end{math}
end{document}

and in fact, it doesn’t compile because apparently I can’t insert as an option all the code I have in there. A secondary problem is how to lengthen the initial trace of the root sign as in the image or if it already exists in LaTeX, I honestly ignore it and that’s why I ask.

Regards

One Answer

When you have nested optional arguments you need to enclose the inner argument in braces otherwise LaTeX becomes confused. That is, rather than writing

sqrt[sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}]{frac14}

you need to write

sqrt[{sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}}]{frac14}

I think that you are over using dfrac and left....right. If you use

[
  sqrt[-4]{sqrt[{sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}}]{frac14}}
  =sqrt[-4]{sqrt[{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}]{4^{-1}}}
]

then LaTeX will give you:

enter image description here

As Ulrike says in the comments, this fixes the compilation errors but the square root symbol does not underline the large "square root index". As a first attempt to fix this we could use underline, together with mathtools to improve the spacing. To this end define

newcommandSqrt[2][]{sqrt[underline{#1}hspace*{1mm}]{cramped{#2}}}

to give a new a square-root like command that underlines the root. Using this,

[
  sqrt[-4]{Sqrt[Sqrt{(frac14)^{sqrt[-4]{frac14}}}]{frac14}}
  =sqrt[-4]{Sqrt[{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}]{4^{-1}}}
]

now produces:

enter image description here

The root index is now underlined but the line is a little too thin! The only way around this that I can see is to use settowidth from the calc package to calculate the width of the root and then draw a slightly thicker underline by hand using rlap. The new underline requires a little bit of fine-tuning, so let's define a third variant of sqrt that has an optional argument for the depth of the underline:

newcommandSQRT[3][-0.75mm]{%
  settowidthsqrtlength{$scriptsize#2$}%
  sqrt[rlap{rule[#1]sqrtlength{0.6pt}}{#2}hspace*{1mm}]{cramped{#3}}%
}

With this in place, the code

[
  sqrt[-4]{SQRT[-1.2mm]{sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}}{frac14}}
  =sqrt[-4]{SQRT{{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}}{4^{-1}}}
]

produces:

enter image description here

This is reasonable, although I am sure that there are better ways to do this.

Here is the full code:

documentclass{article}
usepackage{amsmath}
usepackage{mathtools,calc}
newlengthsqrtlength

begin{document}

  [
    sqrt[-4]{sqrt[{sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}}]{frac14}}
    =sqrt[-4]{sqrt[{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}]{4^{-1}}}
  ]

  newcommandSqrt[2][]{sqrt[underline{#1}hspace*{1mm}]{cramped{#2}}}

  [
    sqrt[-4]{Sqrt[Sqrt{(frac14)^{sqrt[-4]{frac14}}}]{frac14}}
    =sqrt[-4]{Sqrt[{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}]{4^{-1}}}
  ]

  newcommandSQRT[3][-0.75mm]{%
    settowidthsqrtlength{$scriptsize#2$}%
    sqrt[rlap{rule[#1]sqrtlength{0.6pt}}{#2}hspace*{1mm}]{cramped{#3}}%
  }

  [
    sqrt[-4]{SQRT[-1.2mm]{sqrt[-4]{(frac14)^{sqrt[-4]{frac14}}}}{frac14}}
    =sqrt[-4]{SQRT{{sqrt[-4]{4^{-1}}^{sqrt[-4]{4^{-1}}}}}{4^{-1}}}
  ]

end{document}

Correct answer by user30471 on January 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP