Interaction of mathspec
with font packages is not really predictable. You can fool the package with this trick:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Palatino}
\setmathsfont(Digits){Palatino}
\newcommand{\mathbbm}[1]{\text{\usefont{U}{bbm}{m}{n}#1}} % from mathbbm.sty
\begin{document}
This blackboard bold $\mathbbm{1}$ is double lined.
\end{document}
The similar definition for dsfont
would be
\newcommand{\mathds}[1]{\text{\usefont{U}{dsrom}{m}{n}#1}}
or with dsss
instead of dsrom
if the sans serif version is preferred.
A different approach would be to use unicode-math
and the TG Pagella Math font:
\documentclass{article}
\usepackage{amsmath}
\usepackage{bbm}
\usepackage{unicode-math}
\setmainfont{Palatino}
\setmathfont{TG Pagella Math}
\begin{document}
This blackboard bold $\mathbbm{1}$ is double lined.
\end{document}
Only the four main math families have a fixed family number: number 0 is the "math roman" font, number 1 is "math italic", number 2 is "math symbols" and number 3 is "math extensions". All the other defined alphabets or math symbol fonts get a family number (mathgroup number in LaTeXspeak) at their first use.
The main LaTeX macro that does the business of associating fonts to math families is \check@mathfonts
, that gets called for any math formula. The correspondence is not fixed, because fonts must change according to the current font size.
You can access the fontdimen parameters once a font has been associated to a mathgroup. So
\newlength{\mylen}
\makeatletter
\AtBeginDocument{
\check@mathfonts\setlength{\mylen}{\fontdimen17\textfont2}
}
\makeatother
should do. It's important to do it \AtBeginDocument
since many math font packages do their business at that moment.
The "box" approach is handy if what you want to access to is not one of the main four families; something has to be typeset in order to associate to, say, \mathtt
, a mathgroup number. For instance
\sbox0{$\mathtt{\global\mylen=\fontdimen2\textfont\mathgroup}$}
will access the second fontdimen parameter relative to the font associated to \mathtt
.
Best Answer
Here are all the fonts, I could find on my system. Just play around with those.