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.


Activates the appropriate module, and

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


About tehwalrus

Lib Dem, Software Developer, General Geek. View all posts by tehwalrus

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: