# Trying to use FreeSerif as a maths font — what am I doing wrong?

Always in search of the ideal font combination unicorn, I thought I'd try the GNU Free UCS Outline Fonts (FreeSerif, FreeSans, and FreeMono). I seem to have fallen at the first hurdle:

\documentclass[final]{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}
\usepackage{unicode-math}
\setmathfont{FreeSerif}
\begin{document}
$x+y=\sqrt{z}$
\end{document}


Both XeLaTeX and LuaLaTeX (.otf format fonts with TexLive, Windows 7) give me this:

What am I missing?

-
This is not an answer but to help, here is using XeTeX img819.imageshack.us/img819/9996/shutterseleo006.png and here using LuaLaTeX img267.imageshack.us/img267/7355/shutterseleo007.png on my Lubuntu 11.10 with TexLive2011. –  Sigur Feb 10 at 13:38
@Sigur Is that using the .otf version? (I'm on Windows 7) –  Brent.Longborough Feb 10 at 13:45
Hum, sorry. I checked it now and I have those fonts in .ttf format. But I don't know if TeXLive uses them. –  Sigur Feb 10 at 13:51
You can't use FreeSerif as a math font because it lacks a MATH table. Both XITS Math and TG Termes Math have the table and are based, like FreeSerif, on Times. –  egreg Feb 10 at 13:55
In Classic TeX (and apparently a fallback in xetex) the thickness of the rule in \sqrt is given by the height of the sqrtsign character, so TeX fonts have a sqrtsign with large depth making tex math fonts unusable in other systems. The math table can specify this without needing to corrupt the glyph positioning. –  David Carlisle Feb 10 at 14:05
show 1 more comment

You can't use every OpenType font as a math font for unicode-math. At least a MATH table in the font is necessary, along with a math script. Although some of the basic setups can be performed, as it is shown by the italic letters in the formula, some important parameters for math typesetting are missing.

In your case the big problem is with the radical: as David Carlisle remarks, TeX uses for the thickness of the bar over the radicand the height of the radical symbol; however XeTeX and LuaTeX know how to use a different parameter from the MATH table, so the problem doesn't appear.1

A real math font must have also other information for the correct kerning of math characters in formulas. See the documentation of mathspec for more details and, probably, many more glyphs than FreeSerif has.

If your text font is FreeSerif, then a good choice for the math font can be either XITS Math or TG Termes Math, both based on Times.

1 Unfortunately, due to a bug in the current version of LuaTeX, the big black blob can appear also if the math font has the correct parameters in the MATH table.

-
About your note, the respective LuaTeX bug affects only TFM fonts, OpenType fonts with MATH table are not affected. –  Khaled Hosny Feb 10 at 17:24