答案1
中的度量标准\hvec
取决于字体,而且该方法可能还有其他缺点。例如,水平字距调整并不完全正确,如A
您所见。但话虽如此...
\documentclass{article}
\usepackage{mathtools,trimclip,stackengine,scalerel}
\newsavebox\tmpbox
\newcommand\hvec[1]{\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#1$}
\setbox2=\hbox{$%
\clipbox{0pt{} \dimexpr\ht0+1.68\LMpt{} -.2\LMpt{} 0pt}{%
$\SavedStyle\mathaccent"017E{\phantom{\SavedStyle #1}}$}\kern-.2\LMpt$}
\ensurestackMath{\stackengine{1.3\LMpt}{\SavedStyle#1}{\copy2}{O}{c}{F}{F}{S}}
}}
\begin{document}
$\vec A \vec a ^2 \scriptscriptstyle \vec A \sqrt{\vec a} $
$\hvec A \hvec a ^2\scriptscriptstyle \hvec A \sqrt{\hvec a} $
\end{document}
以下是与样式兼容的变体\vv
。适用类似的免责声明:
\documentclass{article}
\usepackage{mathtools,trimclip,stackengine,scalerel,esvect}
\newsavebox\tmpbox
\newcommand\hvv[1]{\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#1$}
\setbox2=\hbox{$%
\clipbox{0pt{} \dimexpr\ht0+2.05\LMpt{} 0pt -1pt}{%
$\SavedStyle\vv{\phantom{\SavedStyle #1}}$}$}
\ensurestackMath{\stackengine{1.7\LMpt}{\SavedStyle#1}{\copy2}{O}{c}{F}{F}{S}}
}}
\begin{document}
$\vv A \vv a ^2 \scriptscriptstyle \vv A \sqrt{\vv a} $
$\hvv A \hvv a ^2\scriptscriptstyle \hvv A \sqrt{\hvv a} $
\end{document}