[Tex/LaTex] “Evaluated at” bar for derivatives: \Bigr, \biggr, or \left…\right

best practicesdelimitersmath-mode

I'm trying to determine if there is a best practice for typesetting the "evaluated at" bar for derivatives. The three possibilities I'm thinking of are shown in the code excerpt below:

\begin{gather*}
5 + \frac{df}{dt} \Bigr\rvert_{t = 0} \\
5 + \frac{df}{dt} \biggr\rvert_{t = 0} \\
5 + \left. \frac{df}{dt} \right\rvert_{t = 0} \\
\end{gather*}

enter image description here

The \Bigr option doesn't quite reach the top and bottom of the fraction. The \biggr option overshoots the top and bottom of the fraction by a little bit. And the \left...\right option has the same height as the \biggr option, but it introduces a little extra space between the + and the fraction. I'm having trouble deciding between these options. Is there a best practice for typesetting this?

Best Answer

Since \big is the minimum requested size anyway, it's better to use a simpler approach:

\documentclass{article}
\usepackage{amsmath,mleftright}
\usepackage{xparse}

\NewDocumentCommand{\evalat}{sO{\big}mm}{%
  \IfBooleanTF{#1}
   {\mleft. #3 \mright|_{#4}}
   {#3#2|_{#4}}%
}

\begin{document}

\begin{align}
& \evalat{f(x)}{x=0} \\
& \evalat[\big]{f(x)}{x=0} \\
& \evalat[\Big]{\frac{\partial f}{\partial x}}{x=0} \\
& \evalat[\bigg]{\frac{\partial f}{\partial x}}{x=0} \\
& \evalat*{\frac{\partial f}{\partial x}}{x=0} \\
& \evalat[\bigg]{\frac{\partial^2 f}{\partial x^2}}{x=0} \\
& \evalat*{\frac{\partial^2 f}{\partial x^2}}{x=0} \\
& \evalat[\bigg]{\left(1+\frac{1}{x}\right)^{\!x^2}}{x=1} \\
& \evalat*{\left(1+\frac{1}{x}\right)^{\!x^2}}{x=1}
\end{align}

\end{document}

Note that the last one has a definitely too big bar.

enter image description here