3

I'm trying to use \DeclarePairedDelimiter instead of my old roll-your-own commands to the same effect. Well, this:

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\sparen{\left[}{\right]}
\begin{document}
Hello, world.
$\sparen{123}$.
\end{document}

doesn't compile:

! Extra }, or forgotten \right.
\MT_delim_sparen_nostar_wrapper:nnn ...thopen {#1}
                                                  #2\mathclose {#3}
l.6 $\sparen{123}
                 $.
? X

Why?

6
  • 2
    Remove the \left and \right. \sparen* will do the resizing. Commented Jul 25, 2017 at 15:06
  • @PeterGrill: Make that an answer please.
    – einpoklum
    Commented Jul 25, 2017 at 15:11
  • @einpoklum: I have a solution for your previous deleted post (variable sized norm with subscript. Are you interested?
    – Bernard
    Commented Jul 25, 2017 at 17:18
  • @Bernard: Yes, I deleted it because I wanted time to edit that question so I would have some \if condition on the first argument being empty, and then recreate it. But since my \ifs are rusty that'll take me a bit. Anyway, I'll un-delete it.
    – einpoklum
    Commented Jul 25, 2017 at 18:41
  • @einpoklum: I have such a solution, based on xparse
    – Bernard
    Commented Jul 25, 2017 at 18:42

1 Answer 1

2

Remove the \left and \right. \sparen* will do the resizing.

enter image description here

Code:

\documentclass{article}
\usepackage{mathtools}
%\DeclarePairedDelimiter\sparen{\left[}{\right]}
\DeclarePairedDelimiter\sparen{[}{]}
\begin{document}
Hello, world.
$\sparen{12\displaystyle\frac{1}{2}3}$
$\sparen*{12\displaystyle\frac{1}{2}3}$.
\end{document}

You must log in to answer this question.

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