# What is the right way to typeset these limits?

In a recent answer I typeset the following expression:

$$\cos x\left.\right|_{-\pi/4}^0$$

(I used \cos x\left.\right|_{-\pi/4}^0)

I thought it looked funny on the page, but I wasn't sure it would look funny to anyone else, and I couldn't articulate to myself what about it looked bad. I think it has something to do with the way the lower limit sticks out. But I'm sure that using \frac\pi4 there instead would be much worse.

Clarification: I don't think MathJax is the culprit here; I think it did just what I asked for. My question is whether I asked for the right thing, in the same sense that $\cos x\left.\right|_{-\pi/4}^0$ is closer to the right thing than $\cos x\left.\right|_{-\frac\pi4}^0$ is.

• Can you provide a link please? – Asaf Karagila Nov 26 '13 at 20:48
• Yes, but it occurs to me that I may not have made my question clear. I am not suggesting that MathJax messed up here; I'm asking how I should tell MathJax to typeset this kind of expression. – MJD Nov 26 '13 at 20:50
• This doesn't address the main question (placement of limits) but it might be better to use \left[ and \right] for these expressions, in terms of both typesetting and clarity. Using a \right something without a \left of the same thing is abusive, in my opinion. – Trevor Wilson Nov 27 '13 at 3:54
• The folks at tex.stackexchange.com may have some useful opinions on this. In my experience they have a good eye for aesthetics as well as technical correctness. – user856 Nov 28 '13 at 17:02

In extreme cases like this, I think it is okay to be a bit hackish. You could make the bar taller and space the $0$ out a bit further: $$\cos(x)\Big|_{-\pi/4}^{\ \ \ \ 0}$$ using \cos(x)\Big|_{-\pi/4}^{\ \ \ \ 0}.

A bit less hackish is $$\cos(x)\Big|_{-\pi/4}^{\hphantom{-}0}$$ using \cos(x)\Big|_{-\pi/4}^{\hphantom{-}0}.

• That huge space before the $0$ looks very strange to me. – dfeuer Nov 28 '13 at 6:45
• @dfeuer: you can adjust the number of spaces to fit your taste. I had thought the OP did not like the look with no added space. – robjohn Nov 28 '13 at 8:44

Does this look better?

$$\cos x\Big|^{\kern{.4em}0}_{\raise{-1ex}{\kern{-.3em}-\pi/4}}$$

• No, in my opinion it's much worse. – MJD Nov 26 '13 at 21:08
• Why?$\vphantom{filler}$ – Asaf Karagila Nov 26 '13 at 21:16
• The $\frac\pi4$ is too small and hangs down too low. – MJD Nov 26 '13 at 21:40
• Fine, then. What about now? – Asaf Karagila Nov 26 '13 at 21:50
• I'm not sure; I've been looking at these too long. What do you think? – MJD Nov 26 '13 at 21:51
• I don't know. I've got the same problem. – Asaf Karagila Nov 26 '13 at 21:58

Your original code abuses left and right rather horribly. The logically correct way to use them would be $$\left.\cos x\right|_{-\pi/4}^0,$$ \left.\cos x\right|_{-\pi/4}^0, which gives the same bad result you started with but at least makes sense. Since you don't like it, let's try a very slight modification: $$\cos x\hskip 0.03em\bigr|_{-\pi/4}^0,$$ \cos x\hskip 0.03em\bigr|_{-\pi/4}^0. How do you like that version?

• That wasn't intentional abuse; it was just a mistake. Had someone asked me, I would have said that the \left. was before the cosine, not after it. I'll look at the rest of your reply tomorrow. – MJD Nov 28 '13 at 2:06
• @MJD, everyone makes mistakes. The reason I think it may make sense to add a bit of space before the bar (less than \,, but perhaps a tiny drop more than I put) is that without it, the bar seems to bind to the $x$ rather than to the whole expression. – dfeuer Nov 28 '13 at 2:37

I had to check what you meant. In these parts we use a totally different notation. May be limited to a small geographic area?

$$\mathop{\Big/}\nolimits_{\hspace{-2mm}-\pi/4}^{\hspace{1mm}0}\cos x$$

Needs a bit of hacking for the spacing look good. That slash should have the same slope as the integral sign. At least that's how it was typeset in my old (=pre-TeX) high school books: $$\int_{-\pi/4}^0(-\sin x)\,dx=\mathop{\Big/}\nolimits_{\hspace{-2mm}-\pi/4}^{\hspace{1mm}0}\cos x$$ so both the slope and height of that slash are a bit wrong here IMHO.

Somehow I thought that (what I learned last night while searching the net) that it is just author's choice of notation, but your way of having that vertical line after the function seems to be nearly universal?? Wonder how I avoided learning about this while in grad school. I guess I never had to calculate a definite integral on the chalk board :-).

Sorry about veering off-topic. This just puzzles me.

• This managed to collect an undelete vote, so I let it be visible to all. I asked colleagues who are currently writing a calculus textbook, and they confided to me to using hacks liks the above. Also you need to define separate macros for display and in-line modes. – Jyrki Lahtonen Nov 28 '13 at 5:19