1

I would like to avoid lines overlapping when using an overset asterisk according to the solution for scalerel posted here

My document cannot see that it makes the symbols have a larger height, and so the lines are not spaced sufficiently far appart, also in equations.

I realize that a comment would be appropriate, but my reputation is not sufficient.

\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}

enter image description here

Axl
  • 13
  • It would be helpful if you add a small complete document to your question here that shows the issue. While that code would be partly copied from the other question it still helps to make this question more stand-alone and easier to reproduce. Also I have added a comment to the original answer to notify the answerer that you have posted this follow-up question. – Marijn May 16 '23 at 10:19
  • Thanks! I have updated my question. – Axl May 16 '23 at 10:42

1 Answers1

1

Remove the \smash{} from the definition:

\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}

enter image description here

Marijn
  • 37,699