Latex:Fontes

De WikiLICC
Ir para: navegação, pesquisa

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}


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.