# How to typeset "evaluated at" vertical bar with two conditions instead of one?

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:

$\left. \frac{\partial f}{\partial x} \right|_{y=0}$


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:

$\left. \frac{\partial f}{\partial x} \right|_{\mathop{z=1}\limits^{y=0}}$


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?

• 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. Sep 20, 2011 at 10:16
• The \substack command is actually provided by the amsmath package (in its v2.0 at least). Sep 20, 2011 at 10:20

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

\makeatletter
\renewenvironment{subarray}[c]{%
\if#1c\vcenter\else\vbox\fi\bgroup
\Let@ \restore@math@cr \default@tag
\baselineskip\fontdimen10 \scriptfont\tw@
\lineskip\thr@@\fontdimen8 \scriptfont\thr@@
\lineskiplimit\lineskip
\ialign\bgroup\ifx c#2\hfil\fi
$\m@th\scriptstyle##$\hfil\crcr
}{%
\crcr\egroup\egroup
}
\makeatother
\renewcommand{\substack}[c]{\subarray[#1]{c}#2\endsubarray}


Then

$\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".

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.

\begin{align}
\left.
\begin{bmatrix}
0 & 1 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 1 & 0 & 0
\end{bmatrix}
\right|_{\shortstack{\tiny $a=0$ \\ \tiny $b=0$ \\ \tiny $c=0$ \\ \tiny $d=0$}}
\end{align}