Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I recently heard that there is a package called unicode-math that makes it possible to use an ordinary TTF/OTF font for mathematic typesetting. To what degree is that possible with Linux Libertine? I love this font, only the lack of math-support is a bit annoying, although euler is a good match IMHO.

share|improve this question

5 Answers 5

There is a new LaTeX math package called newtx with a libertine option that matches Libertine text, using Libertine Roman italic and Greek together with symbols from the old txfonts package, remetrized so as not to be as cramped, and with optical versions of math italic and symbols. Versions prior to 0.93 were problematic, but 0.93, which should appear shortly on CTAN, seems to work well.

share|improve this answer
    
Welcome, Michael. Remember to register, as we look forward for your valuable contributions. –  egreg May 22 '12 at 22:25
    
I would go as far as to say that Linux Libertine is (sadly) more or less useless for setting LaTeX documents that includes any type of math without newtxmath (described in the documentation for newtx) loaded. The vanilla metrics are completely bonkers in math mode if one naively sets Linux Libertine as a math font, and one will have to spend hours on manual kerning to get nice results. Or: just issue \usepackage[libertine]{newtxmath} and get good results immediately. Some situations may still call for manual kerning, but several order of magnitudes fewer than without the package. –  Daniel Andersson Aug 30 at 12:53

It's not too hard to use it for the variables and constants (letters). For XeLaTeX, you could use the mathspec package. For regular PDFLaTeX, you could use the mathastext package, e.g.:

\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[italic]{mathastext}

That will give you Computer Modern symbols with Libertine letters and numbers. See the mathastext documentation for options regarding Greek, etc. If you load another symbol font (eulervm, etc.) before loading these you'll get its symbols with libertine letters. Personally I like to load txfonts for symbols, and then load these.

I don't know to make it work if you want the few symbols it contains (which is more than most fonts, but certainly not quite enough either), you could probably use unicode-math, but you'll have to switch back to other fonts for the many symbols it lacks.

share|improve this answer
    
Is it possible to use it for, say, \sum, \int and friends? I think you call them "bigops" –  FUZxxl Oct 5 '11 at 15:11
    
As far as I know the font does not provide these characters. –  Ingo Apr 6 '12 at 16:00

Here is a modified version of Mico answer that does not use mathspec. Neo Euler is set as base math font (can be replaced by any OpenType math font), but math roman and italic are taken from Linux Libertine.

\documentclass{minimal}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmathfont[Scale=MatchLowercase]{Neo Euler} 
\setmathfont[range=\mathup]{Linux Libertine O}
\setmathfont[range=\mathit]{Linux Libertine O Italic}
\setmathfont[range=\mathbfup]{Linux Libertine O Bold}
\setmathfont[range=\mathbfit]{Linux Libertine O Bold Italic}

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

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

$\displaystyle \sum_{k=0}^\infty \frac{1}{k^2} = \frac{\pi^2}{6}$, and
$\displaystyle \int_{-\infty}^\infty 
   \exp\left(-\frac{x^2}{2}\right) = \sqrt{2\pi}$.
\end{document}

output

Notice the bad placing of some superscripts since Libertine is not a proper math font.

share|improve this answer

The package unicode-math requires XeLaTeX or LuaLaTeX and a font that has special mathematical tables and, currently, there's no such font in the Linux Libertine family.

With XeLaTeX you can try

\usepackage{mathspec}
\setmathsfont(Digits,Latin,Greek)
  [Numbers={Lining,Proportional}]{Linux Libertine O}

but as Linux Libertine O Italic has not the right parameters for letters as math symbols, some adjustments are needed in certain situations, see the manual of mathspec.

share|improve this answer

Note: I changed the answer below after learning that the OP prefers "Neo Euler" to "XITS Math".

As others have noted, there is as of now no OpenType math version of the Linux Libertine fonts. You've indicated that you'd might want to use the Neo Euler fonts. Font purists will no doubt be able to point out any numbers of differences between the two fonts; let me just say up front that I will fully agree with all of their points, but we're consciously making a compromise here.

A consideration is how to scale the math font; usually, a good starting point is to set "Scale=MatchLowercase". Second, Neo Euler only has "upright" rather than slanted font shapes for letters and numerals; in consequence, it's probably a good idea to use Libertine's italics (text) font for upper- and lowercase letters as well as for numerals, even though the glyphs' sidebearings won't be correct in many cases. The code below, which uses the mathspec package, illustrates the results of scaling Neo Euler to have the same x-height as Linux Libertine.

% !TeX program = xelatex
\documentclass{article}
\usepackage{mathspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmathfont[Scale=MatchLowercase]{Neo Euler}
\setmathfont(Digits,Latin,Greek){Linux Libertine O} % override

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

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

$\displaystyle \sum_{k=0}^\infty \frac{1}{k^2} = \frac{\pi^2}{6}$, and
$\displaystyle \int_{-\infty}^\infty 
   \exp\left(-\frac{x^2}{2}\right) = \sqrt{2\pi}$.
\end{document}

enter image description here

Observe the near-collisions between letters and superscript numerals, which are a consequence of the fact that the letters and digits come from a text rather than from a math font.

Personally, I think it's preferable to use a dedicated math font such as XITS Math together with Linux Libertine. Obviously, this will also entail making some compromises, but at least the spacing around math glyphs won't be an issue. One would load the XITS Math package as follows (note the use of the fontspec and \unicode-math packages instead of the mathspec package):

\usepackage{fontspec,unicode-math}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmathfont[Scale=MatchLowercase]{XITS Math}

The resulting output from the preceding MWE would then look like this: enter image description here

Happy TeXing!

share|improve this answer
1  
Thank you for the help, but it's just - well - I hate this font. It looks too sharp and is no match for the rather round and organic libertine... btw, is there also a way to rescale euler to match libertine in height? –  FUZxxl Oct 5 '11 at 16:10
    
Yeah, Times New Roman (the model for XITS) is not to everyone's taste! I've revised my answer to play off Libertine Text and Neo Euler math. As you'll see, you still need to make a decision regarding scaling of the math font. –  Mico Oct 5 '11 at 16:49
1  
You need math-style=upright with Neo Euler (since it has no math italics), else you will get LM Math italic (as in the sample you posted above). But since Euler alphabet is so much different from Libertine (XITS is much more closer), you better use Libertine text italic in math as well (though it has side effects) and keep Euler for math symbols. –  Khaled Hosny Oct 5 '11 at 17:08
    
@KhaledHosny -- thanks! I've made the change in the code and the displayed image. I fully agree with you, incidentally, that XITS Math is a much better match for Linux Libertine than Neo Euler is. –  Mico Oct 5 '11 at 17:31
    
@Mico hm... The image is still not quite correct... –  FUZxxl Oct 5 '11 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.