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.

2

2 Answers 2

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)]{
  \node[inner ysep=2pt, inner xsep=1pt](A){$\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}
2
  • 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, 2023 at 10:59
  • @Florian: Actually, I think of myself as a LaTeX nerd.
    – Sandy G
    Mar 25, 2023 at 14:22
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}
1
  • 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, 2023 at 11:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .