[Tex/LaTex] Why can’t I use \DeclareMathOperator{\H}{\mathbb H}

macrosmath-modemath-operators

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.

Best Answer

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.

Related Question