I would like to create a postfix unary operator that normally leaves \medmuskip
between the operand and postfix operator. It's easy enough to do this using, for example,
\newcommand*{\true}{\mskip\medmuskip\mathsf{true}}
so that x$A \true x$x
yields
However, the extra twist is that I would like to use a group to suppress the spacing, just as is possible for binary operators (such as \otimes
). In other words, x$A{\true}x$x
should yield . Bonus points for making
x$\true$x
(note the absence of {}
) yield .
Here is a skeleton to play with:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand*{\true}{\mskip\medmuskip\mathsf{true}}
\begin{document}
\begin{tabular}{ll}
\verb#x$A \true x$x# & x$A \true x$x \\
\verb#x$A{\true}x$x# & x$A{\true}x$x \\
\verb#x$\true$x# & x$\true$x
\end{tabular}
\end{document}
\DeclareMathOperator{\true}{true}
or\DeclareMathOperator{\true}{\medspace true}
.\thinmuskip
, not\medmuskip
\DeclareMathOperator
and writex$A \true x$x
, I get a space after the operator, i.e., it acts as a binary operator. I've edited my question to clarify what I am after.