Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
9  
You can use \left. <stuff> \right| to autosize a delimiter to the size of <stuff>, e.g. $$\left.\frac{x^2}{2}\right|_1^2$$ However, this should probably go on the TeX.SE site. –  Zev Chonoles Jun 15 '11 at 3:59
    
@Zev: sounds like it should work. I tried \left (space) <stuff> \right| without success. Thanks. –  Ross Millikan Jun 15 '11 at 4:09
    
Just noticed something. In these parts the vertical bar is to the left of the function. After all, it sort of takes the role of the $\int$ sign. Has there been a change? Is this a geographic thing? Have I lost it? –  Jyrki Lahtonen Jun 16 '11 at 3:55
    
There is a vote for deletion of this thread. I object and vote against deletion (if there's such a concept). First of all, it has come up from time to time and second, I don't see why closure of this thread is not sufficient to indicate that it is considered off-topic. The answers are useful and even if somewhat off-topic I don't understand why it should be removed. –  t.b. Oct 5 '11 at 15:40
add comment

migrated from math.stackexchange.com Oct 7 '11 at 2:05

This question came from our site for people studying math at any level and professionals in related fields.

3 Answers

up vote 8 down vote accepted

Use \left. and \right|

The left/right just has to be matched, but the symbols need not be the same.

\[ \int^{2}_{1} x\;dx = \left. \frac{x^{2}}{2}\right|^{2}_{1} = 4 - \frac{1}{2} = \frac{7}{2} \]
share|improve this answer
    
That's why I tried \left(space) and \right|, but it didn't work. Maybe \left. works as Zev suggests. –  Ross Millikan Jun 15 '11 at 4:03
1  
@Ross Yes, you need the . in order for it to work. –  Jack Henahan Jun 15 '11 at 4:04
    
That's why I tried \left(space) and \right|, but it didn't work. Maybe \left. works as Zev suggests. It seems I want \left. and \right| as the vertical comes after the inside. –  Ross Millikan Jun 15 '11 at 4:13
4  
@Ross: \left must be followed by either a delimiter, or a period that indicates that no delimiter is being used; same with \right. –  Arturo Magidin Jun 15 '11 at 4:17
add comment

I usually either use manual sizing with some space attached (this can be done with, in increasing order of size, \big, \Big, \bigg, and \Bigg. See below, in the order given, next to the fraction:

\[ \frac{x^2}{2}\big|;\qquad \frac{x^2}{2}\Big|;\qquad \frac{x^2}{2}\bigg|;\qquad \frac{x^2}{2}\Bigg|; \]

To get better spacing, you can use \bigr or \bigm (or suitably sized). \bigl is used for left delimiters such as (, \bigr for right delimiters such as ), \bigm for notation occurring "in the middle" such as \vert (which one it is determines the spacing on left and right); this uses \bigr, etc:

\[ \frac{x^2}{2}\bigr|;\qquad \frac{x^2}{2}\Bigr|;\qquad \frac{x^2}{2}\biggr|;\qquad \frac{x^2}{2}\Biggr|; \]

and this uses \bigm, etc:

\[ \frac{x^2}{2}\bigm|;\qquad \frac{x^2}{2}\Bigm|;\qquad \frac{x^2}{2}\biggm|;\qquad \frac{x^2}{2}\Biggm|; \]

(note the difference in spacing).

Alternatively, you can use the auto-sizing of \left and \right. Each one should be followed by a delimiter of some kind, or by a period; a period means that no delimiter is placed; every \left must come with a \right, and vice-versa, but the sizing is very precise; if you want an oversized bar, you either need to add some vertical phantom or strut to make \LaTeX think your expression is "taller" and/or "deeper". Below I use \left.\frac{x^2}{2}\right|, preceded by \Bigr and followed by \Biggr for comparison:

\[ \frac{x^2}{2}\Bigr|;\qquad \left.\frac{x^2}{2}\right|; \qquad \frac{x^2}{2}\Biggr|; \]

For a bigger one, you can add a "tall" vertical phantom with successive exponents or some other construct; e.g.,

\[ \left.\frac{x^2\vphantom{2^{2^{2^2}}}}{2}\right|; \]
share|improve this answer
    
\vphantom is definitely a good trick to know. –  Zev Chonoles Jun 15 '11 at 4:32
    
@Zev: In general, \vphantom creates a width-less box with the height of whatever you type; essentially, it creates the vertical space that would be needed to fit what you are typing but doesn't type it. \hphantom creates a height-less box with the width of whatever it is you type, leaving the blank horizontal space that would be needed to type it but without typing it. –  Arturo Magidin Jun 15 '11 at 4:42
    
@Zev: Mind you, it's probably a very inelegant solution. A more elegant solution would be to construct a box of width $0$ and the desired height and depth using \makebox, but this is a quick and dirty way of getting the job done. –  Arturo Magidin Jun 15 '11 at 17:10
    
@Zev: Phantom's are dirty tricks used by those of us who learned TeX as PlainTex, and wrote the source code to our dissertations using vi-editor. A nice trick to know, but not very reliable, if you port them to a different place, and (like yours truly) don't really know how TeX works. Chiming what Arturo said: a quick hack. –  Jyrki Lahtonen Jun 15 '11 at 19:48
    
@Jyrki: Nice to know I wasn't the only one who wrote their own plain TeX style and macro file for his dissertation on a vi editor! (Though mine was for my undergraduate thesis; there was a ready-made plain TeX one at my graduate institution)... (I also still do my displayed 'formulas by cases' by hand, having learned to do them using The TeXBook). –  Arturo Magidin Jun 15 '11 at 19:52
add comment

I think \bigg\vert works:

\[ \int_1^2 x\ dx=\frac{x^2}{2}\bigg\vert_1^2=4-\frac{1}{2}=\frac{7}{2}.\]
share|improve this answer
add comment

Your Answer

 
discard

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.