Chapter 14 Typesetting and Word Processing Programs
14.1 LaTeX
LaTeX is a document markup language (think something like HTML) that is widely used in academia.3 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.
14.1.1 Learning LaTeX
Here are some links to get started learning LaTeX:
- Overleaf Free & Interactive Online Introduction to LaTeX
- LaTeX Tutorial has interactive lessons
- ShareLaTeX Documentation
- Overleaf Example Templates has many different examples of LaTeX documents.
- LaTeX Wikibook
- Not So Short Introduction to LaTeX is a classic, but not as as new-user friendly as the others.
14.1.2 Using LaTeX
Use an online service such as Overleaf or ShareLaTeX. 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 WYSIWYG.
Write it with an general purpose editor such as Atom or Sublime Text.4 Most editors have a plugin to make writing LaTeX easier. For Atom there is LaTeXTools, and for Sublime Text, LaTeXTools
14.1.3 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.5
Many packages, such as 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.
14.2 Word
While I use LaTeX in my own work, Microsoft Word is powerful piece of software, and many of the complaints against Word come down to not being aware of its features. There are many tools you can use to build your research paper; whatever tool you use, learn how to use it proficiently.
14.2.1 General Advice
This guide on using Microsoft Word for Dissertations covers everything and more that I would have. Also see this
separate presentation and content using styles
Automatically number figures and tables
Use a reference manager like Mendeley, Zotero, colwiz, or Papers. They have plugins for citations in Word.
When exporting figures for Word, if you must use a raster graphic use PNG files (not JPEG). For publication, use a high DPI (600) with PNG graphics.
Learn to use Fields. You can insert figures from files that you can update using
Insert > Field > Links and References > IncludePicture
. This is useful for programmatically generating figures to insert into your document. Likewise, you can insert text from files that you can update usingInsert > Field > Links and References > IncludeText
.
14.2.2 Using R with Word
For a dynamic reports you can use R Markdown and export to a word document. When doing this, use a reference document to set the the styles that you will use. See Happy collaboration with Rmd to docx for more advice on using R Markdown with Word.
When using functions from packages such as xtable, stargazer, or texreg output HTML, which can be copy and pasted into word.
Finally, the ReporteR package is an alternative method to generate Word Documents from R.
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 compound. See this StackExchange question on the pronunciation of LaTeX.↩
And Sweave files preceded R markdown and knitr by many years.↩