I'm trying to use Linux Libertine as the math (and main) font, and I used this answer to set the math fonts. However, the math output is still CM.
\documentclass{minimal}
\usepackage{amsmath, mathspec, libertine, lipsum}
%\usepackage[libertine]{newtxmath}
\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(x) \Sigma^{-1}(x^2) f_i(x)dx
\end{equation}
\end{document}

If I try to uncomment the newtxmath line, I get an error
Package mathspec Error:
amsmath' must be loaded earlier thanmathspec'
But I have loaded amsmath before mathspec!
How do I fix these issues (fixing either is fine, since the goal is to use LL fonts for math).
As pointed out, moving newtxmath before amsmath solves the problem in the above MWE. Now let me change it a bit and include amsthm as well, which now leads to a host of other errors such as:
! LaTeX Error: Command \openbox already defined. Or name \end... illegal, see p.192 of the manual.

amsthmas well, it gives lots of errors... – Lorem Ipsum Sep 12 '13 at 19:58amsthm,newtxmath,mathspec. Don't loadamsmathsince it is loaded bynewtxmath. – karlkoeller Sep 12 '13 at 20:14