\usepackage{letltxmacro}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand{\sqrt}[1][\hphantom{3}]{%
\def\DHLindex{#1}\mathpalette\DHLhksqrt}
\def\DHLhksqrt#1#2{%
\setbox0=\hbox{$#1\oldsqrt[\DHLindex]{#2\,}$}\dimen0=\ht0
\advance\dimen0-0.2\ht0
\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
{\box0\lower0.4pt\box2}}
Don't use that symbol.
Note on \LetLtxMacro
When we say \newcommand{\xyz}[2][ABC]{-#1-#2-}
(just to show an easy example), the actual definition of \xyz
is
\@protected@testopt \xyz \\xyz {ABC}
The first command checks whether we are in normal typesetting or in "special situations" (for instance, when arguments are massaged to write them in auxiliary files). In the latter case it does an easy thing: it eats up everything leaving only \protect\xyz
(which is A Good Thing in these situations).
In the former case it looks at the following character, in order to see if we have specified the optional argument or not. I won't go into the details, but only show the important steps.
The call is \xyz{XYZ}
The result here is \\xyz[ABC]{XYZ}
The call is \xyz[DEF]{XYZ}
The result here is \\xyz[DEF]{XYZ}
In both cases the relevant command is \\xyz
. Yes, with a backslash in its name! It's not possible to express it in a standard way: to call it one has to do \csname\string\xyz\endcsname
, but this is not the point. What's the definition of \\xyz
? Here's what TeX says:
> \\xyz=\long macro:
[#1]#2->-#1-#2-.
The first argument is precisely what's between the square brackets.
Suppose now that we do
\let\oldxyz\xyz
\renewcommand{\xyz}[2][U]{\oldxyz[#1]{#2}}
and that \xyz[T]{XYZ}
appears in "normal typesetting". I'll show the steps on successive lines:
\xyz[T]{XYZ}
\\xyz[T]{XYZ}
\oldxyz[T]{XYZ}
\\xyz[T]{XYZ}
\oldxyz[T]{XYZ}
\\xyz[T]{XYZ}
...
and TeX goes into infinite loop. This is because \\xyz
has been given a meaning by \renewcommand
and it's easy to check that this meaning is
> \\xyz=\long macro:
[#1]#2->\oldxyz [#1]{#2}.
and \oldxyz
meaning is exactly the same as the original \xyz
which will find \\xyz
which has the new definition.
Here's where \LetLtxMacro
comes to the rescue: when we say
\LetLtxMacro{\oldxyz}{\xyz}
we not only say \let\oldxyz\xyz
, but also \let\\oldxyz\\xyz
(with the strange command names that are not directly writable) and change the meaning of \oldxyz
so that it expands to
\@protected@textopt \oldxyz \\oldxyz {ABC}
Moral
Don't use \let\oldxyz\xyz
when \xyz
takes an optional argument, unless you know exactly what you're doing.