Skip to content

Keep the paper's numbers in a table rendered as LaTeX commands - #15

Open
yy wants to merge 1 commit into
mainfrom
paper-numbers
Open

yy wants to merge 1 commit into
mainfrom
paper-numbers

Conversation

@yy

@yy yy commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Numbers the paper cites now come from the workflow instead of being typed into the text.

  • workflow/scripts/paper_numbers.py (rule paper_numbers) computes each number from the workflow's outputs. It writes one table, results/numbers.csv, with the columns name, value, format, source, description. The value is stored unformatted; format is a Python format spec such as ,.0f or .0%.
  • python -m project_name.paper_numbers (rule numbers_tex) renders the table as results/numbers.tex, one \newcommand per row, with the description and source as a comment.
    • It applies the format and escapes for LaTeX: 2133 → 2{,}133, 0.559 → 56\%.
    • It rejects names that are not letters only, and names that appear twice.
  • main.tex inputs the file, and the text uses the commands (\nExampleRows{}). A mistyped or missing name stops the build.
  • CLAUDE.md and results/README.md now say not to type computed numbers into the paper.
  • DuckDB can query the table in place, for example duckdb.sql("from 'results/numbers.csv'").

Tested:

  • make all builds through the PDF ("The example dataset has 2 rows, with values summing to 3.").
  • make check passes: lint, format, 9 tests, the dry run.

…mmands

A paper_numbers rule computes every number the paper cites from the
workflow's outputs and writes one table: name, value, format (a Python
format spec), source, description. The numbers_tex rule renders it as
results/numbers.tex, one \newcommand per row with its source as a comment;
main.tex inputs it and the text uses the commands, so a mistyped or missing
name stops the build. The renderer (python -m project_name.paper_numbers)
escapes commas and percent signs and rejects names that are not letters
only or appear twice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant