Why can't I use \DeclareMathOperator{\H}{\mathbb H}?

1,537

The error message is fairly precise in this case:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\H}{\mathbb H}
\begin{document}
$\H a$
\end{document}

Compiling the document gives:

! LaTeX Error: Command \H already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.3 \DeclareMathOperator{\H}{\mathbb H}

which is telling you that \H is already defined.

There are also other single letter commands (e.g., \A). In general, it is better to avoid defining your own single letter commands. Instead use \RR, \HH, etc.

Also, as @Sigur pointed out, it does not make sense to define \mathbb{R} or \mathbb{H} as a math operator. It is better to use

\newcommand\RR{\mathbb R}
\newcommand\HH{\mathbb H}

etc.

Share:
1,537
user46372819
Author by

user46372819

Updated on August 01, 2022

Comments

  • user46372819
    user46372819 over 1 year

    Is there a reason why I cant use \DeclareMathOperator{\H}{\mathbb H}?

    \H is not defined normally, so why can I define this?

    \DeclareMathOperator{\R}{\mathbb R} and others similar work just fine.

    • Sigur
      Sigur almost 6 years
      mathbb needs amsfonts. Also, it is strange to define \mathbb{R} as a math operator. Maybe you want simply a \newcommand{\R}{\mathbb{R}}.
    • Sigur
      Sigur almost 6 years
      \H: macro:#1->{\accent "7D #1} is defined.