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 what f is
  • &c.

The MWE I currently have throws an error:



        = \restrict*{\frac{f}{1}}{X}

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?

1 Answer 1


Don't use \DeclarePairedDelimiter.


  \IfBooleanTF{#1}{% star
  }{% no star
  % the subscript

  \restrict{f}{X} = \restrict*{\frac{f}{1}}{X} = \restrict[\Big]{f}{X}

enter image description here

  • Wouldn’t #3\mathclose#2| or #3\mathclose{#2|} perhaps be better, or at least more correct? Then the spacing would behave the same way as in the auto-scaled case (where you use \mright rather than \right).
    – Gaussler
    May 5 at 8:56
  • I see no discernible difference between the three options #3#2, #3\mathclose#2, and #3\mathclose{#2|}. Does this affect how it displays in different situations (like subscripts)?
    – Phrohlych
    May 5 at 19:37

You must log in to answer this question.

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