# Cancel a superscript so that the cancel is not as large

I would like to have a "not asterisk" symbol. I try to do such a feature with the cancel package.

My current favourite is:

A^{\xcancel{\ast}}


But the cancel sign goes down very far. I would like to restrict it to the superscript (but maybe let it go out just a little bit). Any suggestion to achieve that?

Here, I use a \stackinset, with math style preservation from the scalerel package.

\documentclass{article}
\usepackage{stackengine,scalerel,verbatimbox}
\def\Times{\addvbuffer[-1pt]{$\times$}}
\newcommand\strike[1]{%
{\ThisStyle{\stackinset{c}{}{c}{}{$\SavedStyle#1$}{$\SavedStyle\times$}}}}
\begin{document}
$A^\strike{\ast} \quad\strike{\ast} \quad \scriptstyle\strike{\ast} \quad\scriptscriptstyle\strike{\ast}$
\end{document}


And at the cost of a little more complexity, it can be made to scale to its argument:

\documentclass{article}
\usepackage{stackengine,scalerel,verbatimbox}
\def\Times{\addvbuffer[-1pt]{$\times$}}
\newcommand\strike[1]{%
{\ThisStyle{\stackinset{c}{}{c}{}{$\SavedStyle\scalerel*{\Times}{#1}$}{$\SavedStyle#1$}}}}
\begin{document}
$\strike{A}\quad A^\strike{\ast} \quad\strike{\ast} \quad \scriptstyle\strike{\ast} \quad\scriptscriptstyle\strike{\ast}$
$\strike{\int_0^B x\,dx}$
\end{document}


...or throw in a little color with

\newcommand\strike[1]{{\ThisStyle{%
\stackinset{c}{}{c}{}{\color{red}$\SavedStyle\scalerel*{\Times}{#1}$}{$\SavedStyle#1$}}}}


Here is a method using \ooalign.

\documentclass{article}

\newcommand{\strike}[1]{%
\mathchoice
{{\ooalign{$#1$\cr\hidewidth$\times$\hidewidth}}}
{{\ooalign{$#1$\cr\hidewidth$\times$\hidewidth}}}
{{\ooalign{$\scriptstyle#1$\cr\hidewidth$\scriptstyle\times$\hidewidth}}}
{{\ooalign{$\scriptscriptstyle#1$\cr\hidewidth$\scriptscriptstyle\times$\hidewidth}}}%
}

\begin{document}
$A^{\strike{\ast}}\strike{\ast}$
\end{document}


For a nice tutorial on \ooalign, read egreg's answer to this question.

• Isn't the second \cr in every \ooalign superfluous? Aug 12 '15 at 15:03