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 found from http://jblevins.org/notes/latex that I could use the independence symbol:

X \independent Y


I was wondering how this works. Can anybody explain? I don't know the commands mathpalette, rlap, and mkern2mu.

share|improve this question
up vote 15 down vote accepted
  1. \mathpalette: See The mysteries of \mathpalette.

  2. \rlap: This is referred to as a right overlap. That is, it makes a box of width 0pt, and aligns the contents within to the left, similar to \makebox[0pt][l]{<stuff>}, causing the contents to overlap to the right.

  3. \mkern: Kerning (or spacing) in math mode. The unit of measure is mu (or math units). So, \mkern2mu inserts a kern or space of 2mu horizontally. For a take on these lengths (and others), see What are the possible dimensions / sizes / units LaTeX understands?

Specific to your question about how this works:

enter image description here

$X \independent Y$ \par
$\scriptstyle X \independent Y$ \par
$\scriptscriptstyle X \independent Y$ \par


$X \independent Y_{X \independent Y_{X \independent Y}}$

The use of \mathpalette - defined internally as a specialized \mathchoice - allows the input to do defined in a way that captures the current math style. Note that there are four different math styles: \displaystyle, \textstyle, \scriptstyle and \scriptscriptstyle.

The above MWE shows how the single command \independent scales to regardless of where it's used, all because of a nifty use of \mathpalette and a helper macro \independenT. The helper macro captures the current math style and re-uses it inside an \rlap. The double use of the symbol is just for spacing purposes, adding to the \mkern insertion. That is, it sets the symbol \perp (of width 0pt and right overlap), inserts of 2mu kern (pushing the "cursor" to the right 2mus) and then inserts the symbol again. Since the symbol is set in the same style, the horizontal bar overlaps, but the vertical bar is spaced 2mu apart. As a final take on mathematical spacing, the entire symbol is set as a relation using \mathrel.

share|improve this answer
Great answer. Thanks!! – Memming Oct 28 '12 at 16:43
What's the correct way to negate this (i.e. to add \not)? – Adrian Mar 15 at 14:09
@Adrian: Probably using centernot's \centernot... – Werner Mar 15 at 14:21

Simpler definition:


Just turns \models symbol for 90 degrees. You can also try \vDash. It is smaller than \models

The code:

$X \indep Y$

The result:

enter image description here

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.