Recently i decided to use the Libertine font to write my dissertation, because finally there is kinda math font for Libertine: \usepackage[libertine]{newtxmath}
. Since I want to enable of the beautiful historical ligature supported by this font, XeLaTeX is used to compile the .tex
file.
However, it seems that the Arabic font seems to look like CM font, which is quite bigger than the original Libertine number fonts. As with pdflatex
, there is no problem but the ligature feature can not be activated.
In Ubuntu system
-
xelatex
+libertine
+newtxmath
+ ligature on\usepackage[T1]{fontenc} \usepackage[lining]{libertine} \usepackage[libertine]{newtxmath} \addfontfeature{RawFeature=+hlig}
The text looks really great except the Arabic numbers in math mode.
-
pdflatex
+libertine
+newtxmath
\usepackage[lining]{libertine} \usepackage[T1]{fontenc} \usepackage[libertine]{newtxmath}
The Arabic font in math mode is identical to text font in this case.
I just wonder the New TX math font is only based on pdflatex?
Best Answer
There are several issues here.
XeLaTeX
andLuaLaTeX
handle font differently fromLaTeX
andpdfLaTeX
. The first two usefontspec
and the latter,fontenc
. One should not use\usepackage{fontenc}
when using XeLaTeX or LuaLaTeX. In your case, thelibertine
package will have detected which engine you are using and will have loaded the right one, if you had not loaded it before, but you should removefontenc
if you are compiling with XeLaTeX exclusively.This difference in font handling means that you are not using the same format of the font with
fontspec
than you would have used withfontenc
. The OpenType format (.otf
) will be used by fontspec, and these fonts formats contain a lot more features than the usual Type1 Postscript font. Some of the features you are amongst other are these ligatures. You can only access these when using the OTF fonts.Regarding the behaviour of
newtxmath
, looking at the source it seems that, at least for the version I have, it is not compatible withfontspec
.if you want to use the libertine font for the maths with
fontspec
you have to use themathspec
orunicode-math
packages (however I do not think thatunicode-math
will work here as libertine is not all self contained).Note that you will get a few warning about shapes not being found and replaced with default.
however I have never tried that and do not know if the OTF font contains all the glyphs for maths. You can also change the sans serif and monospace fonts with the
\setmathsf{}
and\setmathtt{}
commands respectively. If you want to use the same as what the libertine package gives you, you can use: