5

I am teaching from a precalc text that included the following in regards to nested roots:

enter image description here

I thought this looked pretty nice so I tried to reproduce it, but I ran into a few issues:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent Really ugly: 
\[
\sqrt{2\sqrt{2\sqrt{2\sqrt{2}}}}.
\]
Not quite as ugly but still not ideal:
\[
\sqrt{\smash[b]{2\sqrt{\smash[b]{2\sqrt{\smash[b]{2\sqrt{\smash[b]{2}}}}}}}}.
\]
\end{document}

enter image description here

Is there a way to reproduce the textbook example? In mine, the second example looks much closer to that in the text but still off a good bit. This post inspired my use of smash but I imagine I may not be using it correctly. Any ideas?

6

REVISED ANSWER

Pull out the scalerel magic, and employ parameters \depthgrowth and \heightgrowth that define the growth in the \sqrt depth/height per nesting. The first result is with \depthgrowth at 0pt, \heightgrowth at 1pt. For the second/third examples, \depthgrowth at 1pt, \heightgrowth at 1.5pt

\documentclass{article}
\usepackage{mathtools,scalerel}
\def\depthgrowth{0pt}
\def\heightgrowth{1pt}
\newsavebox\zbox
\newcommand\zsqrt[1]{%
  \ignoremathstyle
  \savebox\zbox{$#1\rule{0pt}{.7\baselineskip}$}%
  \stretchrel*{\sqrt{\phantom{#1}\kern0.5pt}}%
              {\rule[-\dimexpr\dp\zbox+\depthgrowth]{0pt}{%
                \dimexpr\ht\zbox+\dp\zbox+\depthgrowth+\heightgrowth}}%
  \kern-\wd\zbox\textstyle#1%
}
\begin{document}
\[
 \zsqrt{34\zsqrt{23\zsqrt{2\zsqrt{2}}}}
\]
\def\depthgrowth{1pt}
\def\heightgrowth{1.5pt}
\[
 \zsqrt{34\zsqrt{23\zsqrt{2\zsqrt{2}}}}
\]
\[
 \zsqrt{\frac{3}{4}\zsqrt{\frac{2}{3}\zsqrt{2\zsqrt{\frac{1}{2}}}}}
\]
\end{document}

enter image description here

ORIGINAL ANSWER

Bottom line: I just got lucky here. I found that the height of the cross-bar changes drastically for small changes in \vs argument.

\documentclass{article}
\usepackage{amsmath}
\newcommand\vs[1]{\rule{0pt}{#1}}
\begin{document}
\[
\sqrt{\vs{10pt}2\smash{\sqrt{\vs{8.2pt}2\smash{\sqrt{\vs{8.1pt}2\smash{\sqrt{2}}}}}}}
\]
\end{document}

enter image description here

  • This definitely looks nicer. This is very nitpicky, does it not look like the first and last root signs have the same baseline but the middle two are off a fair amount? The textbook example seems to have an entirely constant baseline which seems to be quite difficult to obtain. Maybe I can fool around with the new command you gave and see if changing a few things will help. – Daniel W. Farlow May 24 '17 at 2:17
  • @DanielW.Farlow Good catch. As I said, I was lucky to get this far, but I will keep trying. – Steven B. Segletes May 24 '17 at 2:21
  • @DanielW.Farlow Please see revision. – Steven B. Segletes May 24 '17 at 2:52
  • Wow, awesome work! I'm going to try to really understand your revision, but it looks great. Thanks! – Daniel W. Farlow May 24 '17 at 2:56

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.