I want to define a restriction operator \restrict{f}{X}
which is capable of resizing in the style of mathtools
's \DeclarePairedDelimiter
options. For example:
\restrict*{f}{X}
should resize automatically\restrict[\Big]{f}{X}
should provide a large vertical bar regardless of whatf
is- &c.
The MWE I currently have throws an error:
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiterXPP{\restrict}[2]{}{}\rvert
{\IfNoValueTF{#2}{}{_{#2}}}
{#1}
\begin{document}
\begin{equation}
\restrict{f}{X}
= \restrict*{\frac{f}{1}}{X}
\end{equation}
\end{document}
When running this, I get an appropriate output, but the error:
Missing delimiter (. inserted).
This makes sense, since the left delimiter I provided was the empty token {}
. However, if I replace it with {.}
, then for the nonstarred \restrict
, a period is introduced in the typesetting which I do not wish for.
Is there a way to communicate to \DeclarePairedDelimiter
that I want an empty delimiter, or must I go the route of error-surpressing?