Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\documentclass{article}
\usepackage{bbm, dsfont}
\RequirePackage{mathspec} 

\setmathsfont(Digits){Palatino} % causes problem

\begin{document}

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

\end{document}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

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}

enter image description here

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}
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

 
discard

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.