Few Words on LaTex Fonts

LaTex documents have a very distinctive look. First of all, they do look very pretty in print since they actually use professional typesetting techniques to make the text flow nicely on the page which makes them stand out when juxtaposed against stuff generated by Microsoft Word. But there is another reason why it is easy to spot a LaTex document from a mile away. It’s the default font known as Computer Modern which was created by Yoda Donald Knuth himself. Explanation for the joke can be found here. It is very distinctive, and gives the documents that Tex look and feel:

Computer Modern

A lot of people I know, affectionately call this default look as “fucking ugly”. I do not share that sentiment. Personally I think the font has it’s own unique charm, but nevertheless it is not suited for everything. Sometimes you are required to use the ubiquitous Times New Roman font. How do you do that in LaTex? There is nothing simpler – just stick the following two lines in your preamble:

\usepackage[T1]{fontenc}
\usepackage{times}

The result is subtle, but the difference is clearly visible. Which font you prefer is really a matter of taste:

Times New Roman

Sometimes having your document standing out from the sea of papers written in Times. If you want that older book look, you could try to use something like the Bookman font:

\usepackage[T1]{fontenc}
\usepackage{bookman}

See how it compares to Computer Modern and Times above:

Bookman

Naturally, when I start talking about fonts, someone immediately starts asking me about Arial. You don’t. Why would I want to infect my pretty LaTex documents with Arial? Nevertheless they keep asking. Arial is the Times New Roman of Sans Serif fonts, despite the fact that it is merely a cheep knock-off of Helvetica. But yes, you can do it just as easily as any of the examples above:

\usepackage[T1]{fontenc}
\usepackage[scaled]{uarial}
\renewcommand*\familydefault{\sfdefault}

Here is the catch – by default LaTex renders your text in Serif fonts. You will need that last line to switch your whole document over to Sans Serif mode. Here is a sample:

Arial

Don’t use Arial though. Use Helvetica which is the de-facto king of Sans Serif world, and a far superior font. Syntax is the same as above:

\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}

Quick note about the scaled parameter – you can use it to resize your font. For example using scaled=0.92 will give you size equivalent to 9pt.

Please compare the sample below with Arial, and decide for yourself:

Helvetica

The dirty little secret here is that when you do this, you might not be getting the true Helvetica but rather it’s very close cousin Nimbus Sans. That might depend on your system, and LaTex setup though. Nevertheless, Nimbus is still far better font type than Arial.

If you want to experiment with fonts, or you are simply searching for that unique look of your own, check out the LaTex Font Catalogue. It lists all the most popular supported packages, along with usage examples and sample images.

Update 05/08/2008 07:59:11 PM

By popular demand, I switched up the images a little bit to make them clearer and so that they don’t require you to click on them.

[tags]latex, tex, latex fonts, fonts, arial, helvetica, bookman, times, computer modern, knuth[/tags]

This entry was posted in programming and tagged . Bookmark the permalink.



15 Responses to Few Words on LaTex Fonts

  1. Adam Kahtava CANADA Mozilla Firefox Windows says:

    [quote post=”2431″]Don’t use Arial though. Use Helvetica which is the de-facto king of Sans Serif world, and a far superior font. [/quote]

    LOL… Entertaining post…

    Reply  |  Quote
  2. The Punisher DENMARK Mozilla Firefox Linux says:

    It’d help if you didn’t post your screenshots as badly compressed JPEGs, you twatmonkey.

    Reply  |  Quote
  3. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    @Punisher – Sigh… You can click on the images to see them in full size.

    …you twatbuttmonkey.. ;)

    Reply  |  Quote
  4. Michael S. UNITED KINGDOM Safari Mac OS says:

    You need to use Computer Modern if you need math symbols–none of the other fonts you mentioned come with math symbols.

    Reply  |  Quote
  5. astine UNITED STATES Konqueror Linux says:

    “Sigh… You can click on the images to see them in full size.”

    It’s hard to compare them that way.

    Though, I didn’t need to compare Helvetica and Arial; there are plenty of good ones one the net and I seen them. I’ve alway felt that the difference between Arial and Helveltica was more subtle than really mattered. There are a lot of people who get all up in arms about how Arial stole Helvetica’s thunder and Microsoft is at fault (and necessarily evil.)

    But, really, the differences amount mostly to a few choice thicknesses and slants. The most noticibly difference is in the lowercase ‘t’. You can’t even tell the difference on the computer most of the time because the pixilation.

    Yet, *someone* must care because they made a movie about it. Whatever.

    Reply  |  Quote
  6. astine UNITED STATES Konqueror Linux says:

    BTW, you have your Helvetica and Arial transposed. Between the last two, the first is Heltvetica and the second is Arial. ;-)

    Reply  |  Quote
  7. Luke Maciak UNITED STATES Mozilla Firefox Windows Terminalist says:

    [quote post=”2431″]You need to use Computer Modern if you need math symbols–none of the other fonts you mentioned come with math symbols.[/quote]

    Not necessarily. To use math formulas in Times font simply add following package declaration:

    \usepackage{mathptmx}

    If you want to use bookman you will have to switch to it’s extension font Kerkis and then do:

    \usepackage{kmath,kerkis}

    If you want a Sans Serif math symbols, Helvetica might be a bad choice. You should go with Iwona instead:

    \usepackage[T1]{fontenc}
    \usepackage[math]{iwona}

    [quote post=”2431″]It’s hard to compare them that way.[/quote]

    Well, I replaced them with more appropriately sized PNG files. Is that better?

    [quote post=”2431″]BTW, you have your Helvetica and Arial transposed. Between the last two, the first is Heltvetica and the second is Arial.[/quote]

    Really? I thought I got them right. Either way, it should be fixed now.

    Reply  |  Quote
  8. Alphast NETHERLANDS Mozilla Firefox Ubuntu Linux Terminalist says:

    Personally, my Serif font favourite is Garamond and Sans-Serif is Verdana, which I find rounder and more pleasant than both Helvetica and Arial.

    Reply  |  Quote
  9. astine UNITED STATES Mozilla Firefox Windows says:

    Well, I replaced them with more appropriately sized PNG files. Is that better?

    Much.

    Reply  |  Quote
  10. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    [quote comment=”9003″]Personally, my Serif font favourite is Garamond and Sans-Serif is Verdana, which I find rounder and more pleasant than both Helvetica and Arial.[/quote]

    Verdana seems to be bundled in the Winfonts package which may or may not be bundled with your LaTex distribution. :)

    Reply  |  Quote
  11. Ven. Pandita SRI LANKA Mozilla Firefox Windows says:

    Hi!

    Why don’t you use XeTeX? With XeTeX, you can use all Truetype or Opentype fonts in your operating system provided they are Unicode-compatible; you even no longer need to care for encodings.

    Reply  |  Quote
  12. ikaruga UNITED STATES Mozilla Firefox Windows says:

    Question Luke, how do you go about changing math fonts? The two commands you gave in the comments is more than my google king fu is turning up…

    Reply  |  Quote
  13. Pingback: LaTex and Fonts | verbose logging CANADA WordPress

  14. Mervyn Thomas AUSTRALIA Safari Mac OS says:

    @ The Punisher:
    This post was really helpful to me, it was motivated only by a desire to help – and you think it’s clever to make a mindlessly offensive remark.

    Reply  |  Quote
  15. Ken D'Ambrosio UNITED STATES Google Chrome Linux says:

    Pssst:

    s/I think the font has it’s own/I think the font has its own/;

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>