TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I think \mathbin is used for binary operators. – Caramdir Aug 9 '11 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 Aug 9 '11 at 4:00
It seems that \mathbin does look better then \mathop... I have edited my post btw... – SoftTimur Aug 9 '11 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 Aug 9 '11 at 9:37
up vote 20 down vote accepted

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:


% Taken from http://ctan.org/pkg/voss-mathmode
\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}&
\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}&
\verb|$a\negthickspace b$|\index{negthickspace@\textbackslash negthickspace}&
\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}$

Additional horizontal alignment

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

\newcommand{\NOT}[1]{\ensuremath{{\sim}\,#1}}% NOT{<bool>}


Defining a command \NOT with spacing

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.

share|improve this answer
This is an excellent answer. Thanks for the full explanation. – Seamus Aug 9 '11 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.

unary: $+1$, $-x$

fake binary: ${}+1$, ${}-x$

Edit1: OK, based on the Edit1 of the question, I think what the writer is after is a method for creating a "math operator," such as "\NOT", which inserts a bit of space between the operator's text and its argument. To get such an operator, insert the following text in the preamble of your document:


The control sequence \: inserts a "medium space" between the NOT and the following material. Standard TeX/LaTeX methodology is to insert a "thin space" (\,) between the operator and its argument (as in \cos\theta and \det A), but in the case of an operator made up of all-uppercase letters a "thin space" does not provide quite enough separation.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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