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.

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?

share|improve this question
1  
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
add comment

2 Answers

up vote 12 down vote accepted

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

\makeatletter
\renewenvironment{subarray}[2][c]{%
  \if#1c\vcenter\else\vbox\fi\bgroup
  \Let@ \restore@math@cr \default@tag
  \baselineskip\fontdimen10 \scriptfont\tw@
  \advance\baselineskip\fontdimen12 \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}[2][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".

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

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}
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.