# Math mode accents and spacing

I'm using accents to produce a variant of the \in operator but when I place an accent on it, as in \tilde{\in}, I get spacing that is different from \in, see the example and the image below. My question is: what is the best way to make it so that \tilde{\in} get the same spacing as \in?

In the example below I also provide two failed attempts of getting the right spacing. I'm not especially accustomed to math mode and definitions of operators. Maybe the right way to go with \DeclareMathOperator?

\documentclass{article}

\begin{document}

The spacing I want:
$w_{1} \in w_{2}$

The spacing I get with an accent:
$w_{1} \tilde{\in} w_{2}$

Better spacing but an ugly hack:
$w_{1}~\tilde{\in}~w_{2}$

The wrong spacing (too tight?):
$w_{1} \mathop{\tilde{\in}} w_{2}$

\end{document}


An accented symbol is treated by TeX as an ordinary one; you have to tell it that you want a relation symbol:

$$w_{1} \mathrel{\tilde{\in}} w_{2}$$


The commands for declaring a math symbol are

• \mathord (ordinary)
• \mathbin (binary operation)
• \mathrel (binary relation)
• \mathop (operator, use with care)

An ordinary symbol is typeset without any spacing around it. A binary operation is something like +; for example, if one wanted to define a "mod" operation, a correct way would be

\newcommand{\bmod}{\mathbin{\textrm{mod}}}


(amsmath does it in a quite different way, but that's not the point). A binary relation is like <; the spacing around binary relation symbols is larger than around operation symbols. Moreover the space around relation symbols is uncompressible, while it is for operations.

As already said, putting an accent over a symbol makes it lose its predefined nature: the accented cluster is considered as an ordinary symbol; therefore we have to state explicitly its nature.

• Please forgive my ignorance of mathematical terms. I'm trying to understand the semantics of these commands. Am I correct if I understand "binary operation" as any operation manipulating two terms, such as 1+2, and if I understand "binary relation" as any two term relation, such as the logical connectives conjunction and disjunction? Where are these commands documented? – N.N. Jun 22 '11 at 12:30
• @N.N.: Yes. You can read TeXbook, Chapter 17: More about Math, or TeX by Topic, Chapter 23: Mathematics Typesetting. – Leo Liu Jun 22 '11 at 12:39