I'm trying to make a new command for something like this:
\operatorname{Re}\left\lbrace\num{1+2i}\right\rbrace
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
.)
\let\Re\undefined
\let\Im\undefined
\DeclarePairedDelimiter\Re{\operatorname{Re}\lbrace}{\rbrace}
\DeclarePairedDelimiter\Im{\operatorname{Im}\lbrace}{\rbrace}
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:
\let\Re\undefined
\let\Im\undefined
\DeclarePairedDelimiter\braces{\lbrace}{\rbrace}
\newcommand{\Re}{1}{\operatorname{Re}\braces*{#1}}
\newcommand{\Im}{1}{\operatorname{Im}\braces*{#1}}
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:
\let\Re\undefined
\let\Im\undefined
\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.
\left
and\right
with 1+2i? you would get better spacing with(1+2i)
than with\left(1+2i\right)