I use the Libertine font for text and math.
If I declare a new operator with \DeclareMathOperator*, the font used to typeset the operator is not Libertine.
For example:
\documentclass{article}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{amsmath}
\DeclareMathOperator*{\argmin}{arg,min}
\begin{document}
This is some text.
\begin{equation}
x = y + \sum_{z \in \mathcal{Z}} \beta_z
\end{equation}
\begin{equation}
x = \argmin_{y \in Y} \bigg { f(y) + \frac{1}{g(y) - h(y)} \bigg}
\end{equation}
\end{document}
Produces:
Where \argmin is not in Libertine font.
I also noticed that commenting out \usepackage{libertine} gives me \argmin in the correct font but, of course, normal text is now not in Libertine any more:
EDIT: I just noticed this is a XeTeX-specific problem.
If I compile with pdflatex instead of xelatex, the problem disappears.
In the project I am working on, however, I need XeTex, so just switching to pdflatex is not an option for now.
EDIT2: I tried the suggestions I received in an answer.
Using
\usepackage[type1]{libertine}and then\usepackage[libertine]{newtxmath}again gives me normal text in Computer Modern, and not in Libertine. The math operator, though, is now in Libertine.Using
\usepackage{libertinus}before\usepackage{amsmath}, both with and without\usepackage[libertine]{newtxmath}, gives a compilation error:! LaTeX Error: Command \dddot already defined.Inverting the order of package loads fixes the error. I mean that I load first
amsmathand thenlibertinus, without loadingnewtxmath. In this case, I get the correct result for\argmin, but the rest of the math looks funny. See, for example,\mathcal{Z}or the curly braces in the screenshot below.Loading
amsmathfirst,libertinussecond, andnewtxmaththird, gives another compilation error:! LaTeX Error: Command '\arrowvert' already defined..The last permutation, which is 1st
amsmath, 2ndnewtxmath, 3rdlibertinus, gives one more compilation error:! LaTeX3 Error: Control sequence \not= already defined..
EDIT3: Ok, I have a finally working version thanks to the answer below:
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[type1]{libertine}
\usepackage[libertine]{newtxmath}





\operator@font. Withunicode-math, you should instead use\setoperatorfont. – Davislor Jun 29 '19 at 05:16xelatex --versiongives:XeTeX 3.14159265-2.6-0.999991 (TeX Live 2019/Arch Linux). From the log file I also see I am usingPackage: libertine 2019/02/27,newtxmath v1.553, 2018/05/15, andPackage: amsmath 2018/12/01 v2.17b, which all look quite recent to me. Anything more specific I should be looking for? – Alberto Santini Jun 29 '19 at 06:18xelatexgives the wrong font; compiling withpdflatexdoes not. – Alberto Santini Jun 29 '19 at 06:23