4

I'm trying to achieve something that I assumed was quite simple but it made me waste an insane amount of time so far. I'm using XeLaTeX for a document and I'm setting “Arno Pro” as my font. I'm using the same font also for the math mode and I need a formula with bold digits.

MWE:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathspec}

\usepackage{xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}

\setmathsfont(Digits,Latin,Greek)[
Path = fonts/,Extension = .otf,
UprightFont=ArnoPro-Regular,
BoldFont=ArnoPro-Bold,
ItalicFont=ArnoPro-Italic,
BoldItalicFont=ArnoPro-BoldItalic,
Numbers={Proportional}
]{ArnoPro}

\setmathrm
[Path = fonts/,Extension = .otf,
UprightFont=ArnoPro-Regular,
BoldFont=ArnoPro-Bold,
ItalicFont=ArnoPro-Italic,
BoldItalicFont=ArnoPro-BoldItalic
]{ArnoPro}

\fontspec[Path=fonts/]{ArnoPro.otf}
\SetSymbolFont{Digits:m:n}{bold}{EU1}{\zf@family}{m}{n}

\begin{document}
\noindent
$\boldsymbol{bf\ 0123}$\\
$\mathbf{bf\ 0123}$\\
$normal\ 0123$\\
$\mathit{it\ 0123}$\\
$\mathrm{rm\ 0123}$

\end{document}

Now, this works almost perfectly except that only text and symbols are affected, no digits.

I have tried all sorts of combinations, including some with unicode-math, but to no avail.

What am I doing wrong?

  • I don't know about the LaTeX packages, but given that the Arno Pro is a text font, as opposed to math font, I would guess it does not have glyphs in the "Alphanumeric Mathematical Symbols"-block of the Unicode range which has the bold variants of the digits. – morbusg Aug 27 '14 at 9:42
1

mathspec is basically a collection of hacks; using a real Unicode Math font is better, if your document deals with mathematics.

However, here's a way to get bold digits:

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathspec}

\setmathsfont(Digits,Latin,Greek){FreeSerif}

\setmathrm{FreeSerif}

\setmainfont{FreeSerif}
\makeatletter
\SetSymbolFont{Digits:m:n}{bold}{EU1}{\eu@mathrm}{bx}{n}
\makeatother

\begin{document}

$\mathbf{x}=\bm{0}+\bm{1}$

\end{document}

I've used FreeSerif as I don't have Arno Pro.

enter image description here

A full example using instructions with explicit paths for the fonts:

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathspec}

\setmathsfont(Digits,Latin,Greek)[
  Path=/Library/Fonts/Kerkis-OTF/,
  Extension=.otf,
  UprightFont=Kerkis,
  ItalicFont=Kerkisitalics,
  BoldFont=Kerkisbold,
  BoldItalicFont=Kerkisbolditalic,
]{Kerkis}

\setmathrm[
  Path=/Library/Fonts/Kerkis-OTF/,
  Extension=.otf,
  UprightFont=Kerkis,
  ItalicFont=Kerkisitalics,
  BoldFont=Kerkisbold,
  BoldItalicFont=Kerkisbolditalic,
]{Kerkis}

\setmainfont[
  Path=/Library/Fonts/Kerkis-OTF/,
  Extension=.otf,
  Ligatures=TeX,
  UprightFont=Kerkis,
  ItalicFont=Kerkisitalics,
  BoldFont=Kerkisbold,
  BoldItalicFont=Kerkisbolditalic,
]{Kerkis}

\makeatletter
\SetSymbolFont{Digits:m:n}{bold}{EU1}{\eu@mathrm}{bx}{n}
\makeatother

\begin{document}

Abc\textit{abc}\textit{\textbf{abc}}

$\mathbf{x}=\bm{0}+\bm{1}$

$\mathit{xyz}$

\end{document}

enter image description here

  • Hey, thank you for the answer! It works but apparently only with FreeSerif. As soon as I subsitute in my font it stops working. All I can see is this warning LaTeX Font Warning: Font shape 'EU1/ArnoPro(0)/m/it' undefined (Font) using 'EU1/ArnoPro(0)/m/n' instead on input line 92. LaTeX Font Warning: Font shape 'EU1/ArnoPro(0)/bx/n' undefined (Font) using 'EU1/ArnoPro(0)/m/n' instead on input line 92. – adma Aug 27 '14 at 13:28
  • I've tried to use MinionPro as well, same result, same warnings. – adma Aug 27 '14 at 14:50
  • @adma You have to use \setmainfont instead of \fontspec, with similar options as for \setmathsfont. – egreg Aug 27 '14 at 19:03
  • I did, I took your example and substituted in ArnoPro/MinionPro. That's when I get the warnings about missing shapes. Probably I have to add some other \SetSymbolFont for them but I'm struggling to find anything about this command – adma Aug 28 '14 at 10:27
  • @adma I don't know what to say; I added an example with full font declarations (using a font that's not in TeX Live) with which I get no warning. – egreg Aug 28 '14 at 10:39

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.