Tag Archives: liberation fonts

LaTeX and fonts

I recently came across the Liberation fonts (serif, sans, mono) which I rather like. I wanted to use the serif version in my LaTeX documents, but this seemed complicated (just google “latex fonts” and you’ll see what I mean.) The solution I found was onĀ this web site, but I am always suspicious of this stuff whenever I see it as it is never as simple as it looks.

In the event, however, it seems to have been relatively painless to deal with. If you are on Windows and using MiKTeX (the standard 1-click installer for LaTeX on that platform) you already have both XeLaTeX and the fontspec package installed, allowing you to use any truetype font in your document.

\usepackage[cm-default]{fontspec}

Activates the appropriate module, and

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Liberation Serif}

firstly compensates for a sizing error on truetype fonts and secondly sets the main font. Compile and see your new shiny wonderfulness!

You can also mess with the other default fonts like so:

\setsansfont{Liberation Sans}
\setmonofont[SmallCapsFont={Liberation Mono}]{Liberation Mono}

or substitute in your own font names as required.