← Back
bakerjw

bakerjw/paper-template

LaTeX paper template with reproducible Python figures

View on GitHub ↗https://www.jackwbaker.com/advice/Paper_project_setup.html ↗
Stars
3
Forks
0
Watchers
3
Open issues
0
Contributors
1
Language
TeX
License
MIT License
Default branch
main
Created Oct 1, 2026Updated Oct 1, 2026

Star growth

Today—
This week—
This month—

Star history will appear here once this repo has been tracked for a couple of days.

README

Paper template: LaTeX with reproducible Python figures

A folder structure for writing a research paper in LaTeX, with every figure generated by Python scripts, and a draft skeleton that starts from your planned conclusions. Copy this folder to start a new paper.

See paper.pdf for the compiled draft skeleton. The accompanying article, Setting up a paper project, describes why the structure helps.

Getting started

To start a new paper on Overleaf:

  1. On this page, click the green Code button, then Download ZIP.
  2. In Overleaf, click New Project, then Upload Project, and drag the zip file into the window. There is no need to unzip it first.

Overleaf creates the project and compiles the draft skeleton. To make your figures update automatically from your code, see Writing on Overleaf below.

To work on your own computer instead, unzip the file (or clone this repository) and compile paper.tex with your LaTeX distribution.

Structure

paper-template/
├── paper.tex                 # Main LaTeX file
├── references.bib            # References, e.g., exported from Zotero
├── figures/                  # Figures used in the paper (generated)
│   ├── demand_capacity.pdf
│   └── fragility_and_consequences.pdf
└── calculations/             # All code needed to reproduce the paper
    ├── make_all_figures.py   # Runs every script below
    ├── common.py             # Shared paths, style, and save function
    ├── figure.mplstyle       # Figure formatting for every figure
    ├── fig_demand_capacity.py
    └── fig_fragility_and_consequences.py

Workflow

  1. Put the calculations for each figure in its own script in calculations/, and add the script to the list in make_all_figures.py.

  2. Each script imports common.py, which loads the shared style file and provides save_figure(fig, name) to save figures/name.pdf.

  3. Regenerate everything and recompile:

    python calculations/make_all_figures.py
    latexmk -pdf paper.tex

The generated figures are tracked in git, so the paper compiles without running Python.

Writing on Overleaf

If you write on Overleaf, the paper lives there and the code stays on your computer. Overleaf's Dropbox sync (a premium feature that many universities provide) connects the two:

  1. Turn on Dropbox sync in your Overleaf account settings.
  2. Upload the template to Overleaf as described in Getting started. The project appears in your Dropbox under Apps/Overleaf/.
  3. Move the calculations folder out of that Dropbox folder to wherever you keep your code.
  4. Set figure_dir in calculations/common.py to the project's figures folder in Dropbox (there is a commented example), and point your Zotero Better BibTeX auto-export at the project's references.bib.

Running make_all_figures.py then sends new figures straight to Overleaf. Edit references in Zotero rather than Overleaf, because each export overwrites references.bib.

Draft skeleton

paper.tex starts with a planning box (topic, audience, draft conclusions, target journal, and coauthors), followed by placeholder Abstract, Introduction, Methods, Results, and Conclusions sections. Each placeholder notes what the section needs to accomplish. Replace them with your own outline and text.

A draft switch in the preamble controls the drafting aids. With \drafttrue, the planning box is shown, and the \note{} and \todo{} commands appear as colored text. Set \draftfalse to hide them all for submission. Line numbers stay on in both modes, since journals usually want them at submission.

Requirements

Python 3.8+ with numpy, scipy, and matplotlib, and a LaTeX distribution (e.g., TeX Live or MacTeX).

The style file is the same one used for the figures in Communication by Design, from the book's figure repository.

License

MIT. See LICENSE for details.