$npx -y skills add scdenney/open-science-skills --skill paper-texTypeset a working paper or journal submission in house-style LaTeX from Markdown, Word, TeX, ODT, RTF, or HTML. Use to convert drafts, build PDFs, or prepare journal-specific spacing, limits, anonymization, disclosures, and citations.
| 1 | # Paper formatter (LaTeX) |
| 2 | |
| 3 | Turn a draft in any common format into a clean, house-style LaTeX paper and build the PDF. The mechanical work runs through a committed driver, `scripts/format_paper.py`: it detects the input format, converts the body with **pandoc**, wraps it in the EB Garamond template under `assets/`, and builds with **latexmk**. The house-specific finishing — captions with notes, disclosure sections, SI cross-references — is done by hand afterward, and the steps are below. |
| 4 | |
| 5 | The house style: 12pt EB Garamond, 1-inch margins, author-date citations (`apsr`), numbered sections with unnumbered subsections, a single-spaced title block, the introduction on its own page, figures and tables placed where they are written (`[H]`), and every exhibit carrying a title with an italic *Note:* beneath it (`\figcap`). |
| 6 | |
| 7 | Paths below are relative to this skill directory — the folder containing this SKILL.md. You know its absolute path from having just read this file; set `SKILL` to it once: |
| 8 | |
| 9 | ```bash |
| 10 | SKILL=/path/to/.../skills/paper-tex # the directory this SKILL.md lives in |
| 11 | ``` |
| 12 | |
| 13 | ## Step 0 — Ask for the journal specifics first |
| 14 | |
| 15 | Formatting is journal-dependent, and the defaults are not always what you want. **Before converting, confirm the parameters**; ask one concise blocking question only when a value cannot be inferred safely. The ones that change the output: |
| 16 | |
| 17 | | Parameter | Driver flag | Default | Notes | |
| 18 | |---|---|---|---| |
| 19 | | Target journal / working paper | — | working paper | sets the rest | |
| 20 | | Body spacing | `--spacing single\|double` | `single` | single fits tight page limits; do not double-space past a hard limit | |
| 21 | | Page / word limit | — | none | if a limit binds, prefer single spacing and tighten `\bibsep` before cutting content | |
| 22 | | Anonymized for review | `--anon` | off | blanks the author; keep identifying disclosures on a separate title page | |
| 23 | | Intro placement | `--cover-page` | intro on its own page | only pass `--cover-page` if the venue requires the intro on the title page | |
| 24 | | Citation style | edit `\bibliographystyle` in `assets/preamble.tex` | `apsr` | swap the `.bst` per journal | |
| 25 | | Font | edit `\usepackage{ebgaramond}` | EB Garamond | swap only if a journal mandates a family | |
| 26 | | Required disclosures | added by hand | none | data availability, ethics, funding, COI — see house-finishing | |
| 27 | |
| 28 | A few profiles to start from (confirm against the current author guide): |
| 29 | |
| 30 | - **Working paper** — `--spacing double`, named author, `\today`, intro on its own page. |
| 31 | - **Journal of Politics (short article)** — `--spacing single`, `--anon`, 15-page limit, data-availability + ethics in the manuscript, other disclosures on a separate title page. |
| 32 | - **Generic double-anonymous submission** — `--anon`, `--spacing double`, no acknowledgments or funding in the body. |
| 33 | |
| 34 | ## Prerequisites |
| 35 | |
| 36 | Verified on macOS with TeX Live 2025 and pandoc 3.8. Required on `PATH`: `pandoc`, `latexmk` + `pdflatex` (a full TeX distribution), and `pdfinfo`/`pdftoppm` (poppler) for page counts and proof renders. The `ebgaramond`, `apsr` (texlive `harvard` collection), `calc`, `booktabs`, `threeparttable`, `xr-hyper`, and `newunicodechar` packages must be installed — all ship with a full TeX Live / MacTeX. |
| 37 | |
| 38 | ```bash |
| 39 | # macOS |
| 40 | brew install pandoc poppler # TeX via MacTeX (basictex users: tlmgr install ebgaramond harvard collection-latexextra) |
| 41 | # Debian/Ubuntu |
| 42 | # apt-get install -y pandoc texlive-full poppler-utils |
| 43 | ``` |
| 44 | |
| 45 | ## Run the driver (primary path) |
| 46 | |
| 47 | One command converts and builds. These are the exact invocations used to validate the skill: |
| 48 | |
| 49 | ```bash |
| 50 | # Markdown -> single-spaced PDF, intro on its own page. A sibling references.bib |
| 51 | # and any figure the draft references by a relative path are staged automatically. |
| 52 | python3 "$SKILL/scripts/format_paper.py" draft.md --out build \ |
| 53 | --title "Democracy and Nationalism, Reconsidered" \ |
| 54 | --author "Jane Q. Researcher" \ |
| 55 | --abstract "Do citizens who value democracy reject nationalism? ..." \ |
| 56 | --keywords "nationalism; democratic values; national identity; ISSP" \ |
| 57 | --spacing single --build |
| 58 | |
| 59 | # Word (.docx) -> same; embedded images are extracted into build/media automatically |
| 60 | python3 "$SKILL/scripts/format_paper.py" draft.docx --out build --title "..." --build |
| 61 | |
| 62 | # Existing TeX (full document or a body fragment) -> rewrapped in the house template |
| 63 | python3 "$SKILL/scripts/format_paper.py" draft.tex --out build --title "..." --build |
| 64 | |
| 65 | # Main text + SI together (SI gets SI-A.. section labels, SI-1.. float numbers, |
| 66 | # and an \externaldocument cross-reference so \ref reaches SI from the main text) |
| 67 | python3 "$SKILL/scripts/format_paper.py" main.md --si si.md --out build --build |
| 68 | ``` |
| 69 | |
| 70 | Output lands in `build/`: `main.tex`, `body.tex`, `preamble.tex` (and `s |