I'd like to create a macro of some sort which produces a vertical bar | which scales with the height of the object it's referred to. Using the physics package this works as follows:


However I'd like to use something like:


This is because when I'm writing it comes more natural to write the vertical bar after the derivative. I may use $\bigg|$ or $\Bigg|$ since most of my expressions have similar heights but I'd like to know if there's some way to make this work so that it scales.

  • 1
    I usually just use an explicit \left. f(x) \right\rvert_{x=x_0} for this. You could wrap this in a macro if necessary, too.
    – chsk
    Commented Mar 19, 2021 at 11:50

1 Answer 1


The point of having a macro \eval{...} is (I guess) to ensure the scaling (which I don't like in general). It would be possible to patch \pdv such that it saves the height of the whole construct in a length register which is later used to build the par, but I don't like and I don't use the physics package. Furthermore, automatic scaling is in general very dangerous as you see in the following example

\left.\frac{\partial f}{\partial x}\right|_x
\left.\frac{\partial \tilde{f}}{\partial x}\right|_x

enter image description here

I believe there is no doubt that the second expression looks appalling.

Honestly, I see no big difference in having something which works as


over the more direct


except sparing two keystrokes and making the code IMO less legible (though the latter comment might depend on how my eyes and brain parse LaTeX math). But if your \eval almost always have the same height (say \bigg) then you could define something like this




\frac{\partial f}{\partial x}\eval_x \quad
a\eval[\big]_x \quad
a\eval[]_x \quad
\frac{\partial f}{\partial x}\eval[\Bigg]_x^y


enter image description here

By default \bigg is used; different sizes can be given as optional parameter.

  • This is close enough to what I was looking for, thanks. Commented Mar 19, 2021 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .