4

The following macro works correctly for enclosing an expression in parenthesis.

\def\group#1{\left ( #1 \right )}

I want to write the equivalent macro for enclosing an expression in square brackets. I have tried the following macro with and without backslash-escaping the the square brackets, but both give errors.

\def\bgroup#1{\left [ #1 \right ] } 

How can I define a macro with the desired expansion?

merlin2011
  • 3,343

1 Answers1

9

The command \bgroup is used by the LaTeX kernel (and indeed by plain TeX) for low-level operations: as such it is 'reserved'. Thus the problem is not [ and ] in the command but rather the choice of \bgroup as the name for it. If you use \newcommand rather than \def you'll see an informative error message indicating that \bgroup is 'taken'.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036