Research and Communication in Economics

LaTeX for Empirical Economics

Generate publication-quality tables and documents from your analysis scripts

This is an auxiliary module covering practical tools that complement your main analysis workflow. You don't need LaTeX to do empirical research, but it makes producing publication-ready documents much easier and more reproducible.

Why Use LaTeX?

LaTeX is a document preparation system that separates content from presentation. Unlike Word or Google Docs where you manually format each table and figure, LaTeX lets you generate tables directly from your analysis scripts as PDF files.

Key Benefits

  • Reproducibility: Your entire paper—tables, figures, numbers—comes from your scripts. No copy-pasting data into tables. No "whoops, I updated the analysis but forgot to update Table 3."
  • Version control: Your paper is plain text, so git diffs show exactly what changed. You can track who changed what and why.
  • Publication quality: Tables and equations look professional. Fonts are consistent. Spacing is perfect.
  • Vector graphics: Tables and figures generated in LaTeX are vector-based (infinitely scalable), unlike screenshots or raster images.

The Typical Workflow

Run your analysis in R, Stata, or Python → generate individual table PDFs → embed them in a LaTeX document as figures. This gives you the best of both worlds: powerful data analysis tools plus beautiful document presentation.

Installation

Mac

Install MacTeX, which includes LaTeX and all necessary tools:

brew install --cask mactex-no-gui

This installs a minimal version (~2GB). For the full version with more fonts, use mactex instead.

Windows

Download and install MiKTeX from miktex.org, or use:

choco install miktex

Linux

sudo apt-get install texlive-full

Verify Installation

Test that LaTeX is installed by checking the version:

pdflatex --version

The Standalone Package

The standalone package is the key tool for generating individual table PDFs from your scripts. It allows you to create a small LaTeX document that contains just a table (or figure), compiles it to PDF, and crops it to show only the content.

Why Standalone?

  • Minimal output: Creates a tight PDF with no margins, just your table.
  • Reusable: Generate tables independently, then include them in your paper.
  • Version control friendly: Each table is a single file you can track.
  • Flexibility: You can regenerate any table by re-running one line of code.

Basic Example

Here's a minimal standalone document that creates a table PDF:

\documentclass[border=10pt]{standalone}
\usepackage{booktabs}
\usepackage{amsmath}

\begin{document}

\begin{tabular}{lrr}
\toprule
 & Mean & Std Dev \\
\midrule
Age & 42.3 & 15.2 \\
Income & 65000 & 28000 \\
\bottomrule
\end{tabular}

\end{document}

Compile this to PDF with:

pdflatex table.tex

You get table.pdf, a tight PDF containing just the table.

The Recommended Workflow

The typical approach in empirical economics research:

  1. Run your analysis in R, Stata, or Python. Generate summary statistics, estimates, etc.
  2. Export table code to LaTeX. Most statistical software can output in LaTeX format. See the examples below.
  3. Create a standalone LaTeX file for each table, containing the LaTeX code from step 2.
  4. Compile to PDF. Your table becomes a clean, vector-based PDF file.
  5. Include in your paper. Insert the PDF as a figure in your main LaTeX document.

Exporting Tables from Analysis Software

Each language has packages for exporting regression results and summary statistics directly to LaTeX format:

* Use estout or outreg2 for regression tables
ssc install estout  // Install if needed

regress y x1 x2
esttab . using "table.tex", replace
# Use xtable, knitr, or kableExtra
library(xtable)

summary_table <- data.frame(
  Variable = c("Age", "Income"),
  Mean = c(42.3, 65000),
  SD = c(15.2, 28000)
)
print(xtable(summary_table), file = "table.tex")
# Use pandas to_latex()
import pandas as pd

summary_table = pd.DataFrame({
    'Variable': ['Age', 'Income'],
    'Mean': [42.3, 65000],
    'SD': [15.2, 28000]
})
summary_table.to_latex("table.tex", index=False)

Including the PDF in Your Paper

In your main LaTeX document, include the PDF as a figure:

\begin{figure}[h]
\centering
\includegraphics{tables/summary_statistics.pdf}
\caption{Summary Statistics}
\label{fig:summary}
\end{figure}

Organization Tip

Keep your tables in a dedicated folder (e.g., tables/) and compile them separately. This keeps your main paper LaTeX file clean and makes it easy to regenerate any table if your analysis changes.

Found something unclear or have a suggestion? Email [email protected].