I know there are multiple questions about bold sans serif math, namely this and this and this. However, all those questions' OP seem to be satisfied with upright math, which I'm not. I tried to play around myself. My goal is to have a math version sansbold
to use in headings (the font lmodern and bold sans headings are prescribed). For completeness, I also tried a sans
mathversion, which I won't need, though.
My following code was obtained by copying and modifying those parts of sansmath.sty
that I understood:
\documentclass{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\DeclareMathVersion{sansbold}
\SetSymbolFont{operators}{sansbold}{OT1}{lmss}{bx}{n}
\SetSymbolFont{letters}{sansbold}{OML}{cmssm}{b}{it} % for cmmi/lmmi
\SetSymbolFont{symbols}{sansbold}{OMS}{cmsssy}{b}{n} % for cmsy/lmsy
%\SetSymbolFont{symbols}{sansbold}{OMS}{lmsy}{b}{n} % actual lmsy
\SetSymbolFont{largesymbols}{sansbold}{OMX}{cmssex}{m}{n} % for cmex/lmex
\SetMathAlphabet\mathsf{sansbold}{OT1}{lmss}{bx}{n}
\SetMathAlphabet\mathbf{sansbold}{OT1}{lmss}{bx}{n}
\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{lmss}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{cmssm}{m}{it} % for cmmi/lmmi
\SetSymbolFont{symbols}{sans}{OMS}{cmsssy}{m}{n} % for cmsy/lmsy
%\SetSymbolFont{symbols}{sans}{OMS}{lmsy}{m}{n} % actual lmsy
\SetSymbolFont{largesymbols}{sans}{OMX}{cmssex}{m}{n} % for cmex/lmex
\SetMathAlphabet\mathrm{sans}{OT1}{lmss}{m}{n}
\SetMathAlphabet\mathrm{sans}{OT1}{lmss}{bx}{n}
\usepackage{amssymb}
\SetMathAlphabet{\mathfrak}{sansbold}{U}{euf}{b}{n}
\SetMathAlphabet{\mathfrak}{sans}{U}{euf}{m}{n}
\newcommand{\test}{\(
\nsubseteq
\mathsf{A} \mathfrak{A} \mathrm{A} \mathcal{A} \mathbf{A} a + b \not \leq \subseteq c \sum \oplus \bigoplus \int_a^b \sin \gamma \Gamma ( \bigl( \Bigl( \biggl(
\)}
\parindent=0pt
\begin{document}
\section{Bla \mathversion{sansbold}\test}
\mathversion{sans}
\test
\mathversion{sansbold}
\test
\mathversion{bold}
\test
\mathversion{normal}
\test
\end{document}
Outcome:
There are some questions I have:
- deleted, makes no sense anymore.
- deleted, makes no sense anymore.
- What's wrong with
\nsubseteq
? IIRC this comes from amsfonts. Since the symbol in\mathversion{bold}
is also not bold, I guess this is because amsfonts provides no bold? - the documentation of sansmath says the package provides fonts
ssmsam
andssmsbm
corresponding to amsfonts. But setting\SetSymbolFont{AMSa}{sans}{U}{ssmsam}{m}{n}
provides wrong symbols. To my surprise, evensansmath.sty
contains the line\DeclareSymbolFont{AMSa}{U}{ssmsa}{m}{n}
, which is, if I'm not mistaken, the amsfonts-font? How to usessmasm/ssmsbm
correctly? - What's wrong with
\sum
,\int
? I guess already lmodern provides no bold for those symbols. Am I correct in assuming that sansmath also does not? Setting\SetSymbolFont{largesymbols}{sansbold}{OMX}{cmssex}{b}{n}
warns me that that font doesn't exist. So I assume yes.
And, most important:
- Am I doing something deeply wrong?
I see that symbols are missing, the largesymbols
are kind of ugly, but all this is much prettier than \boldmath
-serif math in section titles. Anyway, I don't have so much math in titles, obviously, so I can avoid using the missing symbols easily.
Edit. Sorry, my question is already so long. I still want to explicitly state my intend: I have to use lmodern as main font, and bold sans as the font for headings. I want to define a math version sansbold
to fit in these requirements best possible. I thought, using fonts from the sansmath package could be handy. If I accidentally use cm-fonts and didn't notice, that's because cm and lm they are hard to tell apart in math. My idea was to use always use fonts from sansmath if provided (or, of course, lm if it does the job).
I have tried again to update my question so I actually use lm
.
cms…
-fonts I load from sansmath? There is nolmssm
, for instance.