I sometimes need to write expressions which include derivatives evaluated at a certain point (for example, a Taylor series). My preferred notation (see addendum) is as in the first equation of the MWE below.
Now, one of my pet peeves is setting font sizes (or any other sizes, for that matter) by hand in LaTeX. I am currently using \bigg|
, but that won't work anymore if the function and/or the variable becomes bigger, and I really don't want to set all the sizes by hand on all my equations (I have quite a few instances of derivatives evaluated at specific points in different chapters of my document, and each chapter is in its own .tex file). I've tried \vrule
, but this resulted in an undesirable vertical positioning of the subscript (see MWE below). Is there a command that produces a vertical bar which scales to the height of whatever it is adjacent to and positions subscripts appropriately?
MWE (some of the packages might be unnecessary; sorry about that):
\documentclass[11pt]{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{esvect}
\usepackage{latexsym}
\usepackage{mathtools}
\newcommand{\der}[2]{\frac{\text{d}{#1}}{\text{d}{#2}}}
\newcommand{\dder}[3]{\frac{\text{d}^{#1}{#2}}{\text{d}{#3}^{#1}}}
\begin{document}
\noindent This looks nice:
\begin{eqnarray}
f(x) & = & \sum_{k=0}^\infty\frac{(x-x_0)^k}{k!}\,\dder{k}{f}{x}\bigg|_{x=x_0}
\end{eqnarray}
But this doesn't:
\begin{eqnarray}
f(x) & = & \sum_{k=0}^\infty\frac{(x-x_0)^k}{k!}\,\dder{k}{f}{x}\vrule_{x=x_0}
\end{eqnarray}
\end{document}
As an addendum, I do appreciate conciseness in a document, but I value clarity as well. I'm reluctant to use f'
to denote df/dx
or \partial f/\partial x
because f may be a function of many variables (as in the case with the \partial
s). I'm also reluctant to use f_x
to denote df/dx
because I often use subscripts to tell apart different contributions to (or components of) a quantity. Therefore, I don't want to write f^{(k)}(x_0)
or other such things. This is non-negotiable; I'd rather not have answers like "change your notation", please. :)
Thanks in advance!
\vrule
is never correct here. if you don't want to set the size by hand, then put\left.
just after the sum component, and\right|
or\right\rvert
between the end of the evaluated expression and the "subscript". that will usually result in something reasonable, although a manual selection can often be more precise.\eqnarray
in favour ofalign
: your spacing around=
is much too large. In addition, the syntax will be simpler.\left. maths go here \right|
works! I can't believe I didn't think of that before; I use\left(
and\right)
all the time. :)=
signs vertically aligned.