24

sometimes when writing mathematical expression with partial derivatives, one needs to write a vertical bar afterwards and write the value at the which the partial derivatives are being computed as subscripts. See for example the bottom post here:

http://www.physicsforums.com/showthread.php?t=63809

However, the \mid symbol doesn't produce a tall bar that corresponds to the size of the partial derivatives term. Is there a way to have a taller bar?

PS: Some other posts here mention \middle| but this doesn't compile on my computer.

Thanks in advance....

Stefan Kottwitz
  • 231,401
  • related https://tex.stackexchange.com/questions/222222/how-to-get-a-vertical-bar-which-is-the-exact-size-of-the-object – mystery Jan 08 '15 at 06:59

2 Answers2

23

\middle should work in any current system. But it needs accompaigning \left+\right. Like braces in \left/right it will adapt its size to the size of the content:

\documentclass[a4paper,10pt]{article}

\begin{document}
$\left\{a\middle|a\right.$ 
$\left\{\int \middle|\int\right.$
$\int\mid \int$
\end{document}
Ulrike Fischer
  • 327,261
18

Try

\left.\frac{\partial f}{\partial x}\right|_{x_0}

Or if you have \usepackage{amsmath}, you can use \rvert instead of the |. In fact, this is probably the better way to go.

TH.
  • 62,639
  • Thanks it works fine. I was using \rvert earlier also. My problem is that I used a custom partial derivative formulation from: http://www.tug.org/TUGboat/Articles/tb18-1/tb54becc.pdf .This was causing problems with the size of the vertical bar following the partial derivatives. – yCalleecharan Sep 16 '10 at 09:27
  • 1 vote up for the elegant solution. – yCalleecharan Sep 16 '10 at 09:33
  • You can also use \biggr (or one of the other similar macros). As a side note, anyone (including the ISO) who thinks that e should be typeset upright should probably just be ignored (modulo hard publishers' requirements). =) – TH. Sep 16 '10 at 09:38
  • \rvert and | are equivalent in this case because the class is ignored when a mathchar is used as a delimiter. – Philipp Sep 16 '10 at 09:41
  • @Philipp: I meant better from a semantic point of view, but you're absolutely right. I'd probably be lazy and write | (in fact, I guess I was and I did =). – TH. Sep 16 '10 at 09:49
  • @TH. But the \biggr can't be used on its own. It must have a corresponding \biggl to start with. – yCalleecharan Sep 16 '10 at 17:36
  • @yCalleecharan: That is not true. Try it. – TH. Sep 16 '10 at 23:24
  • @TH. Yes you're indeed right. Thanks for pointing this out. I tried another funny example: \biggr ( x \bigl ) and LaTeX compiles it. I always thought that the r or l was denoting the right and left and that u can't have a r before the occurrence of an l. – yCalleecharan Sep 18 '10 at 17:45
  • @yCalleecharan: \biggl is a macro which expands to \mathopen\bigg. \biggr is a macro which expands to \mathclose\bigg. \bigg is a macro which takes one argument and expands to \{\hbox{$\left#1\vbox to14.5pt{}\right.\nulldelimiterspace 0pt\mathsurround 0pt$}}. So basically, \biggr) results in \mathclose{---\left)---\right.---} where the --- is just the rest of the TeX magic to get the spacing right and the height of the parenthesis right. – TH. Sep 19 '10 at 00:15
  • 1
    Note that \left.\frac{\partial f}{\partial x}\right|_{x_0} causes there to be an extra \nulldelimiterspace of blank space to the left of the fraction. (By default, \nulldelimiterspace is 1.2pt.) Depending on what's around this expression, it's either a good idea or not worth the trouble to remove that extra space. – MSC Mar 15 '13 at 19:37
  • see also my question: https://tex.stackexchange.com/questions/222222/how-to-get-a-vertical-bar-which-is-the-exact-size-of-the-object – mystery Jan 08 '15 at 07:00
  • \rvert also seems to need accompanying \left and \right commands to adjust its size as Ulrike Fischer mentioned in the answer below. Otherwise, it just produces a small letter sized bar. – mcy Apr 16 '16 at 11:27