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:
\DeclarePairedDelimiterXPP{\evalat}[2]{}{.}{|}{_{#2}}{#1}
and
\DeclarePairedDelimiterXPP{\evalat}[2]{}{\left.}{\right|}{_{#2}}{#1}
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.
\EvalAt{expression}{point}
cumbersome and unnatural to read. I tend to just haveexpression
\EvalAt[scaler]{point}`