TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

it seems that \mathbbm{1} doesn't display with double lines when one changes to a different font using mathspec in XeLaTeX. For example, the MWE below uses Palatino, but I couldn't get it to work with any other font (Times New Roman, etc.).

The problem occurs when I try to specify that the math font be applied to numbers: \setmathsfont(Digits){Palatino} in the preamble. The \mathbbm{1} symbol displays correctly if you remove the (Digits), but then numbers in a math environment don't match those in the text.

If this is a font issue, is there a way to change font temporarily in a math environment so that I could call something like \LatinModern{ \mathbbm{1} }?

As a separate but related issue, I don't even know how to include the Latin Modern (or whatever the default LaTeX font is) using XeLaTeX since it's not a font in my library.

Thanks for any help you can provide. MWE below.

Minimal Working Example:

\usepackage{bbm, dsfont}

\setmathsfont(Digits){Palatino} % causes problem


This blackboard bold $\mathbbm{1}$ isn't double lined. 
Doublestroke package doesn't work either, $\mathds{1}$.

share|improve this question
up vote 6 down vote accepted

Interaction of mathspec with font packages is not really predictable. You can fool the package with this trick:



\newcommand{\mathbbm}[1]{\text{\usefont{U}{bbm}{m}{n}#1}} % from mathbbm.sty


This blackboard bold $\mathbbm{1}$ is double lined.


enter image description here

The similar definition for dsfont would be


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:


\setmathfont{TG Pagella Math}


This blackboard bold $\mathbbm{1}$ is double lined.

share|improve this answer
Fantastic, thanks egreg! Can someone say a few words about how this works? What do the arguments of \usefont{U}{bbm}{m}{n}{...} do? – Henry Deith Jan 1 '13 at 4:30
@HenryDeith Since mathspec has to do some magic with the interpretation of numbers in math formulas, I simply tell that \mathbbm is not a math formula and use the character 1 as found in the font used by the bbm package (encoding "U", family "bbm", medium weight "m" and normal shape "n"). – egreg Jan 1 '13 at 10:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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