I want to define a macro that prints two adjacent sqrt symbols.
(Notation from Cauchy's analysis book).
I get something close but the spacing is changing depending if there is a number before it. If there is not a number in front the sqrt (surd) symbols are too close.
MWE
\documentclass[class=book]{book}
% Run with xelatex
%%% fonts
\usepackage{libertine}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%%% mathfonts
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}
\usepackage{microtype}
% "221A is the surd symbol in unicode. \surd is not working, it shows a p
\usepackage{mathtools}
\NewDocumentCommand\dsqrt{o m}{%
\IfNoValueTF{#1}{%
\,\mathrlap{\char"221A}\,\char"221A#2%
}%
{
\,\mathrlap{\raisebox{3pt}{$\scriptscriptstyle#1$}}\mathrlap{\char"221A}\,\char"221A#2%
}
}
\begin{document}
\begin{equation}\label{pre1}
\dsqrt{a} = \pm\sqrt{a}
\end{equation}
\begin{equation}\label{pre1}
2\dsqrt{a} = \pm2\sqrt{a}
\end{equation}
\begin{equation}\label{pre1}
\dsqrt[n]{a} = \pm\sqrt[n]{a}
\end{equation}
\begin{equation}\label{pre1}
2\dsqrt[n]{a} = \pm2\sqrt[n]{a}
\end{equation}
And here is another: inline $\dsqrt{y} =\pm \sqrt{y}$.
And here is another: inline $2\dsqrt{y} =\pm 2\sqrt{y}$.
And here is another: inline $\dsqrt[n]{y} =\pm \sqrt[n]{y}$.
And here is another: inline $2\dsqrt[n]{y} =\pm 2\sqrt[n]{y}$.
\end{document}
Best Answer
Here's another attempt; unfortunately, it seems that the “surd” symbol is not available in Unicode.