I am using the amssymb
package and from time to time I want to print a proper looking double-struck digit 1 as I could get by using the bbold
package.
However they both are using the \mathbb{}
command, so importing both just results in bbold
overwriting the amssymb
command (it somehow does not matter which package I import first). Since I only need a double-struck 1 and not any other double-struck number and I am using the amssymb
version much more often, I thought of maybe declaring a new operator (e.g. \id
) which uses the bbold
version. I cannot seem to get it to work, however (Of course I also looked for other workarounds or other packages, but that did not turn out successfully either).
The somehow working version for at least defining my \id
Operator looks like this:
\documentclass{article}
\usepackage{bbold}
\DeclareMathOperator{\id}{$\mathbb{1}$}
\begin{document}
\begin{equation}
\id
\end{equation}
\end{document}
The result is:
Additionally, I get the following error massages:
Undefined control sequence. (line 4)
LaTeX Error: Missing \begin{document}. (line 4)
Undefined control sequence. (line 11)
Best Answer
Your code isn't working because (1) you don't load amsmath so
\DeclareMathOperator
is not defined, and (2) where you use\id
you are already inside math mode because of the\begin{equation}
, and so using the dollar signs$
in the operator definition yields an error. That's not what\DeclareMathOperator
is for anyway -- see here.\ensuremath
would have made more sense in your definition.I take it the real problem is that you want to use the font loaded by amssymb for
\mathbb
as applied to letters, but loading the bbold package prevents that?You can use the bbold font in math mode without loading the bbold package by declaring a math alphabet using a different name than
\mathbb
. (Look atbbold.sty
--a slight variation of this is the only important command for math mode in it.)There is a limit to how many math alphabets you're allowed to declare, so if you are at your limit because of other packages, you can modify the instructions given here for grabbing a single certain math mode symbol: