4

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?

1

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}

enter image description here

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}

enter image description here

...or throw in a little color with

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

enter image description here

6

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}

enter image description here

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.