I am using the \DeclarePairedDelimiterXPP command from the mathtools package to declare some new delimiters, for which scaling can be turned on and off easily. Specifically, I want to declare the command \evalat, which indicates the evaluation of an expression at a given point: e.g. $\left.\frac{x}{2}\right|_{x=1}$.

As I said before, I want it to have the scaling options as provided by the \DeclarePairedDelimiter-type commands. This means that \evalat{\frac{x}{2}}{x=1} gives a non-scaled vertical line on the right, \evalat*{\frac{x}{2}}{x=1} gives a scaled vertical line on the right and \evalat[\size]{\frac{x}{2}}{x=1} gives a vertical bar with size \size.

I tried the following definitions:




The first one works correctly in the starred (automatic scaling) version. Its non-starred version however results in $.\frac{x}{2}|_{x=1}$, with the dot still shown on the left side. The second version always scales the delimiters, both in the starred and the non-starred version.

I understand why the commands behave as they do, but I do not know how to get the behaviour that I want?

PS. This answer to another question could be a fall-back solution, but I would rather have the _{x=1} as an argument to the command.

  • As is the declarepaired cannot handle "empty" fences. I tend to make the Eval at macro completely manual as I find the \EvalAt{expression}{point} cumbersome and unnatural to read. I tend to just have expression \EvalAt[scaler]{point}`
    – daleif
    Commented Jul 1, 2019 at 16:32

1 Answer 1


It's simpler to define the command directly:






enter image description here

You must log in to answer this question.

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