Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

In LaTeX, it is common to use \left and \right to get parenthesis of the same size. I would like to put something in between them in the same size, like a vertical bar:

\left( \frac{a}{b} | q \right)

In this example, the vertical bar is to small.

Perhaps it is possible to save the size of the height and do something like:

\left( \frac{a}{b} \saveheight \right|\left. \restoreheight q \right)

with some definition of saveheight and restorheight, but this is just guessing from my side. Any ideas?

share|improve this question
Interestingly, not even the people writing Wikipedia seem to know a solution, if you take a look at which is full of ugly examples ;-) – Joey Dec 2 '09 at 6:43
up vote 5 down vote accepted

You can write

\left( \frac{a}{b} \middle| q \right)

This only (of course?) works for delimiters that actually scale.

\middle is defined as part of eTeX, which is standard in all distributions for years now.

share|improve this answer
thanks, I did not know that at all! Perhaps it is to new for my 'not so short introduction to LaTeX' :). – BlackShift Dec 4 '09 at 13:12

The best I could come up with is the following ugliness:

\left( \left. \frac ab \right| a \right)


\left( ab \left | a^2 \right. \right)

The downside is that you need to know which of the two parts is the larger one and appropriately enclose that in a \left-\right pair.

The other option would be to manually specify the size of the brackets:

\bigg( \frac ab \bigg| a \bigg)

Not nice, but probably the easiest to write and the hardest to get wrong. The size may need some fiddling, though (but whoever uses LaTeX is probably used to that).

Another, even more hacky solution would be to use an array:

\left( \begin{array}{c|c} \dfrac ab & a \end{array} \right)

\left( \begin{array}{c|c} ab & a^2 \end{array} \right)

This will work the same regardless of which side is larger, but care has to be taken with fractions (hence the \dfrac which forces display size) and you'll get extra space around the array which looks kinda ugly, imho. You can counter that by including negative space:

\left( \!\! \begin{array}{c|c} \dfrac ab & a \end{array} \!\! \right)

\left( \!\! \begin{array}{c|c} ab & a^2 \end{array} \!\! \right)

Two \! seem to be enough to make it good-looking again.

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.