封闭式问题

封闭式问题

如何才能使闭平方根符号的尖端变得更好?

在此处输入图片描述 在此处输入图片描述

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{letltxmacro}

\LetLtxMacro{\OldSqrt}{\sqrt}
\newcommand{\ClosedSqrt}[1][\hphantom{3}]{\def\DHLindex{#1}\mathpalette\DHLhksqrt}
\makeatletter
    \newcommand*\bold@name{bold}
    \def\DHLhksqrt#1#2{%
        \setbox0=\hbox{$#1\OldSqrt{#2\,}$}\dimen0=\ht0\relax%
        \advance\dimen0-0.25\ht0\relax% size of the added box is still 0.2 times ht0
        \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
        {\hbox{$#1\expandafter\OldSqrt\expandafter[\DHLindex]{#2\,}$}
        \lower\ifx\math@version\[email protected]\else0.4pt\fi\box2}
    }
    % root index positioning and added space at the end, mostly noticeable in inline math mode
    \renewcommand*{\sqrt}[2][\ ]{\ClosedSqrt[\leftroot{-2}\uproot{1}#1]{#2}\kern0.1em} 
\makeatother

\begin{document}

$\sqrt{2}$

\end{document}

答案1

你想要一个圆形的帽子吗?可以做,但是这个符号真的很丑而且没用。

\documentclass{article}
\usepackage{amsmath}
\usepackage{letltxmacro}
\usepackage{pict2e}

\DeclareFontShape{OMX}{cmex}{b}{n}{<->cmexb10}{}
\SetSymbolFont{largesymbols}{bold}{OMX}{cmex}{b}{n}

\LetLtxMacro{\OldSqrt}{\sqrt}
\newcommand{\ClosedSqrt}[1][\hphantom{3}]{\def\DHLindex{#1}\mathpalette\DHLhksqrt}
\makeatletter
\newcommand*\bold@name{bold}
\def\DHLhksqrt#1#2{%
  \setbox0=\hbox{$#1\OldSqrt{#2\,}$}\dimen0=\ht0\relax%
  \advance\dimen0-0.25\ht0\relax% size of the added box is still 0.2 times ht0
  \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
  \begingroup
  \hbox{$#1\expandafter\OldSqrt\expandafter[\DHLindex]{#2\,}$}%
  \dimen2=\fontdimen8
    \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
    \ifx#1\scriptstyle\scriptfont\else
    \scriptscriptfont\fi\fi\fi 3
  \lower1.5\dimen2\hbox{\closer@{#1}}%
  \endgroup
}
% root index positioning and added space at the end, mostly noticeable in inline math mode
\renewcommand*{\sqrt}[2][\ ]{\ClosedSqrt[\leftroot{-2}\uproot{1}#1]{#2}\kern0.1em}
\newcommand\closer@[1]{%
  \raisebox{\dimen0}{%
    \kern-0.5\dimen2
    \unitlength=\dimexpr\ht0-\dimen0\relax
    \begin{picture}(0,1)
    \linethickness{\dimen2}%
    \roundcap
    \Line(0,0)(0,0.4)
    \buttcap
    \Line(0,0.3)(0,1)
    \end{picture}%
  }%
}
\makeatother

\begin{document}

\[
\sqrt{2}+\sqrt[3]{\frac{1}{2}}-\scriptstyle\sqrt{2}
\]

\boldmath
\[
\sqrt{2}+\sqrt[3]{\frac{1}{2}}-\scriptstyle\sqrt{2}
\]

\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容