[Tex/LaTex] How does TeX decide how to size a middle delimiter

delimitersmath-operators

How does TeX decide how to size a middle delimiter? When I want to show evaluation of limits of an integral, I would type $$\int_1^2 x\; dx=\frac{x^2}{2}|_1^2=4-\frac{1}{2}=\frac{7}{2}.$$ How do I get the vertical bar showing the limits big enough? I have found \bigg and \Big but I would like it to autosize like \left. It seems harder because there isn't a left side to figure out what is inside. I tried \left space and \right \mid, but didn't find success. On math.stackexchange it was stated I just needed \left. as period is a delimiter. Is there a list of delimiters?

Best Answer

You should use:

\[\int_1^2 x\; dx=\left.\frac{x^2}{2}\right|_1^2=4-\frac{1}{2}=\frac{7}{2}.\]

Latex grabs the height of whatever is in between the \left and \right and then adjust the delimiters (. and | in this case) to be big enough to encompass that.

Since in your example, the limit evaluation only relates to the fraction in front of it, therefore one can use \left and \right without the need of \middle. Since we don't need a left delimited we use . which stands for ''nothing''. Even if we don't want a left delimiter \left has to be there to tell latex where to start measuring the height.

\middle is only needed when three or more delimiters are used, as is the case in this example:

\[A = \left\{ \frac{x_i}{i} \middle| i\in \mathcal{I} \right\} \]

where we would want the collections curly braces to match with the inner line.

Giving a list of delimiters would be hard, since there are so many of them, and a lot of packages introduce new ones. Have a look at The Comprehensive Symbol List to have an idea of what is generally in use. I mostly use ( ) \{ \} [ ] and |.

Some other notes:

  • I tend not to use \Big etc since this doesn't work automatically.
  • You should use \[ and \] to denote a math environment instead of $$, which is old tex code instead of latex.
  • Have a look at this question about integral evaluation.
  • When I say ''delimiters'', I don't mean that this is a class of latex symbols that is special in any way, I just mean symbols that can be scaled.
Related Question