# What free math font could/should accompany Linux Libertine and Linux Biolinum?

Well, the title of the question pretty much says everything. To be more precise: I'd like to know (1) what font would be visually suitable to use with Linux Libertine and/or Linux Biolinum as the main text font (I haven't decided which of the two I'll use) and (2) how to enable it (as a math font) in XeTeX.

A good guide on what factors to consider when mixing fonts is Thierry Bouche's Diversity in math fonts article in TUGboat, Volume 19 (1998), No. 2.

The most important aspect is to use the same font for text and math letters (as well as letter-like symbols as \partial or \infty). This has drawbacks as some letters will suffer from spacing problems, but compared to the other option (using totally different math letters), it's really a lesser evil. Of course, if this is not acceptable to you, then you should first choose the math font and then use the same font for text, but that limits your font choices dramatically.

Once you've assigned the text font to the math letters, the remaining choices you face is for the geometric symbols, the delimiters and the big operators (\sum, \int, \bigcup etc.). The main consideration is color (how bold the symbols are) and the shape of the symbols (mainly the shape of sum or integral symbols, especially if you use them often). Compared to Libertine, XITS and Asana are a bit too bold (especially true for the sum symbol), Latin Modern is a bit too light (especially +, \otimes, etc.), and Cambria has a very huge \sum symbol, huge \otimes and \oplus as well as very bold \bigcup. Thus, which font will look better will depend on what type of math you're typing, and none will be perfect.

Here's a sample to show the results of this font mixing with Libertine. Notice the spacing problems around the f in f(r_k) and \Sigma_c f(r) due to the fact that's it's a text font we're using for math. I've not set all letter-like symbols to come from Libertine (only \infty), so there's still room for improvement. (Note also the missing parenthesis in one of the formulas with Latin Modern Math.)

\documentclass{article}

\usepackage{amsmath}

\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont{Linux Libertine O}

\newcommand{\setlibertinemath}{%
% use Libertine for the letters
\setmathfont[range=\mathit/{latin,Latin,num,Greek,greek}]{Linux Libertine O Italic}
\setmathfont[range=\mathup/{latin,Latin,num,Greek,greek}]{Linux Libertine O}
\setmathfont[range=\mathbfup/{latin,Latin,num,Greek,greek}]{Linux Libertine O Bold}
%\setmathfont[range={"2202}]{Linux Libertine O}% "02202 = \partial % doesn't work
\setmathfont[range={"221E}]{Linux Libertine O}% "0221E = \infty
% etc. (list should be completed depending on needs)
}

\newcommand{\sample}{%
When computing the sums $\sum_{k=0}^{+\infty}{f(r_k)}$ of $f$ the integral representation of $K_0(x)$ may be used.
$\eta(r)\frac{\partial f}{\partial r} + 2\Sigma_cf(r) = \sum_{k=0}^{+\infty}{K_0\mathopen{}\left(\frac{\lvert r - r_k \rvert}{L}\right)} = \int_{0}^{\infty}{e^{-\left(z+\frac{r^2}{4L^2\pi}\right)} \frac{dz}{2z}}.$
We then use
$\bigcup_{\lambda \in \Lambda}{U_\lambda} \cap \bigsqcup_{\delta > 0}{G_\delta} = \bigcap_{i \in I}{\mathbf{A}_i} \quad \text{so that} \quad u \otimes w \oplus v = 0.$
}

\pagestyle{empty}

\begin{document}

\section{Libertine + Latin Modern}
\setmathfont{Latin Modern Math}\setlibertinemath
\sample

\section{Libertine + Cambria}
\setmathfont{Cambria Math}\setlibertinemath
\sample

\section{Libertine + XITS}
\setmathfont{XITS Math}\setlibertinemath
\sample

\section{Libertine + Asana}
\setmathfont{Asana Math}\setlibertinemath
\sample

\end{document}


A late answer (and a shameless plug), but I have been working on math companion to Linux Libertine fonts, which got more attention recently (thanks to support from TUG) and it is starting to take shape.

The character coverage is still a bit limited and there may be bugs in the existing ones, but testing and bug reports are appreciated.

I’m currently forking the whole Linux Libertine and Linux Biolinum family (and changed the name to avoid confusion and follow the reserved name clause in the license) as I need a way to quickly fix bugs I see in the text fonts (there is quite a few of them), but the idea is to merge this back with the original fonts once the dust settles.

Here is a sample (the full document is here):

• Wow. Just wow. Thanks for that. (In fact, when I started reading this answer, I got excited, but not too much - I told myself "let's see first who's doing this". Now that I've scrolled to see your name I'm all excited again. – mbork Mar 23 '15 at 9:47
• @mbork: I hope you find it useful :) – Khaled Hosny Mar 24 '15 at 6:43
• Will the math font be usuable for pdftex? – Keks Dose Mar 24 '15 at 8:15
• @KeksDose: I have no plans for providing support for 8-bit TeX engines myself, but I’m hoping that one else (e.g. the people who maintain the libertine or newtx) will do, and I’ll to help as much as possible. – Khaled Hosny Mar 24 '15 at 9:33
• @MaxNoe: It is usable now, a release was made a few months ago and it should be in TeX Live. – Khaled Hosny May 5 '16 at 0:37

In the MWE below, a pangram is first in text italics (with Linux Libertine) and then in four different math alphabets -- Asana Math, Cambria Math (not entirely free, but quite cheap), XITS Math, and Latin Modern Math. The exercise is repeated with Linux Biolinum and the same four math alphabets, this time in sans-serif mode.

I'd say that the overall closest, though by no means perfect, fit is between Linux Libertine and Asana Math. Should you, however, wish to give considerable weight to the shape of the letters f, p, and q, XITS Math may be your best choice. Or, should you care much about compatibility of the shapes of the letter w (but not care much about the letters f and g), Cambria Math may be best for you. In any case, Latin Modern is not visually compatible with Linux Libertine.

% !TEX program = xelatex
\documentclass[letterpaper]{article}
\usepackage[no-math]{fontspec}
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\usepackage{unicode-math}
\setmathfont[version=asana]{Asana Math}
\setmathfont[version=cambria]{Cambria Math}
\setmathfont[version=xits]{XITS Math}
\setmathfont[version=lm]{Latin Modern Math}
\newcommand{\qbf}{The\ quick\ brown\ fox\ jumps\ over\ the\ lazy\ dog.}

\begin{document}
\noindent
\emph{\qbf} --- Linux Libertine O, italics\newline
\mathversion{asana} $\qbf$ --- Asana Math\newline
\mathversion{cambria} $\qbf$ --- Cambria Math\newline
\mathversion{xits} $\qbf$ --- XITS Math\newline
\mathversion{lm} $\qbf$ --- Latin Modern Math

\bigskip\noindent
\textsf{\qbf} --- \textsf{Linux Biolinum O}\newline
\mathversion{asana} $\mathsf{\qbf}$ --- Asana Math-sf\newline
\mathversion{cambria} $\mathsf{\qbf}$ --- Cambria Math-sf\newline
\mathversion{xits} $\mathsf{\qbf}$ --- XITS Math-sf\newline
\mathversion{lm} $\mathsf{\qbf}$ --- Latin Modern Math-sf
\end{document}


Incidentally, the weird "tz" character in the first line (text italics, Linux Libertine) seems to be a product of an unfortunate interaction between Linux Libertine and XeLaTeX. This problem does not occur if one uses either a font other than Linux Libertine or if the MWE is run under LuaLaTeX.

Addendum To learn more about the various math symbols that the various math fonts provide, please refer to Will Robertson's write-up, Every symbol defined by unicode-math. You'll find out quickly that just about all Unicode math fonts provide all of the "standard" math symbols. However, the math font packages tend to differ importantly in the sets of specialized symbols, e.g., arrows, that they provide. Obviously, the font with the most math symbols (AFAICT, XITS Math at present) need not be the one that's best for you, simply because you may have no need for most of the symbols that the most feature-laden package provides.

Finally, then, suppose that you end up deciding to use the XITS Math font because it comes with all the special symbols you need (and the other math font packages do not). In that case, you should probably be willing to use the XITS text font, rather than Linux Libertine O, because XITS harmonizes very well (by design!) with the XITS Math font.

• Well, thanks, but this is not exactly what I was asking about: what about all these funny symbols used in maths: relations, operators, quantifiers, ...? – mbork Mar 7 '12 at 23:14
• @mbork: I've add a paragraph with information on what symbols are available in which package. – Mico Mar 8 '12 at 12:00

You can consider newtxmath with the libertine option. The math fonts used are not OpenType, so no unicode-math, but the result is pretty good. The order of packages is important.

\documentclass{article}

\usepackage{amsmath}

\usepackage[libertine]{newtxmath}
\usepackage[no-math]{fontspec}
\usepackage{mleftright}

\setmainfont{Linux Libertine O}

\pagestyle{empty}

\begin{document}

When computing the sums $\sum_{k=0}^{+\infty}{f(r_k)}$ of $f$ the integral
representation of $K_0(x)$ may be used.

$\eta(r)\frac{\partial f}{\partial r} + 2\Sigma_cf(r) = \sum_{k=0}^{+\infty}{K_0 \mleft(\frac{\lvert r - r_k \rvert}{L}\mright)} = \int_{0}^{\infty}{e^{-\mleft(z+\frac{r^2}{4L^2\pi}\mright)} \frac{dz}{2z}}.$
We then use
$\bigcup_{\lambda \in \Lambda}{U_\lambda} \cap \bigsqcup_{\delta > 0}{G_\delta} = \bigcap_{i \in I}{\mathbf{A}_i} \quad \text{so that} \quad u \otimes w \oplus v = 0.$

\end{document}


• The numerals in the image look like Computer Modern. (As does the non-summation capital sigma early in the first equation.) – hftf Mar 21 '15 at 20:58

you should wait until the Lucida Math OpenType font will be published by TUG. I suppose it will be at least at the end of this year.

• Should be much earlier than that :) it is basically done and just awaiting a bit more of testing. – Khaled Hosny Mar 8 '12 at 13:36
• Well, thanks - but bad news is that I need some font for tomorrow...;) OTOH: Khaled: maybe you want one more tester?;) – mbork Mar 8 '12 at 15:03
• And one more question: will it fit (visually) Libertine? – mbork Mar 8 '12 at 15:05
• Yes, it will ... more or less – user2478 Mar 8 '12 at 16:16
• Lucida OpenType fonts have been released today. They are available at very reasonable prices from the TUG store: tug.org/store/lucida – Ulrik Vieth Mar 16 '12 at 19:47

Libertinus is a fork of Linux Libertine with bug fixes and pretty nice math support (see this example document). It is the perfect match for Linux Libertine, because, well, it is Linux Libertine, just forked. And I personally much prefer the upright integral symbol, in keeping with the spirit of the ISO recommendations that only variables should be italic.

\documentclass[varwidth,border=1mm]{standalone}

\usepackage[
math-style=ISO,
bold-style=ISO,
partial=upright,
nabla=upright
]{unicode-math}

\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmathfont{Libertinus Math}

\begin{document}
The formula $$E=mc^2$$ is arguably the most famous formula in physics.

In mathematics, it could be $$\mathrm{e}^{\mathrm{i}\uppi}-1=0$$.

$$\displaystyle \sum_{k=0}^\infty \frac{1}{k^2} = \frac{\uppi^2}{6}$$, and
$$\displaystyle \int\displaylimits_{-\infty}^\infty \exp\left(-\frac{x^2}{2}\right) = \sqrt{2\uppi}$$.

$$\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda\mu\nu\xi\pi\rho\sigma\tau\upupsilon\phi\chi\psi\omega \varepsilon\vartheta\varrho\varsigma\varphi\varkappa$$

$$\upalpha\upbeta\upgamma\updelta\upepsilon\upzeta\upeta\uptheta\upiota\upkappa\uplambda\upmu\upnu\upxi\uppi\uprho\upsigma\uptau\upupsilon\upphi\upchi\uppsi\upomega \upvarepsilon\upvartheta\upvarrho\upvarsigma\upvarphi\upvarkappa$$

$$\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega$$

$$\upAlpha\upBeta\upGamma\upDelta\upEpsilon\upZeta\upEta\upTheta\upIota\upKappa\upLambda\upMu\upNu\upXi\upPi\upRho\upSigma\upTau\upUpsilon\upPhi\upChi\upPsi\upOmega$$
\end{document}


Be aware though: xe(la)tex currently (TeX Live 2016) has a bug, which is visible in my screenshot: Why is the fraction off the math axis in XeTeX? . lualatex of TeX Live 2016 has a bug as well: spacing in LuaLaTeX with unicode-math

• Is there any way to make the integral slanted? – Krishna May 15 '18 at 19:35