4

I'm using Linux Libertine everywhere in my document. However, I cannot figure out how to get bold math \mathbf to display as bold text. This answer seemed related to this problem, but trying that (replacing Minion Pro with Linux Libertine O) in my case gives me the following error (for every X:Y:Z):

Symbol font `Latin:m:n' not defined.

How can I get bold math symbols in my document?

MWE:

\documentclass{minimal}
\usepackage{amsthm}
\usepackage[libertine]{newtxmath}
\usepackage{mathspec, libertine, lipsum}
\setmathsfont[ItalicFont={LinLibertine_RI.otf}]{LinLibertine_R.otf}
\setmathrm{LinLibertine_R.otf}
\setboldmathrm{LinLibertine_RB.otf}
\setmathsf{LinBiolinum_RB.otf}

\begin{document}
\lipsum[1]

\begin{equation}
    \hat{Q}_i=\int_0^\infty \mathcal{G}^2(\mathbf{x}) \mathbf{\Sigma}^{-1}(x^2) f_i(x)dx
\end{equation}

\end{document}
  • P.S. Although I couldn't reproduce in this MWE, my actual document also throws a "Too many math alphabets used in version normal" error when I try to use \mathbf. I've cleaned up all redundant packages per this question and answer, but the problem still persists... – Lorem Ipsum Sep 16 '13 at 6:18
  • 2
    I can't reproduce the error. – egreg Sep 16 '13 at 7:46
6

I don't get the error you claim, but some things go wrong, I believe because of how libertine interacts with mathspec.

One has to specify the classes for which Libertine is wanted, though, and this triggers the error about insufficient mathgroups. This can be cured with the method outlined in http://tex.stackexchange.com/a/100428/4427

This version works, by directly calling the fonts by name.

\documentclass{article}

\usepackage{etoolbox}
\makeatletter
%% http://tex.stackexchange.com/questions/100426/
%% http://tex.stackexchange.com/a/100428/
\def\new@mathgroup{\alloc@8\mathgroup\mathchardef\@cclvi}
\patchcmd{\document@select@group}{\sixt@@n}{\@cclvi}{}{}
\patchcmd{\select@group}{\sixt@@n}{\@cclvi}{}{}
\makeatother

\usepackage{amsthm}
\usepackage[libertine]{newtxmath}
\usepackage{mathspec,lipsum}
\setmainfont{Linux Libertine O}
\setmathsfont(Digits,Latin,Greek){Linux Libertine O}
\setmathrm{Linux Libertine O}
\setboldmathrm{Linux Libertine O}
\setmathsf{Linux Biolinum O}

\begin{document}
\lipsum[2]

\begin{gather}
\hat{Q}_i=\int_0^\infty \mathcal{G}^2(\mathbf{x})
  \mathbf{\Sigma}^{-1}(x^2) f_i(x)\,dx=\mathsf{X} \\
\hat{Q}_i=\int_0^\infty \mathcal{G}^2(\mathbf{x})
  \mathbf{\Sigma}^{-1}("x^2) f_i(x)\,dx=\mathsf{X}
\end{gather}

\end{document}

I added a line to your formula, showing how " is necessary as explained in the mathspec manual.

enter image description here

  • Thank you very much! A followup question (I can ask a new one if necessary): If you add mathrsfs for script math, everything changes to funky and weird symbols (possibly something is being redefined) and the symbols change depending on where it is placed in the preamble. Is it because I have not explicitly defined the font to be substituted for script math? – Lorem Ipsum Sep 16 '13 at 13:09
  • @yoda If I add \usepackage{mathrsfs} (no matter where), then $\mathscr{A}$ does what's expected and I see no other change. – egreg Sep 16 '13 at 13:14
  • Ah, my apologies. I also had a bm, which in conjunction with mathrsfs is what's causing trouble (just bm by itself or mathrsfs by itself are fine). With these, I get i.stack.imgur.com/TgKoY.png for the MWE above. I'll try and figure out a way without using bm (FWIW, I'm stitching together 5 different LaTeX documents written at different points in time and for different journals into a single manuscript, so they all have some custom stuff that interferes with another) – Lorem Ipsum Sep 16 '13 at 13:27

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.