使用 scalerel 和 stackrel 时如何避免线重叠

使用 scalerel 和 stackrel 时如何避免线重叠

我想根据发布的 scalerel 解决方案避免使用重叠星号时线条重叠这里

我的文档看不到它使符号具有更大的高度,因此线条之间的距离不够远,在方程式中也是如此。

我意识到发表评论是合适的,但我的声誉还不够。

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\overstarbf[1]{\ThisStyle{\ensurestackMath{%
  \stackengine{0pt}{\SavedStyle\mathbf{#1}}{\smash{\SavedStyle*}}{O}{c}{F}{T}{S}}}}
\newcommand\overstar[1]{\ThisStyle{\ensurestackMath{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{0pt}{\copy0}{\kern.2\ht0\smash{\SavedStyle*}}{O}{c}{F}{T}{S}}}}
\begin{document}
$\frac{A}{\overstar{M}}$
\end{document}

在此处输入图片描述

答案1

\smash{}从定义中删除:

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\overstarbf[1]{\ThisStyle{\ensurestackMath{%
  \stackengine{0pt}{\SavedStyle\mathbf{#1}}{\smash{\SavedStyle*}}{O}{c}{F}{T}{S}}}}
\newcommand\overstar[1]{\ThisStyle{\ensurestackMath{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{0pt}{\copy0}{\kern.2\ht0\smash{\SavedStyle*}}{O}{c}{F}{T}{S}}}}
\newcommand\overstarnosmash[1]{\ThisStyle{\ensurestackMath{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{0pt}{\copy0}{\kern.2\ht0\SavedStyle*}{O}{c}{F}{T}{S}}}}
\begin{document}
$\frac{A}{\overstar{M}}$

$\frac{A}{\overstarnosmash{M}}$
\end{document}

在此处输入图片描述

相关内容