I'm trying to make a new command for something like this:


Because I'm using the mathtools package already I tried to do something like this: (And I have to undefine the previous \Re and \Im commands, because they are ugly and this command should be obviously called \Re and \Im.)


This will work, but will also spit put many errors. Like: Missing { inserted. \end{align} and so on.

Then I thought: Yes, this is probably, because the font can not scale (and shouldn't), like the \lbrace and \rbrace. And I tried something like this:


But this will produce:

Missing $ inserted. \newcommand{\Re}{1}{\operatorname{Re}

Missing \begin{document}. \newcommand{\Re}{1}{\operatorname{Re}

Inserting \ensuremath or something like that doesn't help much.

Last try:

\newcommand{\Re}{1}{\operatorname{Re}\left\lbrace #1 \right\rbrace}
\newcommand{\Im}{1}{\operatorname{Im}\left\lbrace #1 \right\rbrace}

Missing $ inserted. \newcommand{\Re}{1}{\operatorname{Re}

Missing \begin{document}. \newcommand{\Re}{1}{\operatorname{Re}

You can't use `macro parameter character #' in math mode. ...nd{\Re}{1}{\operatorname{Re}\left\lbrace #

It can't be this hard to make something like this work, or can it? I really don't know what I should try next, or what am I even doing wrong.

  • why do you want \left and \right with 1+2i? you would get better spacing with (1+2i) than with \left(1+2i\right) Commented Nov 28, 2018 at 22:04

2 Answers 2


You have the incorrect syntax for \newcommand.


should be


You can use the \DeclarePairedDelimiterXPPfrom mathtools. It will define \Reand \Im commands, which have a star version (adds a pair of implicit \left \right in front of the delimiters), but they also accept an optional argument among \big, \Big, \bigg and \Bigg, which adds a pair oof implicit \bigl \bigr, &c.

\usepackage{mathtools} %


   \[ \Re*{\frac{z-1}{z + 1}}\qquad \Im[\Big]{\frac{z-1}{z + 1}} \]%


enter image description here

  • Wouldn't operator name be better for Re and Im, then 2\Re looks right again. Re and Im are math operators after all
    – daleif
    Commented Nov 29, 2018 at 8:32
  • 2
    @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
    – Bernard
    Commented Nov 29, 2018 at 9:10

You must log in to answer this question.

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