2

As an example of what I do not want, take

$\mathrm{C} \operatorname{F} 4$

produces different spacing between the star and the operands than

$a \ast 4$

How do I mitigate this?

I can't use definitions outside of the math mode environment.

In this specific case, I want to use \ast \ast as an infix symbol.

2 Answers2

9

If you want to emulate the “double asterisk” ** used for exponentiation, then

\mathbin{{*}{*}}

is what you need.

The asterisk * by itself produces a Bin atom, without needing \mathbin around it. However two Bin atoms in a row don't make a single Bin atom, because a Bin requires operands around it. Thus the second * would be made into an ordinary symbol.

However, you can make any subformula into a Bin atom by typing it as the argument to \mathbin. By rule, no spacing would be used between the two asterisks with \mathbin{**} (the first would be turned into a unary symbol, just like in -1, and the second into an ordinary, because of the rule above). However, it's better to be more careful and type

\mathbin{{*}{*}}

(the braces hide the nature of * turning it into an ordinary), because the output of

\mathbin{***}

might surprise you. To the contrary, \mathbin{{*}{*}{*}} would not have the problem.

egreg
  • 1,121,712
7

Something like this?

\documentclass{article}
\newcommand{\astast}{\mathbin{{\ast}{\ast}}}
\begin{document}
$A \astast B$
\end{document}

enter image description here

Explanation: \ast is a binary operator, with the spacing that comes with it. Enclosing it in braces {\ast} turns it into an ordinary math atom, so two of these next to each other have no intervening space. Then \mathbin turns the whole construct into a binary operator.