PolyPaper/paper.org

97 lines
3.0 KiB
Org Mode
Executable File

# -*- org-export-allow-bind: t; -*-
#+TITLE: Demo Paper (PolyPaper)
#+AUTHOR: {{{NAME}}}
#+FILETAGS: :export:
#+OPTIONS: toc:2 num:t broken-links:auto
#+PROPERTY: header-args:python :session py :results file graphics :exports results :cache yes
#+PROPERTY: header-args: :mkdirp yes
#+MACRO: VENUE (eval (or (getenv "VENUE") "arxiv"))
#+SETUPFILE: setup/venue-{{{VENUE}}}.org
#+MACRO: IF-SHORT (eval (when (bound-and-true-p paper-short) ""))
#+MACRO: IF-LONG (eval (unless (bound-and-true-p paper-short) ""))
#+MACRO: IF-ANON (eval (when (bound-and-true-p paper-anon) ""))
#+MACRO: IF-LIMITFIG (eval (when (bound-and-true-p paper-limit-figs) ""))
* Abstract :export:
PolyPaper demonstrates building venue-specific PDFs from a single Org source.
* Introduction :export:
- One literate Org source.
- Venue profiles in =setup/=.
- Reproducible figures via Org Babel.
- Conditional content via tags/macros.
{{{IF-ANON}}}
Double-blind mode replaces author name and redacts URLs.
{{{end}}}
* Methods :export:
We generate a simple figure via Python/Matplotlib.
#+name: fig-core
#+begin_src python :var seed=123
import numpy as np, matplotlib.pyplot as plt
np.random.seed(seed)
x=np.linspace(0,10,200); y=np.sin(x)+0.15*np.random.randn(200)
plt.figure(); plt.plot(x,y); plt.xlabel("x"); plt.ylabel("y")
out="figs/sine-core.pdf"; plt.savefig(out, bbox_inches="tight"); out
#+end_src
#+caption: Core figure used in all venues.
#+attr_latex: :width 0.8\linewidth
#+RESULTS: fig-core
file:figs/sine-core.pdf
* Results :export:
Here is a citation [cite:@demo2020].
{{{IF-LIMITFIG}}}
** Extra figures (excluded when figure-limited) :noexport:
Text here won't export when =paper-limit-figs=t=.
{{{end}}}
{{{IF-LONG}}}
* Appendix :export:
Extended content appears only for non-short profiles.
{{{end}}}
* Data and Code Availability :export:
# This section is auto-generated from repo_meta.json.
#+name: availability
#+begin_src python :var meta_file="repo_meta.json" :results raw :exports results :cache yes
import json, textwrap
m=json.load(open(meta_file, "r", encoding="utf-8"))
lines = []
lines.append("*Data and Code Availability*")
if m.get("url"):
lines.append(f"- Code repository: [[{m['url']}][{m.get('repo_name', m['url'])}]]")
if m.get("license"):
lines.append(f"- License: {m['license']} (see LICENSE file)")
if m.get("code_archive_doi"):
lines.append(f"- Code archive DOI: {m['code_archive_doi']}")
if m.get("data_availability"):
lines.append(f"- Data availability: {m['data_availability']}")
dls = m.get("data_links", [])
if dls:
lines.append("- Data links:")
for d in dls:
if 'url' in d:
label = d.get('label', d['url'])
lines.append(f" - [[{d['url']}][{label}]]")
steps = m.get("repro_instructions", [])
if steps:
lines.append("- Reproducibility:")
for st in steps:
lines.append(f" - {st}")
if m.get("contact_email"):
lines.append(f"- Contact: {m['contact_email']}")
print("\n".join(lines))
#+end_src
#+RESULTS: availability
* References :export: