LaTeX typesetting tips

Here are a few tips to get your documents prepared in LaTeX looking even better. When you were told about LaTeX, you were likely told you would never have to worry about formatting and writing references again: LaTeX would do all of it for you. Well, LaTeX tries to, but it follows your instructions. Here are a few guidelines for giving instructions to LaTeX in a way that results in more pleasant documents.

Before we start, let me tell you a few details about LaTeX behavior. LaTeX typesets text for you following several typesetting considerations for aesthetics and readability, including, at least:

  1. the amount and variability of kerning in a paragraph: we want words and characters to be equally spaced across the paragraph,
  2. the number of lines ending with hyphenation: we do not want many lines ending in hyphenation in a row,
  3. the number of characters in the last line of the paragraph: we do not want the last line to be very short (widow lines);
  4. the number of lines before and after a page or column break: we want at least two lines before or after a page or column break (avoid orphan lines);
  5. the amount of floats in a page: we do not want a lot of floats (figures, tables, and the like) and few text on a page.

LaTeX takes your text and runs it through an optimization problem to maximize “goodness”, according to the previous considerations. Overall, LaTeX tries to turn your text into something like The Art of Computer Programming.1

However, it turns out that some times your text cannot be typeset in a way that satisfies all aesthetics and readability considerations. You should check at least for orphan lines (consideration 4 above), but I would strongly recommend you avoid widow lines as well (consideration 3). When you have a widow or an orphan line, edit your text. Yes, I said edit your text. Just do it! Either add or remove words to make the text shorter or longer and solve the problem. (Needless to say, make the text better while editing it.)

Another thing you should take care of is figure placement (consideration 5 above). Here are a few broad recommendations:

  • Place figures and tables at the top of a text column using the [t] placement hint. This saves space and reduces the possible number of orphans you can have. An exception to this are floats like algorithms, which we may want to have running with the text.
  • LaTeX prefers to place figures after their definition in the source. If you ask LaTeX to place a figure at the top of a column, the figure might only show up in the next column. This behavior is aggravated for figures that span multiple columns (\begin{figure*}), which only show up on the next page. To have the figures show together with the text that discusses them, you might need to move the definition of the figure earlier in your LaTeX source file. (A bit cumbersome, but still better than changing pages to look at a figure discussed in another page.)

Overall, these instructions require little effort compared to writing of text and code, running experiments, building models, and several other activities. Doesn’t seem worth skipping.


  1. Seriously. LaTeX and The Art of Computer Programming were made by D. Knuth. You can configure several typesetting parameters in LaTeX, but I never needed to. 

Normalizing References

Citing sources and previous work is integral to research. Here are a few tips on getting your references right when using BibTeX (although you may use the formatting rules with whatever system you use). Note these are broad recommendations that I believe will apply to your papers. If you think this is overkill, go check the hundreds of pages the Chicago Manual of Style has on references, including how to cite cooking recipes, blueprints, songs, papers in foreign languages, and whatever you can think of.

Keep your references in a single place

You will likely have to cite the same related work on multiple papers, so just keep all your references around in one place. Keeping them in one place might have other uses, like helping you find a paper you’ve read in the past but don’t remember the title or authors. Whenever I start a new paper, I link (with ln -s) my BibTeX file to the paper’s directory. Any new references I read and cite will be available in the (single) BibTeX file for other papers. If you like to get crazy, you may use a reference management system; I don’t like to get crazy.

What to show

References should be consistent, and by consistency I mean that you should show the same items of information for conference and journal papers. I settled on the minimum amount of information that allows a reader to unambiguously find the referenced paper. Using the minimum makes it easier for you to create the BibTex entry and minimizes use of space, which we so often lack.

For conference articles I show exactly: authors, title, conference, and year. BibTeX does this automatically for you if you have author, title, booktitle, and year fields in your BibTeX inproceedings entries. In BibTeX source files, everything outside entries is considered a comment, so you can just move all information that is not one of these four items outside the entry and keep them around. Here is an example entry in my BibTeX file:

@inproceedings{sundaresan13bottleneck,
    author = {Sundaresan, S. and Feamster, N. and
              Teixeira, R. and Magharei, N.},
    title = {{Measuring and Mitigating Web Performance
              Bottlenecks in Broadband Access Networks}},
    booktitle = IMC,
    year = {2013},
}
 isbn = {978-1-4503-1953-9},
 location = {Barcelona, Spain},
 pages = {213--226},
 numpages = {14},
 url = {http://doi.acm.org/10.1145/2504730.2504741},
 doi = {10.1145/2504730.2504741},
 acmid = {2504741},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {DNS prefetching, bottlenecks, broadband networks},

For journal articles I show exactly: authors, title, journal, volume, number, pages, and year. As before, BibTeX does this automatically for you if you have these fields in your article entries. Here is an example entry:

@article{roughan11astopo,
   author = {Roughan, M. and Willinger, W. and Maennel, O. and
             Perouli, D. and Bush, R.},
   journal = IEEEJSAC,
   title = {{10 Lessons from 10 Years of Measuring and Modeling
             the Internet's Autonomous Systems}},
   year = {2011},
   volume = {29},
   number = {9},
   pages = {1810--1821}
}
 month={October},
 keywords={Internet;routing protocols},
 doi={10.1109/JSAC.2011.111006},
 ISSN={0733-8716},}

Other normalization tips

Capitalize titles: The Chicago Manual of Style recommends we capitalize titles (and section headers). Once you invest time in learning how to capitalize titles, you will get it right and it will look better too. Note that BibTeX removes capitalization from titles by default (a desperate attempt at consistent capitalization?), so you need to add two opening and closing braces to tell BibTeX you are a pro! Check the examples above.

Normalize conference and journal names: To avoid having conferences and journals appear differently, you can create aliases for them. In the example above I use IMC and IEEEJSAC, which were defined earlier in my BibTeX file as follows:

@string{IMC = "Proc. IMC"}
@string{IEEEJSAC = "IEEE J. Selected Areas in Communications"}

Abbreviate first names: My reasoning is that abbreviating first names saves space, so do it everywhere. Do not omit authors, e.g., using et al.