2

I need a blackboard bold 1. I know the font bbold provides it along with 0, but if I declare the math alphabet via:

\DeclareSymbolFond{bbold}{U}{bbold}{m}{n}
\DeclareMathAlphabet{\bbold}{bbold}

or the likes, I get a too many math alphabets used error message which I cannot resolve because my very complex package mixes many fonts and produces the error, and the combination I want is the one in force and I don't want to engage in a messy editing of the package which is absolutely huge. I found a workaround here which brought me to:

\documentclass[a4paper]{report}
\usepackage{amsmath,amssymb,amsfonts}

\begin{document}
\[\mathbb{Z}\quad{\fontencoding{U}\fontfamily{bbold}\fontseries{m}\fontshape{n}\selectfont 1\csname U/bbold/m/n\endcsname1}.\]
\fontencoding{U}\fontfamily{bbold}\fontseries{m}\fontshape{n}\selectfont1
\end{document}

This outputs:

enter image description here

I notice the font selection commands work only in text mode. Now I could, of course, switch to text mode every time I need a blackboard bold 1, which is not very often, but I don't like the idea too much. So I was wondering: why do the 1s in math mode stay in their normal font? Why is there no warning of any kind about this font substitution? And how do I make these commands work in math mode, or anyway select that font in math mode (without the commands at the question's top of course)?

5
  • 1
    Are you really sure you need so many math fonts? Anyway, you found out a suggestion a bit succint: \text{\usefont{U}{bbold}{m}{n}1} is better.
    – egreg
    Aug 2, 2015 at 16:23
  • One strange thing about this fonts issue is that I used to have bbold declared, but then I tried changing \mathcal to use dutchcal and it complained, and removing the declaration of bbold allowed me to use dutchcal. Besides that, I have an idea which I just thought of which might save some fonts, but it's pretty long to implement and I'm not sure how out of time I am at the moment because correcting the notes of someone who didn't prepare his lessons can take anything from hours to months :). Or 6 to 8 weeks :).
    – MickG
    Aug 2, 2015 at 16:40
  • And the exam is on Sep 15 and I have a thesis to write which I haven't yet started working on and I should complete the job by November in order to graduate by then…
    – MickG
    Aug 2, 2015 at 16:41
  • Here is the idea I referred to above.
    – MickG
    Aug 6, 2015 at 11:37
  • And here is the end of the story :).
    – MickG
    Aug 12, 2015 at 21:46

1 Answer 1

3

The set up for fonts is split into a configuration for text and a configuration for maths. Settings for one do not affect settings for the other. So, every time you switch to maths mode, you activate a different set of fonts. Of course, if you use \text{} or something, you switch temporarily back to text. But, while in maths mode, you are using the maths fonts. For (pdf)TeX, the 16 font allowance is a hard limit. I don't think there is much you can do. However, you could define a wrapper to switch to text and the blackboard font seamlessly within maths mode.

For example, you could do something like this which does switch to text mode, but doesn't require spelling out the switch each time:

\documentclass[a4paper]{report}
\usepackage{amsmath,amssymb,amsfonts}
\DeclareRobustCommand{\mybbold}{%
        \fontencoding{U}%
        \fontseries{m}%
        \fontshape{n}%
        \fontfamily{bbold}%
        \selectfont}
\DeclareTextFontCommand{\textbb}{\mybbold}
\begin{document}
\[
\mathbb{Z}\quad{\fontencoding{U}\fontfamily{bbold}\fontseries{m}\fontshape{n}\selectfont 1\csname U/bbold/m/n\endcsname1}.
\]
\fontencoding{U}\fontfamily{bbold}\fontseries{m}\fontshape{n}\selectfont Z 1
\[
\textbb{Z 1}
\]
\end{document}

blackboard

2
  • Actually, the MWE was in pdfTeX, but my issue was born in XeTeX. Does that change the allowance? (I guess not.)
    – MickG
    Aug 2, 2015 at 16:44
  • 1
    @MickG I think LuaTeX now supports additional maths alphabets but I'm not certain of this. Just seem to remember reading something about it recently. But I'm pretty sure XeTeX is limited to 16.
    – cfr
    Aug 2, 2015 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.