TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I would like to typeset the differential of a multivariate function evaluated at a point where two of the variables take precise value. I typeset the "evaluated at" using a vertical bar, at the bottom of which I indicate the point at which it's evaluated.

When it's evaluated at just "one variable", no problem, I would just do:

   \frac{\partial f}{\partial x}

But how could I evaluate the derivative at y=0, z=1? I could write it in one line but it becomes quite long. So ideally I would like to "stack" them. At the moment, I use:

   \frac{\partial f}{\partial x}

which is very kludgy to say the least. And it doesn't work very nicely: the y=0 is typeset a bit smaller than the z=0.

Any idea on how I could do this properly?

share|improve this question
I found out that I can achieve a somewhat acceptable result using the "mathtools" package, and the \substack command: $\left.\frac{\partial f}{\partial x} \right|_{\tiny\substack{y=0\\ z=1}}$ The \tiny is optional, and actually throws in a warning that it's not valid in math mode, so it's probably not the exact perfect solution. Also the second line is further down than the vertical bar, but that's a start. – Peutch Sep 20 '11 at 10:16
The \substack command is actually provided by the amsmath package (in its v2.0 at least). – Peutch Sep 20 '11 at 10:20
up vote 13 down vote accepted

You can modify the definition of subarray and \substack to accept an optional argument:

  \Let@ \restore@math@cr \default@tag
  \baselineskip\fontdimen10 \scriptfont\tw@
  \advance\baselineskip\fontdimen12 \scriptfont\tw@
  \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
  \ialign\bgroup\ifx c#2\hfil\fi


$\left.\frac{\partial f}{\partial x}\right|_{\substack[b]{y=0\\z=1}}$

will do. The optional argument default is c, that is, the usual placement. It can be also b, to get "bottom alignment".

share|improve this answer
That works perfectly, thanks! – Peutch Sep 20 '11 at 12:09

This code uses the \shortstack command in the subscript. I also use \left. before the matrix and \right| after the matrix to fit the vertical bar.

    0 & 1 & 0 & 0 \\
    0 & 1 & 0 & 0 \\
    0 & 1 & 0 & 0 \\
    0 & 1 & 0 & 0
\right|_{\shortstack{\tiny $a=0$ \\ \tiny $b=0$ \\ \tiny $c=0$ \\ \tiny $d=0$}}
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.