7

I've seen various topics here adressing how to turn math symbols bold, but none of them gives a suitable option for \mathbb characters, as in \mathbb{ABC}.
I have tested some options to see which commands turn which symbols in bold. Here is my code:

\documentclass{article}
\usepackage{amsmath} % some math-related packages, not sure which of them are necessary
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm} % for \bm
\usepackage{fixmath} % for \mathbold
\begin{document}
\section{Some text $\mathbb{ABC}abc\cosh\div+\alpha$ some text} %1
\section{Some text $\boldsymbol{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %2
\section{Some text $\mathbf{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %3
\section{Some text $\pmb{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %4
\section{Some text $\boldmath{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %5
\section{Some text $\bm{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %6
\section{Some text $\mathbold{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %7
\end{document}

enter image description here

(The absence of \div in numbers 2 and 6 are not typos, neither is the 'ff' in number 3.) Apparently \pmb is the only command which turns \mathbb{ABC} bold. But it makes the characters quite ugly, take a close look: (on the right is the normal version) enter image description here

If no alternative shows up, I think I'll just use \pmb for the \mathbb characters and \boldsymbol or something for the others.

Is there any alternative to turn \mathbb{ABC} bold?

Bart Michels
  • 1,298
  • 2
  • 13
  • 24
  • 2
    "blackboard bold" is the name given to this alphabet because the double strokes are a simulation of bold with chalk on a blackboard, although they have been adopted with specific meanings that no longer have much to do with the "bold" association. what is the reason/meaning for making them even "more bold"? – barbara beeton Sep 03 '14 at 15:21
  • 2
    Note that \boldmath in math mode is wrong. However, in a math oriented document, formulas should not be made bold according to the context, as the weight of characters carries semantics: a boldface variable is not the same as the normal weight one. – egreg Sep 03 '14 at 15:38
  • 1
    Traditional typography denoted number sets simply with upright boldface letters. Just see Bourbaki's treatise… – Bernard Sep 03 '14 at 15:54
  • @barbarabeeton I didn't know they are meant to be bold. Anyway they don't look as bold as other boldface characters.
    egreg: thanks for the tip, your are right about that. But in my case it is only meant to make all the text/maths in a title look the same, so I think it is not wrong to do it.
    Bernard: It's the first time I hear that. (Somehow I always thought the notation was used since Euler's time, probably it's not.) I've grown up with \mathbb{N}, see.
    – Bart Michels Sep 03 '14 at 16:58
  • I saw this in a list of FAQs to refer new users to, and thought it needed an updated answer. – Davislor Oct 03 '19 at 23:23

2 Answers2

5

Here I place three copies in close horizontal proximity by defining \fakebold{}. One can obviously modify it to use more copies, or to apply vertical offset as well. The horizontal offset is given by \bshft, currently set to 0.18pt.

By using the \ThisStyle{...\SavedStyle...} feature of scalerel, it should work across math styles, so that $\fakebold{A_b} A_{\fakebold{b}} A_b$ will give the expected result.

\documentclass{article}
\usepackage{amsmath} % some math-related packages, not sure which of them are necessary
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm} % for \bm
\usepackage{fixmath} % for \mathbold
\usepackage{scalerel}
\newlength\bshft
\bshft=.18pt\relax
\def\fakebold#1{\ThisStyle{\ooalign{$\SavedStyle#1$\cr%
  \kern-\bshft$\SavedStyle#1$\cr%
  \kern\bshft$\SavedStyle#1$}}}
\begin{document}
\section{Some text $\mathbb{ABC}abc\cosh\div+\alpha$ some text} %1
\section{Some text $\boldsymbol{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %2
\section{Some text $\mathbf{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %3
\section{Some text $\pmb{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %4
\section{Some text $\boldmath{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %5
\section{Some text $\bm{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %6
\section{Some text $\mathbold{\mathbb{ABC}abc\cosh\div+\alpha}$ some text} %7
What comes next is new
\section{Some text $\protect\fakebold{\mathbb{ABC}abc\cosh\div+\alpha}$ some text}%8
\LARGE$\fakebold{\mathbb{ABC}a}\mathbb{ABC}a$
\end{document}

enter image description here

and a close-up:

enter image description here

  • 1
    but that's essentially \pmb as used in the question, perhaps with slightly different offsets. – David Carlisle Sep 03 '14 at 15:42
  • @DavidCarlisle I understand that to be the case. But here, I show the user how to control those offsets. Perhaps \pmb also provides those flexibilities, I do not know. – Steven B. Segletes Sep 03 '14 at 15:48
  • 2
    OK:-) pmb isn't designed to be flexible (it's really designed not to b eused:-) – David Carlisle Sep 03 '14 at 15:49
  • Thanks, I knew there would be some way to do it manually. I'll use \fakebold only for the \mathbb things and \bm for the others, because \bm seems to treat \cosh exactly as it treats normal text. – Bart Michels Sep 03 '14 at 17:12
  • Aargh, I'm getting memory errors: TeX capacity exceeded, sorry. The document I'm working in is a bit lengthy indeed. Perhaps can we solve this by defining a new font or something, so LaTeX does not need to compute things and shift those letters every time again? – Bart Michels Sep 03 '14 at 19:19
  • @barto If you don't need math subscripting of the fake-bolded letters, try this simpler definition which does not rely on scalerel solutions: \def\fakebold#1{\ooalign{$#1$\cr\kern-\bshft$#1$\cr\kern\bshft$#1$}} – Steven B. Segletes Sep 03 '14 at 19:22
  • Still getting the error. (But indeed, I won't be using sub/superscripts inside \fakebold because I prefer to set them in \bm.) It is an [input stack size = 5000] error, so that might indicate what's going wrong. Usually I compile with pdfLaTeX, this time I tried LuaLaTeX too but it gives the same error. – Bart Michels Sep 03 '14 at 19:34
  • 1
    @barto Here is a definition that avoids the use of \ooalign and scalerel, if that is the issue: \def\fakebold#1{\setbox0=\hbox{$#1$}#1\kern-\wd0\kern\bshft#1\kern-\wd0\kern\bshft#1} – Steven B. Segletes Sep 03 '14 at 19:46
  • Still getting those errors, but I've been playing around a bit with \protect\fakebold{\mathbb Z} followed by another \protect\fakebold{\mathbb Z} in one section title: this works when nothing or some characters are in between them, but fails when I put \bm{abc} between them. I think I am either overusing \protect, or using it in the wrong way. Perhaps it has something to do with \kern... (I'm reading through this.) – Bart Michels Sep 03 '14 at 20:24
  • @barto That is interesting since \section{$\protect\fakebold{\mathbb Z}\bm{abc}\protect\fakebold{\mathbb Z}$} works for a small test problem, using any of the 3 definitions I provided above. I'm not sure what more I can do at this point. – Steven B. Segletes Sep 03 '14 at 20:29
  • I'll try some more things, if necessary I'll build up my document from scratch and see when the error occurs. (If I'm really running out of memory, I would get to know it this way.) If the problem persists, I'll ask another question. Thanks anyway for your assistance. – Bart Michels Sep 03 '14 at 20:38
  • 1
    Yesss! I found the problem by rebuilding my document: it has something to do with the hyperref-package: it compiles when I don't load it but doesn't when I do. I load the package as \usepackage[hidelinks]{hyperref}, but even without hidelinks it doesn't work. I tried to load the package in the very beginning of the preambule and at the very end, without success. Probably it is the same problem as here: something with the table of contents. – Bart Michels Sep 04 '14 at 11:46
  • 1
    @barto hyperref breaks a lot of things, because it does a lot of redefinition of fundamental items. Congratulations on finding the issue. – Steven B. Segletes Sep 04 '14 at 11:51
  • 2
    Apparently the trick is to use \texorpdfstring{$math$}{some text that doesnt really matter}. (Perhaps it's a good idea to vote up the comments which are relevant for future readers.) – Bart Michels Sep 04 '14 at 12:00
0

There are several packages that do this, but I recommend unicode-math if you can use it, or mathalpha if PDFLaTeX compatibility is a requirement.

The mathalpha package is compatible with PDFLaTeX. It will load the bold version of the double-struck math alphabet you select as \mathbbb, if there is one.

\documentclass{book}
\usepackage[bb=boondox]{mathalpha}

\begin{document}
\( \mathbbb{ABCa}
   \mathbb{ABCa} \)
\end{document}

Boondox font sample

In the modern toolchain, unicode-math will load a bold Unicode math font automatically if the math font you select has one. (As of 2019, XITS Math, Libertinus Math and Minion Math do.) You can select it with \boldsymbol from amsmath, \boldmath or \mathversion{bold}.

\documentclass{book}
\usepackage{amsmath}
\usepackage{unicode-math}

\newcommand\mathbbb[1]{\boldsymbol{\symbb{#1}}}

\setmathfont{XITS Math}

\begin{document}
\( \mathbbb{ABCa}
   \mathbb{ABCa} \)
\end{document}

XITS Math sample

You can also specify a bold math font manually with version=bold, for example:

\setmathfont[version=bold, Scale=MatchUppercase]{Minion Math Semibold}

Finally, unicode-math allows you to declare an arbitrary OpenType or TrueType font as a math alphabet with \DeclareMathAlphabet.

Davislor
  • 44,045