# Space on the right hand side of a unary math operator

I know that \mathop{...} is used to give some space on the both sides of the binary operator. Could anyone tell what to use to give some space only on the right hand side of an unary math operator?

Edit1: for instance, i want to define a function NOT b such that NOT true returns false, and NOT false returns true. How could I space NOT and b under math mode?

• I think \mathbin is used for binary operators. Commented Aug 9, 2011 at 3:18
• Yes, \mathbin is used to identify binary operators in math mode: a\mathbin| b. \mathrel is used to identify relational operators in math mode: a\mathrel\circ b. The spacing is marginally different.
– Werner
Commented Aug 9, 2011 at 4:00
• It seems that \mathbin does look better then \mathop... I have edited my post btw... Commented Aug 9, 2011 at 4:34
• @SoftTimur: I've added an Edit1 part of my own in response to your follow-up explanation of what you're after.
– Mico
Commented Aug 9, 2011 at 9:37

There are a variety of spacing techniques in math mode that you could consider. The following is taken verbatim from Herbert Voss' Mathmode document on horizontal alignment. It showcases the different types of spacing available and compares them very well:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

% Taken from http://ctan.org/pkg/voss-mathmode
\begin{tabular}{ll|ll}
\multicolumn{2}{l|}{Positive Space}&\multicolumn{2}{l}{Negative Space}\\\hline
\verb|$ab$|   & $\boxed{a}\boxed{b}$\\\verb|$a b$|  & $\boxed{a} \boxed{b}$\\\verb|$a\ b$| & $\boxed{a}\ \boxed{b}$\\\verb|$a\mbox{\textvisiblespace}b$| & $\boxed{a}\mbox{\textvisiblespace}\boxed{b}$\\\verb|$a\,b$|\index{,@\textbackslash ,} (\verb|$a\thinspace b$|)\index{thinspace@\textbackslash thinspace} & $\boxed{a}\,\boxed{b}$&
\verb|$a\! b$|\index{negthinspace@\textbackslash negthinspace} & $\boxed{a}\!\boxed{b}$\\\verb|$a\: b$|\index{:@\textbackslash :} (\verb|$a\medspace b$|)\index{medspace@\textbackslash medspace}&
$\boxed{a}\:\boxed{b}$&
\verb|$a\negmedspace b$|\index{negmedspace@\textbackslash negmedspace} & $\boxed{a}\negmedspace\boxed{b}$\\\verb|$a\; b$|\index{;@\textbackslash ;} (\verb|$a\thickspace b$|\index{thickspace@\textbackslash thickspace}&
$\boxed{a}\;\boxed{b}$&
\verb|$a\negthickspace b$|\index{negthickspace@\textbackslash negthickspace}&
$\boxed{a}\negthickspace\boxed{b}$\\\verb|$a\quad b$|\index{quad@\textbackslash quad} & $\boxed{a}\quad\boxed{b}$\\\verb|$a\qquad b$|\index{qquad@\textbackslash qquad} & $\boxed{a}\qquad\boxed{b}$\\\verb|$a\hspace{0.5cm}b$|\index{hspace@\textbackslash hspace}& $\boxed{a}\hspace{0.5cm}\boxed{b}$&
\verb|$a\hspace{-0.5cm}b$| & $\boxed{a}\hspace{-0.5cm}\boxed{b}$\\\verb|$a\kern0.5cm b$|\index{kern@\textbackslash kern} & $\boxed{a}\kern0.5cm \boxed{b}$ & \verb|$a\kern-0.5cm b$| & $\boxed{a}\kern-0.5cm \boxed{b}$\\ \verb|$a\hphantom{xx}b$|\index{hphantom@\textbackslash hphantom} & $\boxed{a}\hphantom{xx}\boxed{b}$\\\verb|$axxb$| & $\boxed{a}xx\boxed{b}$
\end{tabular}
\end{document}


Consequently, here's an example that defines the command \NOT{<bool>} that places \sim (the negation operator), followed by a \, (\thinspace), followed by <bool>:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newcommand{\NOT}[1]{\ensuremath{{\sim}\,#1}}% NOT{<bool>}
$\NOT{a}$

$\NOT{\texttt{true}}=\texttt{false}$
\end{document}


For more on mathematical typesetting, actually, much more, consider reading the entire document. Specifically for spacing in math mode, read Section 11.1 Math typesetting.

• This is an excellent answer. Thanks for the full explanation. Commented Aug 9, 2011 at 10:13

You don't specify just how much extra space you'd like to see between the operator and its associated variable/constant, so I'll assume that it's the amount of space that would be inserted if it were a binary rather than a unary operator. In the code below, the "fake binary" operator is obtained by inserting an empty group, {}, in front of the otherwise unary operator.

\documentclass{article}
\begin{document}
unary: $+1$, $-x$

fake binary: ${}+1$, ${}-x$
\end{document}


Edit1: OK, based on the Edit1 of the question, I now believe that what the OP is after is a method for creating a "math operator" called, say, "\NOT", which inserts a bit of space between the operator's text and its argument. To get such an operator, I suggest you load the amsmath package and issue the instruction

\DeclareMathOperator{\NOT}{\mathtt{NOT}}


in the preamble.

An MWE, which assumes that the words "true" and "false" should be rendered in small-caps.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\NOT}{\mathtt{NOT}}

\begin{document}
$\NOT b, \quad \NOT\textsc{true}=\textsc{false}$
\end{document}


If you are using the amsmath package (\usepackage{amsmath} for TeX Live) then page 15 of the User's Guide indicates that extra spacing (from least to most) is \thinspace, \medspace, \thickspace, \quad, \qquad. Negative spacing is also covered as is using symbols (such as \,) to generate equivalent amounts of space. So the answer to your question depends on how much space you'd like.