LaTeX is a document markup language (think something like HTML) that is widely used in academia.1 Its primary advantages over Word (and word processors) are the separation of content and presentation and its formatting of mathematical equations. In addition to papers, it is often used for academic slides; many talk slides are prepared with beamer.

Learning LaTeX

Here are some links to get started learning LaTeX:

Writing LaTeX

  • Use an online service such as Overleaf or ShareTeX. These are great for collaboration, but become inflexible when you want to customize your workflow.
  • Write it with a specialized editor such as TeXmaker, TeXStudio, or TeXshop. These generally have built ways to insert text, and also live preview. I would stay away from editors such as LyX that are WYSWYG.
  • Write it with an general purpose editor such as Atom or Sublime Text.2 Most editors have a plugin to make writing LaTeX easier. For Atom there is LaTeXTools, and for Sublime Text, LaTeXTools

LaTeX with R

This is pretty easy. Rnw, also called Sweave, documents allow you to mix R chunks with LaTeX. This is similar to R markdown, but with LaTeX instead of markdown.3 knitr.

Many packages, such as xtable](https://cran.r-project.org/package=xtable), stargazer, or texreg produce formatted output in LaTeX. When you use these programs, do not copy and paste the output. Instead, save it to a file, and use \input{} to include the contents in your document.

Useful Packages

TODO

My workflow

At the moment, I use emacs with AucTeX for writing pure LaTeX documents. However, I’ve started using Atom more and more as a general text editor. I use RStudio for writing Rnw files. For papers, I haven’t moved to using (R) markdown and pandoc yet, because I find the layout and reference support still too limiting; I end up writing enough LaTeX that I figure I might as well write the whole thing in LaTeX. I’ve been using Overleaf for coauthoring in a couple of cases. I often build my document using Makefiles. For smaller papers, I’ll use Rnw files with knitr, but for larger projects, I’ll separate the R code into scripts and include the output into


  1. TeX is pronounced as “teck” because the X is a Greek chi. The pronunciation of of LaTeX is thus lah-teck or lay-teck. It is not pronounced like the rubber compund. See this StackExchange question on the pronunciation of LaTeX.

  2. And of course Vim or Emacs.

  3. And Sweave files preceded R markdown and knitr by many years.