36

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.

1
  • Perhaps consider using the XITS fonts. I also think mathspec is what you're looking for.
    – user2473
    Commented Mar 7, 2012 at 16:42

7 Answers 7

34

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.)

libertine with different math fonts

\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}
35

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):

Sample page showing text and math

7
  • 1
    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
    Commented Mar 23, 2015 at 9:47
  • @mbork: I hope you find it useful :) Commented Mar 24, 2015 at 6:43
  • Will the math font be usuable for pdftex?
    – Keks Dose
    Commented Mar 24, 2015 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. Commented Mar 24, 2015 at 9:33
  • 4
    @MaxNoe: It is usable now, a release was made a few months ago and it should be in TeX Live. Commented May 5, 2016 at 0:37
13

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}

enter image description here

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.

2
  • 1
    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
    Commented Mar 7, 2012 at 23:14
  • @mbork: I've add a paragraph with information on what symbols are available in which package.
    – Mico
    Commented Mar 8, 2012 at 12:00
9

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}

enter image description here

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

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.

6
  • 5
    Should be much earlier than that :) it is basically done and just awaiting a bit more of testing. Commented Mar 8, 2012 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
    Commented Mar 8, 2012 at 15:03
  • And one more question: will it fit (visually) Libertine?
    – mbork
    Commented Mar 8, 2012 at 15:05
  • 2
    Yes, it will ... more or less
    – user2478
    Commented Mar 8, 2012 at 16:16
  • 2
    Lucida OpenType fonts have been released today. They are available at very reasonable prices from the TUG store: tug.org/store/lucida Commented Mar 16, 2012 at 19:47
6

(answer copied from here: https://tex.stackexchange.com/a/364502/75284)

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}

screenshot

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

1
2

Nowadays a single line in the preamble does the job, and it will compile even with pdflatex.

\documentclass{article}

\usepackage[libertine]{newtx}


\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\)

\(\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega\)

\(\upGamma\upDelta\upTheta\upLambda\upXi\upPi\upSigma
\upUpsilon\upPhi\upPsi\upOmega\)
\end{document}

only newtx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .