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.
To start a new paper on Overleaf:
- On this page, click the green Code button, then Download ZIP.
- 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.
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
-
Put the calculations for each figure in its own script in
calculations/, and add the script to the list inmake_all_figures.py. -
Each script imports
common.py, which loads the shared style file and providessave_figure(fig, name)to savefigures/name.pdf. -
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.
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:
- Turn on Dropbox sync in your Overleaf account settings.
- Upload the template to Overleaf as described in Getting started. The project appears in your Dropbox under
Apps/Overleaf/. - Move the
calculationsfolder out of that Dropbox folder to wherever you keep your code. - Set
figure_dirincalculations/common.pyto the project'sfiguresfolder in Dropbox (there is a commented example), and point your Zotero Better BibTeX auto-export at the project'sreferences.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.
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.
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.
MIT. See LICENSE for details.