Monday, May 3, 2010

Where Did April Really Go? or, How Do I Use Pretty Fonts With LaTeX?

It has recently come to my attention that my vast readership is unhappy with the quality of postings of late. I’m sorry. On the plus side, I verified that I can write something in MacJournal and use the “send to blog” menu item and have it do approximately the Right Thing™.

So what did I actually do in April? Work has been busy, but I can’t really say much about that. I can report that my company celebrated its tenth anniversary last Friday by treating us to dinner on a boat.

Outside of work, preparations for certain upcoming events have seemed to dominate evenings and weekends. Things are coming along, though. I hope everybody likes our cake topper which I made all by myself. I think we’re approaching a lull as we wait for everybody to RSVP.

So anyway, here’s a totally hypothetical situation for you: suppose you want to create a nice-looking event program and you want to do the typesetting with LaTeX because WYSIWYG editors are lame. How do you make something which is the size of your blank cards and which doesn’t use Computer Modern (which is an awesome font, thanks Donald E. Knuth you’re awesome dude, but is too recognizable as “that font from scientific papers and textbooks”)? It turns out to be very simple.

LaTeX has a lot of fonts available. For a program heading, Calligra is nice. I find it difficult to read for the main body, though. A nice serif font like Palatino is better. (I always used Palatino for my papers in high school because I thought it had the nicest capital letter J, which was, of course, one of the first letters the reader would see.)

To use a non-standard paper size (like, say, 4.25 inches by 6.375 inches), the geometry package is your friend. It lets you easily specify the dimensions of the paper and the sizes of the margins.

Finally, what about color? Also very simple. All together we get a preamble which looks something like this:


\documentclass[10pt]{article}
\usepackage[paperwidth=4.25in, paperheight=6.375in, top=0.25in,
left=0.25in, width=3.75in, height=5.875in]{geometry}
\usepackage{color}
\usepackage[T1]{fontenc}
\usepackage{calligra} % cursive font
\usepackage[sc]{mathpazo} % regular font
\linespread{1.05}
\pagestyle{empty} % no page numbers


Thankfully, Calligra and Palatino play nicely together; Palatino assumes the role of the default font, while Calligra only takes effect following a \calligra directive (which is limited in scope to the surrounding curly braces).

Hooray for LaTeX!

No comments: