The sophisticated document preparation system for all who are serious about computer science, mathematics, or just typography and document layout in general, if TeX and LaTeX are not the end-all and be-all of making beautiful documents, they come asymptotically close. Of course, with great power comes a huge learning curve, so this document will collect various tips and tricks that I uncover as I learn my own way through LaTeX.

Table Tricks

LaTeX likes to make sure that tables get fit all onto one page; obviously if you're writing a little document and you want to include some stats in a table you don't want one row stuck on one page and the rest on another. But occasionally you need a table which just keeps going. For that, use the longtable package, which allows tables to go off the end of one page and onto the next.

It's also nice to be able to highlight cells within tables, like rows or columns that should either stand out or be separated into groups. To do this trickery, try the colortbl package. You can specify the colors of rows and columns.

Unicode Input

It's possible to write encoded Unicode characters into LaTeX and have them come out the other side. Unfortunately I could never get over the font encoding system myself, so for characters that fit into more than one font encoding the result was never anything less than highly hackish, which is to say rather inelegant. But let's start simple.

Start by loading the ucs and inputenx packages. These enable LaTeX to decode the rest of the text of the document as some kind of Unicode text, the specific encoding is specified as the option for the inputenx package; in this example it's UTF-8.

\usepackage[unicode]{hyperref} % if you are using hyperref

After this you should be able to use mathematical characters and punctuation like literal em-dashes and arrows and such directly in the text and they should appear in the output. A special note that I read somewhere: if you want to use the hyperref package, load it with the unicode option.

Or just skip it and use XeTeX.

Special Characters

Optional arguments are delimited by square brackets "[" and "]". So how do you insert square brackets into an optional argument? Simply surround it with curly braces. The situation where I first encountered this was using the inparaenum environment to show a list inline. I wanted something like: [1] numbers go inside square brackets, [2] like in The Design & Evolution of C++, [3] and other cool papers. The solution looked like this:

\begin{inparaenum}[{[}1{]}] ... \end{inparaenum}


The default LaTeX IED (itemize, enumerate, description) lists inject space between the items in the list. This is great when the contents are longer, like paragraphs, but uses too much space when the items are single words or short phrases. The mdwlist package offers starred versions (e.g. itemize*) of these environments which do not put extra space between the items, making tight lists possible.

Sometimes you want to put lists not into standalone sections, but into the very paragraph you're writing. You might do this (1) to save space, (2) to change up your style, or (3) simply to write more like you might speak. Rather than hand-typing it, the paralist will do this for you; it introduces several environments such as inparaenum which behave similar to their standard IED counterparts but write text into the current paragraph rather than into a separate box.

Computer Science

If you ever need to write out algorithms, you could use a boring verbatim environment. Or you could do it in a style reminiscent of the white book using the algorithm2e package. It comes in two flavors, depending on whether you want to put the text inline, or offset it more into a float.

Things I Still Don't Know

Hey, be a pal! If you know how to do these things, drop me a line and I'll be happy to post it up here along with my personal thanks!