A Nice LaTeX Cheat Sheet

I ran across this cheat sheet while looking for an answer to setting line spacing of single-spaced within paragraphs and double-spaced between paragraphs in the front matter. While it doesn’t have the answer to that, it does look like a very handy reference for more commonly encountered situations in \LaTeX.

If you are wondering what \LaTeX is, it is a document-processing and typography system. It is to a word processor what a process camera is to a point-and-shoot consumer camera. It’s big, has a steep learning curve, but delivers results far beyond what can be done with consumer-grade word-processing applications, or at least makes it possible to do those tasks with far less hair-pulling.

Technically, \LaTeX is a set of macros originally by Leslie Lamport built on the \TeX typography system of Donald Knuth. Documents in \LaTeX are actually programs, so the process of building a document in \LaTeX is much like software development. While there are commercial versions of \LaTeX systems, pretty much everyone I know uses free, open source versions like MikTeX or TeXLive. There are a number of frontends that help users construct and typeset documents using \LaTeX: TeXNicCenter for Windows, TeXShop for Mac, and Kile for the KDE GUI on Linux and FreeBSD.

Why use \LaTeX and not either word processing programs like WordPerfect and Word or desktop publishing packages like Ventura and Quark? First, \LaTeX has excellent mathematics typesetting capabilities. It is the sole format accepted by many journals that often deal with typesetting equations. If you are writing for such journals, there is no alternative. If you want to publish math-heavy text and not spend oodles of your time trying to figure out what went wrong in an “equation editor” for a consumer word processing program, you want \LaTeX. Second, it incorporates a huge amount of typography experience. If you are concerned about making documents that are not just formatted well, but make it easy on the eyes of the reader, \LaTeX provides that for you. It is flexible enough that if you think you know better, you can override just about anything, though most of the time that’s not really going to help your readers. Third, \LaTeX automates just about everything that makes writing large documents a hard task. Let me explain that by example.

When Diane and I were writing our dissertations, we had a task of putting together several chapters of material where the final document had to conform to a long set of rules used by the Thesis Office at our university to assure both consistency across dissertations and to allow micro-filming archives to be able to use the result. In particular, there are rules about the placement of figures and tables relative to where they are first referenced in the text. In word processors, you place your text and you place your figure or table, and there is no effective control over where the word processor finally decides to put the figure or table. I had several chapters of material, and I tried WordPerfect and Microsoft Word, without success. I tried Microsoft Publisher and Corel Ventura, but also ran into difficulties there. It was around that time that I started looking at \LaTeX as an alternative. I found that dissertations in the electrical engineering department were often done in \LaTeX and that there was a thesis class (a sort of configuration or environment document setting a style) for \LaTeX that the EE department made available. This was like an existence proof; people had actually managed to get the thesis office to accept their manuscripts when done with the thesis class. I asked Jeff Shallit for recommendations on books, and he pointed me to the \LaTeX book by Leslie Lamport and the \LaTeX Companion book by Goossens, Mittlebach, and Samarin. What I found back in 2002 was that getting acquainted with \LaTeX definitely took some effort, but it almost immediately was paying off. My figures and tables weren’t going hither and yon willy-nilly, they were pretty much where they needed to be, or could be tweaked to do so.

Then, some of the other benefits started becoming apparent. While word processors have some mechanisms for generating front matter (table of contents, lists of figures and tables), \LaTeX could do this in a very systematic way that basically took the entire load off my back. The other bane of the dissertation writer is references. The Thesis Office wanted all references to be cited in a consistent style, to be formatted in a consistent style, to appear in order, and that every citation in the text would appear in the references, and no reference would appear that was not cited in the text. That last one puts a huge load on someone who is organizing a large set of references for themselves. Let’s say that your committee decides that you should remove some text including a citation that only appears in that text. You have to remember not only to remove the text, but to revamp your bibliography so that the now-uncited reference no longer appears. \LaTeX has a helper program, BibTeX, specifically for handling bibliographic data. Using BibTeX and the natbib style, I was able to address all the concerns of the Thesis Office while keeping things pretty simple for me. BibTeX allows you to set up one or more bibliographic source files containing all the references that you might want to use in your document. Within the document, citing a reference occurs using a “\cite” command. There are variants to allow for various in-text citation formats. The cite command is given a parameter that links to a particular reference in one of your BibTeX files. \LaTeX sets up a file used by BibTeX to pull in just the references that are actually used, and BibTeX applies the desired style to produce the typesetting for the references section. The result is that the references section went from something needing a lot of continuing effort to maintain to needing almost no effort to maintain. That sort of assistance is invaluable when what one wants to be doing is writing content and not worrying incessantly about keeping all the effects of changes one makes to the layout in mind.

Something I didn’t use in writing my dissertation that \LaTeX provides is indexing. If you want to produce a large manuscript with an index, this is something that you can do pretty easily in \LaTeX. Basically, as you go along in the text, you place an index tag next to the text that you want the index entry to refer to. \LaTeX will track the entries and the corresponding page numbers for you. If you re-organize your text, say by swapping chapters 2 and 3 around, you don’t have to re-do all those page number references in an index, \LaTeX will handle it for you.

\LaTeX provides several basic document classes for you, and you can find extensions online. The basic ones include “letter”, “article”, “book”, and “slide”. That last allows you to generate presentations in \LaTeX. Then there are all sorts of styles that one can add on. For example, if you want to write screenplays using the standard formatting rules, the screenplay style can help you. (If, though, you are really intent on screenplay writing, you probably want to look at Celtx. [Addendum: Looking a bit more at the Celtx website, I found this: “TypeSet provides precise automatic formatting of your script to industry and international standards. The Celtx server uses the very powerful LaTex typesetting tool to deliver perfectly formatted scripts.”])

There’s a system called LyX that places itself in between full \LaTeX and the usual way one uses a word processor. \LaTeX is used by LyX as a back-end, and you get a display of text that is a bit closer to the usual WYSIWYG experience, but cast by LyX as “what you see it what you mean”. Unfortunately, LyX documents are not simply standard \LaTeX, which to me is a limitation of the system.

Since writing my dissertation, I have relied upon \LaTeX for all my serious writing work, save where a collaborator has insisted upon something else. I use \LaTeX for writing letters and it is the basis for the six or so pending article manuscripts I have. My curriculum vitae/resume is handled in \LaTeX, and I have that set up such that I can generate documents of different lengths and detail, plus tuning the focus of my research statement, all by changing a couple of configuration settings. This means that I have one source text whether I want a CV or a resume, or whether I’m sending the result to someone interested in my biology background, my computer science background, or appreciates my interdisciplinary approach. That also means that I can keep things up to date with changes to just one file, and not about a dozen different ones to handle the most common sets of configuration changes that I use.

If you don’t do equation type-setting, don’t need figures and tables to go where you want, don’t need front matter or bibliographies, and don’t need an index, you’ll probably be perfectly happy using the usual word processor. If you do need any of those things, then you owe it to yourself to check out \LaTeX.

Please follow and like us:
error

Wesley R. Elsberry

Falconer. Interdisciplinary researcher: biology and computer science. Photographer. Husband. Christian. Activist.

3 thoughts on “A Nice LaTeX Cheat Sheet

  • 2009/05/26 at 8:44 am
    Permalink

    LATEX is very powerful. For complex mathematical equations, it is terrific. A lot of my clients use LATEX for their journal articles, for the reasons you’ve cited.

    One thing I have found is that if you have a document written in LATEX, it is a pain to convert it to a word processing format. I’ve usually ended up OCRing a printout, and then editing from there.

  • 2009/06/06 at 2:52 pm
    Permalink

    LaTeX is a word processing format…

  • 2009/06/06 at 10:27 pm
    Permalink

    LaTeX is plain text with markup. Plain text is a format, I guess, so if you want to insist that LaTeX inherits the plain text format property, I certainly won’t stand in your way.

Comments are closed.