1

When typing a square root sign sometimes it looks a little bit ugly when the lower part reaches beyond the baseline:

\documentclass{standalone}

\begin{document} The expression ( \sqrt{x} ) is well defined. \end{document}

enter image description here

I guess that the reason is to be consistent with radicands with descenders like y (to obtain the same sqrt sign height). For certain inline situations with only one radicand without ascenders or descenders (like a, n, x, ...) I would like to have a command \smallsqrt, whose lowest part starts at the baseline and whose highest part (the bar) is not changed, i.e. at the same height as the bar of the normal \sqrt sign.

Supplement and possible solution:

To be clear: I don't want to replace the original \sqrt in all cases. Only sometimes in inline mode I would like to have a more compact square root sign.

Here I have a little example what I am dreaming of, implemented with TikZ:

\documentclass{standalone}

\usepackage{tikz} \usetikzlibrary{calc}

% changed from: https://tex.stackexchange.com/a/680575/263991 \NewDocumentCommand{\smallsqrt}{s O{,} m}{% \begin{tikzpicture}[baseline=(A.base)] \node[inner ysep=2pt, inner xsep=0pt] (A) at (0,0) {\ensuremath{#3}\kern1pt}; \coordinate (tail) at ([yshift=-.5mm]A.north east); \coordinate (NO) at (A.north east); \coordinate (NW) at (A.north west); \coordinate (bottom) at ([shift={(-.12,.07)}]A.south west); \coordinate (center) at ([xshift=-1.8mm,yshift=.3mm]A.west); \coordinate (start) at ($(center)+(-.3mm,-.3mm)$); \coordinate (centerF) at ($(center)+(.1mm,.1mm)$); \coordinate (bottomF) at ($(bottom)+(.1mm,.1mm)$); \coordinate (centerM) at ($(center)+(.05mm,.05mm)$); \coordinate (bottomM) at ($(bottom)+(.05mm,.05mm)$); \IfBooleanTF{#1}{ \draw[rounded corners=.1pt] (tail)-- (NO) -- (NW) -- (bottom) --(center) node[inner sep=1pt, above left,xshift=1mm]{$\scriptscriptstyle #2$}; }{ \draw[rounded corners=.1pt] (NO) -- (NW) -- (bottom) --(center) node[inner sep=1pt, above left,xshift=1mm]{$\scriptscriptstyle #2$}; } \draw[line width=0.25pt,rounded corners=.05pt,shorten >=.25pt,line cap=round] (start) -- (centerF) -- (bottomF); \draw[shorten >=.25pt,shorten <=.25pt,line cap=round] (centerM) -- (bottomM); \end{tikzpicture}% }

\begin{document} The expression ( \sqrt{x}+\smallsqrt{a}+\smallsqrt*{a}+\smallsqrt{b}+\smallsqrt{y}+\smallsqrt{\vphantom{b}y}+\smallsqrt[3]{n}) is well defined. \end{document}

enter image description here

I am not really satisfied, but I think it is for certain purposes a good solution.

(The *-version adds the German school tail.)

  • Might be a duplicate of this question. But that was targeted at luatex. In any case, you might find that question interesting. (You are also limited by the available sizes of the radical...) – mickep Apr 05 '23 at 08:28

2 Answers2

1

The issue you've encountered is that TeX has a minimum total height for the square root symbol:

enter image description here

Going from left to right, observe how the lowest and highest parts of the square root symbol are both shifted upward, while the total height remains unchanged, as the argument of \sqrt gains in height.

In order to achieve your formatting objective, then, it's helpful to insert a typographic strut created by, say, \vphantom{k}.

enter image description here

The lowest point of the adjusted square root symbol is not exactly on the baseline, but ever so slightly below it. I trust this discrepancy is acceptable.

Note: Don't use \smallsqrt if its argument contains one or more letters with a descender component (such as g, j, p, q, or y), unless you also encase the letter(s) in questions in a \smash[b]{..} wrapper.

Observe further that, in the preceding screenshot, the outputs of \sqrt{T} and \smallsqrt{T} are identical. This is because if the default Computer Modern math fonts are in use, the heights of the lowercase letter k and the uppercase letter T are the same. If your document employs a non-default math font, the outputs of \sqrt{T} and \smallsqrt{T} need not be the same.

\documentclass{article} % or some other suitable document class
\newcommand{\smallsqrt}[1]{\sqrt{#1\vphantom{k}}}

\begin{document} $\sqrt{.} \quad \sqrt{x} \quad \sqrt{t} \quad \sqrt{k}$

$\sqrt{x} \quad \smallsqrt{x} \quad \smallsqrt{T} \quad \sqrt{T}$ \end{document}

Mico
  • 506,678
  • I knew the \vphantom possibility but I would like to have a smaller height. You wrote that there is a minimum heigt. Can we decrease it? – Andreas Knobloch Apr 05 '23 at 09:19
  • 1
    @AndreasKnobloch No, but if you want \sqrt{a}+\sqrt{b} you want the two radicals to have the same height, don't you? – egreg Apr 05 '23 at 09:21
  • 1
    There is a problem if you try \smallsqrt{y}. – egreg Apr 05 '23 at 09:22
  • @egreg - Thanks. I'll edit my answer to clarify that \smallsqrt shouldn't be used if its argument contains a letter with a descender component. – Mico Apr 05 '23 at 09:37
  • @egreg \sqrt{a}+\sqrt{b} is also not very nice because the radicals are somehow yshiftet. – Andreas Knobloch Apr 05 '23 at 09:37
  • @AndreasKnobloch - But \smallsqrt{a}+\sqrt{b} (or, if you prefer, \smallsqrt{a}+\smallsqrt{b}) does look nice, doesn't it? :-) – Mico Apr 05 '23 at 09:45
1

I tried this but it is not very aesthetic:

\documentclass{standalone}

\usepackage{tikz}

% changed from: https://tex.stackexchange.com/a/680575/263991 \NewDocumentCommand{\smallsqrt}{s O{,} m}{% \begin{tikzpicture}[baseline=(A.base)] \node[inner ysep=2pt, inner xsep=1pt] (A) at (0,0) {\ensuremath{#3}}; \draw([yshift=-.5mm]A.north east)--(A.north east)--(A.north west) --([shift={(-.12,.05)}]A.south west) --([xshift=-2mm]A.west) --++({-.034*width("$\scriptscriptstyle #2$")},0)node[inner ysep=1pt, above, midway]{$\scriptscriptstyle #2$}; \begin{scope} \clip(A.north west)--([shift={(-.12,.05)}]A.south west)--([shift={(-2mm,.2pt)}]A.west)--++(.1,0); \draw[very thick, line cap=round]([shift={(-.12,.05)}]A.south west) --([xshift={-2mm}]A.west); \end{scope} \end{tikzpicture}% }

\begin{document} The expression ( \sqrt{x}\smallsqrt{x}) is well defined. \end{document}

enter image description here

The additional little vertical tail is a convention in German school math.