0

MWE:

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\abs}{\left|}{\right|}
\DeclarePairedDelimiter{\absl}{\lvert}{\rvert}

\begin{document}
    $\abs{\cdot}$
    
    $\absl{\cdot}$
\end{document}

The output is as expected:

enter image description here

However, I have the following error with regard to the usage of \abs:

Missing { inserted. $\abs{\cdot}
Missing { inserted. $\abs{\cdot}
Missing } inserted. $\abs{\cdot}
Missing } inserted. $\abs{\cdot}$

Why? How to prevent this?

7
  • 1
    It was never stated that you could use \left and \right within DeclarePairedDelimiter, was it? Just use the second definition
    – user202729
    May 15, 2022 at 3:29
  • Does this answer your question? \DeclarePairedDelimiter with \left and \right
    – user202729
    May 15, 2022 at 3:32
  • @user202729 Yes it does answer my question partly. Is there a way I can achieve resizing without going through the rigmarole that egreg uses in their answer, that uses \left|?
    – Atom
    May 15, 2022 at 3:35
  • What do you mean? Just copy paste it in
    – user202729
    May 15, 2022 at 3:38
  • Alternatively use this answer tex.stackexchange.com/a/23182/250119 , might be easier to understand
    – user202729
    May 15, 2022 at 3:38

0

Browse other questions tagged .