# Why is \mid so called?

The LaTeX commands \mid and \vert may be used to make a vertical bar. I can appreciate that \vert is short for vertical, but why \mid? Is it short for middle? and if so, middle of what?

-
have a look at [how-to-make-expanding-middle-delimitors-like-in-the-braket-package/36328#36328]‌​(tex.stackexchange.com/questions/36319/…) –  cmhughes Apr 22 '12 at 18:21
I found this page useful, but my mind was blown by this other one explaining how to get a flexible-sized middle command with the right spacing: tex.stackexchange.com/questions/5502/… –  daveagp Sep 20 '12 at 3:39

I can't claim any special insights into Don Knuth's linguistic preferences. However, it is the case that \mid, by itself (in math mode, of course), produces a vertical bar with a "thick space" on either side. A good use of this symbol is to denote conditioning information on the RHS of the expression. Thus, if X is a random variable, one might denote its expectation conditional on X being greater than 0 as $E(\,X\mid X>0\,)$. Note that this could also be produced, much less elegantly, as $E(\,X\;|\; X>0\,)$ because \; inserts a "thick space".

If you want larger versions of the vertical bar as a relational symbol, while preserving the nice spacing on either side, you can write \bigm|, \Bigm|, \biggm|, and \Biggm|.

There is actually no \middle construct in the orginal TeX engine. This omission is rectified in eTeX ("Extended TeX"), which is the de facto (pre-pdftex) TeX engine for most TeX distributions these days. I.e., something like \middle| will work on most systems that are based on eTeX or one of its descendants. For more on \mid and \middle, you may want to check out the UK TeX FAQ topic Set specifications and Dirac brackets.

-
@egreg -- thanks for this, I'll make the correction. –  Mico Apr 22 '12 at 22:49
Thanks very much, @Mico. –  Peter Phipps Apr 23 '12 at 8:51

Here are two examples out of many where middle vertical bar is needed

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
$X = \left\{x\in\mathbb{R} \middle| \int_0^xf(z)dx<0\right\}$
\end{document}


and for mostly inline math

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
A sentence for $X = \left\{x\in\mathbb{R}\mid x<0\right\}$ some more math.
\end{document}


-
It may be worth mentioning that \mid will insert thickspace (\;) on either side of the vertical bar, whereas \middle| will not. This difference is clearly visible by comparing the two examples you provide. –  Mico Apr 22 '12 at 23:17
@Mico True, but seems like I'm a tad late. Your answer is much better. –  percusse Apr 23 '12 at 1:35
Thanks very much, @percusse. –  Peter Phipps Apr 23 '12 at 8:51