[Tex/LaTex] Linux Libertine Bold Math

boldfontslibertinemath-modexetex

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}

Best Answer

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