Draft and render a meta-analysis manuscript with Quarto using an IMRaD structure and embedded figures/tables. Use when preparing the final paper from analysis outputs.
Create a Quarto manuscript with standard IMRaD sections and render to PDF and HTML.
06_analysis/figures/06_analysis/tables/02_search/round-01/dedupe.bib or final bibliography07_manuscript/manuscript_outline.md (Phase 1 — outline with checklist and discussion ideas)07_manuscript/00_abstract.qmd07_manuscript/01_introduction.qmd07_manuscript/02_methods.qmd07_manuscript/03_results.qmd07_manuscript/04_discussion.qmd07_manuscript/tables.qmd (standalone PNG table images)07_manuscript/figures_legends.qmd (figure legends with embedded PNGs)07_manuscript/index.qmd07_manuscript/Makefile (sync + render automation)07_manuscript/references.bib07_manuscript/index.html (rendered HTML)07_manuscript/index.pdf (rendered PDF via Typst)07_manuscript/index.docx (rendered Word with PNG tables)07_manuscript/figures/ (synced from 06_analysis/figures/)07_manuscript/tables/ (synced PNG + CSV from 06_analysis/tables/)07_manuscript/prisma_flow.md07_manuscript/prisma_flow.svg07_manuscript/evidence_map.md07_manuscript/result_claims.csv07_manuscript/result_paragraphs.md07_manuscript/result_paragraphs.qmd07_manuscript/result_summary_table.md (auto-inserted into Results)07_manuscript/traceability_table.md07_manuscript/study_characteristics.md07_manuscript/study_characteristics.csv07_manuscript/submission_checklist.md07_manuscript/03_results.qmd (assembled)09_qa/results_consistency_report.mdThe workflow has two phases: Outline first, then Write. Never skip Phase 1.
Before writing any prose, build a complete outline that serves as the blueprint.
The outline template is at assets/quarto/manuscript_outline.md — it contains 10 sections
that must ALL be filled in with project-specific data.
07_manuscript/.
07_manuscript/_quarto.yml07_manuscript/index.qmdassets/quarto/ and adapt to the project.
assets/quarto/00_abstract.qmd → 07_manuscript/00_abstract.qmdassets/quarto/01_introduction.qmd → 07_manuscript/01_introduction.qmdassets/quarto/manuscript_outline.md to 07_manuscript/manuscript_outline.md.
assets/quarto/manuscript_outline.md → 07_manuscript/manuscript_outline.mdscripts/build_evidence_map.py — review all analysis outputs.
scripts/build_evidence_map.py07_manuscript/evidence_map.md06_analysis/ R outputs, CSVs, and figure files to build the map.06_analysis/ is incomplete: STOP. Return to /ma-meta-analysis to complete analysis first.result_claims.csv with scripts/init_result_claims.py — map every result to its source.
scripts/init_result_claims.py07_manuscript/result_claims.csv (columns: claim_id, outcome, effect_measure, estimate, ci_lower, ci_upper, p_value, i2, figure_ref, table_ref, r_script, citation_keys)claim_id, outcome, effect_measure, estimate, ci_lower, ci_upper, p_value, i2, figure_ref, table_ref, r_script, citation_keys.06_analysis/ — every R script output, CSV table, figure PNG05_extraction/extraction.csv — for study characteristics01_protocol/pico.yaml (L1-28: all fields) — for PICO details02_search/ — search dates, database counts03_screening/round-01/agreement.md — screening decisions, Cohen's kappa08_reviews/grade_summary.csv — GRADE summary if availableFill in every section of manuscript_outline.md:
Section 1 — Project Info: Topic, journal, word limits, PROSPERO ID.
Section 2 — Key Messages: Define 3-5 take-home messages. These drive the entire manuscript. Test: if a paragraph doesn't serve at least one key message, it shouldn't be in the paper.
Section 3 — Narrative Arc: Define the story in 6 sentences (hook → gap → approach → finding → significance → bottom line). Test: read the 6 sentences aloud — they should tell a coherent story.
Section 4 — Section Outlines:
Section 5 — Tables & Figures Plan: List every table and figure with source file, panels, and draft legends.
Section 6 — References Plan: List ALL BibTeX keys that will appear in the manuscript.
Section 7 — Word Count Targets: Set per-section targets matching the target journal.
Section 8 — Supplementary Materials: Plan search strategies, PRISMA checklist, supplementary tables/figures.
Section 9 — Pre-Writing Readiness Gate: Check ALL hard requirements (data, figures, tables, references, outline completeness).
{{ in the file — must return 0 hits (no unfilled placeholders).Once the outline is approved, write each section following it exactly.
Writing style: All prose MUST follow references/academic-writing-style.md. Key rules:
american-medical-association.csl, serial comma, generic drug nameshuman-write skill after writingWriting order (this order is intentional — write data-driven sections first):
scripts/prisma_flow.py via uv run, optionally writing an SVG. Use --strict for final renders.
scripts/insert_search_report.py.
scripts/build_result_paragraphs.py.
result_claims.csv.scripts/build_study_characteristics.py.
extraction.csv.scripts/insert_traceability_table.py.
Write Methods (02_methods.qmd):
Write Results (03_results.qmd):
[@key] citations from the outline's BibTeX key lists.scripts/results_consistency_report.py — must have 0 missing items.Write Discussion (04_discussion.qmd):
Write Introduction (01_introduction.qmd):
Write Abstract (00_abstract.qmd):
03_results.qmd with scripts/assemble_results.py (also inserts result_summary_table.md).[@key] citations in all QMD files have matching entries in references.bib.scripts/verify_doi.py:
uv run ma-manuscript-quarto/scripts/verify_doi.py \
--bib projects/<project>/07_manuscript/references.bib \
--out projects/<project>/09_qa/doi_verification_report.md \
--email "[email protected]"
--patch --min-confidence 85.--patch.scripts/results_consistency_report.py.
scripts/init_submission_checklist.py.scripts/lint_qmd.py --dir 07_manuscript/ — must pass with exit code 0 (no errors).
--fix flag, then re-run to confirm.bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> --all
Alternatively, use Makefile: make all from 07_manuscript/.
Two build options: build_manuscript.sh (recommended, all-in-one) or Makefile (render only).
build_manuscript.sh (Recommended)All-in-one validation + sync + lint + render script. Runs standalone without AI — output goes to stdout.
# From repo root:
bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> # Validate only (fast)
bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> --fix # Auto-fix lint
bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> --render # Validate + render
bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> --all # Fix + render
bash ma-manuscript-quarto/scripts/build_manuscript.sh --project <name> --render --formats docx # DOCX only
7-step validation pipeline (all results to stdout):
| Step | Check | Details |
|---|---|---|
| 1 | Sync | Copy figures/tables from 06_analysis/ to 07_manuscript/ |
| 2 | Citations | Verify all [@key] in QMD match references.bib; report unused bib entries |
| 3 | Word counts | Per-section word count vs journal targets |
| 4 | QMD lint | Run lint_qmd.py (15 rules), optional --fix |
| 5 | DOI coverage | Check % of bib entries with DOI fields (target: >=90%) |
| 6 | File check | Verify all figures/tables referenced in QMD exist on disk |
| 7 | Render | Quarto render to DOCX, HTML, PDF (each format independent) |
Exit codes: 0 = all passed, N = number of errors found.
No --project? Lists all available projects:
$ bash ma-manuscript-quarto/scripts/build_manuscript.sh
Available projects:
--project hrd-parp-inhibitors
--project ici-breast-cancer
Analysis scripts in 06_analysis/ produce figures (PNG) and tables (PNG + CSV + HTML + DOCX via gt/flextable). The manuscript in 07_manuscript/ references local copies so Quarto can embed them. The sync step copies the latest outputs before every render, ensuring the manuscript always reflects current analysis.
For projects that prefer make, create a Makefile in 07_manuscript/:
.PHONY: all html pdf docx clean sync
ANALYSIS_DIR := ../06_analysis