2

enter image description here

How can I write an asterisk symbol over a letter? Thank you very much

Prakash
  • 169
  • @JouleV: No, it is not \overset{}{}. Thank you very much. – Prakash Apr 12 '19 at 09:52
  • @JouleV: I am sorry. It is not. I am looking similar to \overline{\mathbf M} – Prakash Apr 12 '19 at 09:56
  • Then I literally can't figure out what you are looking for. \overline has nothing to do here, because it draws a line over a (set of) symbol, not add a symbol above another symbol. Please explain things more. –  Apr 12 '19 at 09:58
  • @JouleV: Sorry to confuse you with the \overline. I am looking for a symbol (asterisk) over a Letter. – Prakash Apr 12 '19 at 10:00

2 Answers2

6

It is very simple with the accents package:

\documentclass{article}
\usepackage{amssymb, amsmath}
\usepackage{accents} 

\begin{document}

\[ \accentset{\ast}{\mathbf{M}}^{\mathbf{f}} \]

\end{document} 

enter image description here

Bernard
  • 271,350
4

The version for \mathbf I call \overstarbf, which does not account for italic slant and sets the argument in \mathbf. The other macro \overstar, accounts for the slant (here taken as .2) of the italic-set argument.

\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}
\Shortstack[l]{
$\overstarbf{M}^{\mathrm{f}}$
$\scriptstyle\overstarbf{M}^{\mathrm{f}}$
$\scriptscriptstyle\overstarbf{M}^{\mathrm{f}}$}
vs.\@
\Shortstack[r]{
$\mathbf{M}^{\mathrm{f}}$
$\scriptstyle\mathbf{M}^{\mathrm{f}}$
$\scriptscriptstyle\mathbf{M}^{\mathrm{f}}$}
\quad
\Shortstack[l]{
$\overstar{M}^2\overstar{x}$
$\scriptstyle\overstar{M}^2\overstar{x}$
$\scriptscriptstyle\overstar{M}^2\overstar{x}$}
\end{document}

enter image description here


SUPPLEMENT (script style star overset)

I realize I need to modify my scalerel package to make not only the current math style accessible (which I do via \SavedStyle), but that it would be useful to make the script form relative to the current style accessible, as well.

I do it here as \SavedSubStyle, between the \makeatletter and \makeatother, which also requires small additions to the definition of \ThisStyle. I will eventually get around to incorporating this into the package directly.

\documentclass{article}
\usepackage{stackengine,scalerel}
\makeatletter
\def\SavedSubStyle{\csname @mstyle\s@switch\endcsname}
\renewcommand\ThisStyle[1]{%
\ifmmode%
\def\@mmode{T}\mathchoice%
{\edef\m@switch{D}\edef\s@switch{S}\LMex=1ex\relax\LMpt=1pt\relax#1}%
{\edef\m@switch{T}\edef\s@switch{S}\LMex=1ex\relax\LMpt=1pt\relax#1}%
{\edef\m@switch{S}\edef\s@switch{s}\LMex=\scriptstyleScaleFactor ex\relax%
\LMpt=\scriptstyleScaleFactor pt\relax#1}%
{\edef\m@switch{s}\edef\s@switch{s}\LMex=\scriptscriptstyleScaleFactor ex\relax%
\LMpt=\scriptscriptstyleScaleFactor pt\relax#1}%
\else%
\def\@mmode{F}%
\edef\m@switch{T}\edef\s@switch{S}\LMex=1ex\relax\LMpt=1pt\relax#1%
\fi%
}
%
\makeatother
\newcommand\overstarbf[1]{\ThisStyle{\ensurestackMath{%
  \stackengine{0pt}{\SavedStyle\mathbf{#1}}{\smash{\SavedSubStyle*}}{O}{c}{F}{T}{S}}}}
\newcommand\overstar[1]{\ThisStyle{\ensurestackMath{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{0pt}{\copy0}{\kern.2\ht0\smash{\SavedSubStyle*}}{O}{c}{F}{T}{S}}}}
\begin{document}
\Shortstack[l]{
$\overstarbf{M}^{\mathrm{f}}$
$\scriptstyle\overstarbf{M}^{\mathrm{f}}$
$\scriptscriptstyle\overstarbf{M}^{\mathrm{f}}$}
vs.\@
\Shortstack[r]{
$\mathbf{M}^{\mathrm{f}}$
$\scriptstyle\mathbf{M}^{\mathrm{f}}$
$\scriptscriptstyle\mathbf{M}^{\mathrm{f}}$}
\quad
\Shortstack[l]{
$\overstar{M}^2\overstar{x}$
$\scriptstyle\overstar{M}^2\overstar{x}$
$\scriptscriptstyle\overstar{M}^2\overstar{x}$}
\end{document}

enter image description here