1

Using the standard LaTeX notation for the square root, I get

enter image description here

I find it ugly that there is this "pike" under the 1-r and think there should be a short horizontal line. It should look like this:

enter image description here

Is there a way to get this done? Thanks in advance.

F. Pantigny
  • 40,250
Florian
  • 113

2 Answers2

4

Not tested in all situations, but at least this is close:

enter image description here

\documentclass{article}

\usepackage{tikz}

\newcommand{\myroot}[2][]{\tikz[line join=round, baseline=(A.text)]{ \nodeinner ysep=2pt, inner xsep=1pt{$\displaystyle{#2}$}; \draw([yshift=-1mm]A.north east)--(A.north east)--(A.north west) --([shift={(-.18,.05)}]A.south west) --([xshift=-2.7mm]A.west) --++({-.034*width("$\scriptscriptstyle #1$")},0)node[inner ysep=1pt, above, midway]{$\scriptscriptstyle #1$}; \begin{scope} \clip(A.north west)--([shift={(-.18,.05)}]A.south west)--([shift={(-2.7mm,.2pt)}]A.west)--++(.1,0); \draw[very thick, line cap=round]([shift={(-.18,.05)}]A.south west) --([xshift={-2.7mm}]A.west); \end{scope} }}

\begin{document}

[ z_k=\sqrt[1-r]{\frac{p_k}{p_k+p_{k+1}}}\cdot x_k ]

[ z_k=\myroot[1-r]{\frac{p_k}{p_k+p_{k+1}}}\cdot x_k ]

\end{document}

Sandy G
  • 42,558
3

Sandy G beat me to it but a version based on https://tex.stackexchange.com/a/194835/1090

enter image description here

\documentclass{article}
\usepackage{tikz}
\newcommand{\mysqrt}[2][]{%
\begin{tikzpicture}[baseline={(a.base)}]
  \sbox0{$\scriptscriptstyle #1$}
  \node[inner sep=1pt] (a) {\hspace*{0.5ex}$#2$\kern-1pt};
  \draw[line cap=round] ([yshift=0.5ex]a.west) -- +(\dimexpr-1pt-\wd0,0pt);
  \draw ([xshift=-.5\wd0, yshift=1ex]a.west) node (b) {\box0};
  \draw[] ([yshift=0.5ex]a.west) -- ([xshift=0.7ex]a.south west);
  \draw[line cap=round] ([xshift=0.7ex]a.south west) -- ([xshift=0.7ex]a.north west) -- (a.north east) -- +(0pt,-1pt);
\end{tikzpicture}%
}

\begin{document} [ \mysqrt{\frac{p-k}{p_k+p_{k+1}}}

\mysqrt[1-r] {\frac{p-k}{p_k+p_{k+1}}} ]

\end{document}

David Carlisle
  • 757,742
  • As I commented already on Sandy G's earlier answer above: Very impressed with what the true LaTeX geeks are capable of doing! I did not really expect that someone would be up to he challenge! – Florian Mar 25 '23 at 11:00