agentleFS
HYWang-stHYWang-st/paper-typeset/SKILL.md

paper-typeset

Skill0 starsChanged 4 months agoMITView on GitHub

Reformats an EXISTING .docx or .tex file to a target layout spec — fonts, sizes, line spacing, margins, columns, heading styles, three-line tables, float and caption placement. Use when the words are already written and only the formatting is wrong ("排版", "格式不符合要求", "按学校模板重排", "reformat to IEEE/ACM/APA", "fix my LaTeX spacing"). Ships profiles for 中文学位论文 (GB/T 7713 + GB/T 7714-2015), IEEE, ACM, Springer LNCS, Elsevier, APA 7, MLA 9, plus a schema for hand-writing an institution's own spec. Does NOT write, rewrite, translate, or cite — for producing manuscript content use the paper-spine skills; this one runs after them, on the file they produce.

  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read plan before apply on anything that matters.

    line 44
  2. Distinctive:

    Read the reference only when the task reaches it.

    line 86
  3. Distinctive:

    Never invent a profile value: If the spec does not state it, inherit it.

    line 101

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Paper Typeset

Reformatting, not authoring. The content is fixed; the layout is what changes.

Two engines, same shape — audit reports, apply/fix writes:

WordLaTeX
scriptscripts/docx_typeset.pyscripts/tex_typeset.py
read-onlyaudit, planaudit, fmt --check
writesapplyfix, fmt, build

When this skill applies

Yes — a finished draft in the wrong format; a thesis that must match a university spec; a paper being retargeted from one venue to another; LaTeX with ugly spacing, fragile float placement, or captions on the wrong side.

No — writing, rewriting, translating, citation work, AIGC reduction. Those are the paper-spine skills. They produce the manuscript; this reformats it. Chaining is normal: paper-spine-* writes final_paper/main.tex, then this restyles it.

Word: the four verbs

python3 scripts/docx_typeset.py profiles                              # list
python3 scripts/docx_typeset.py audit  paper.docx --profile cn-thesis # report only
python3 scripts/docx_typeset.py plan   paper.docx --profile ieee      # per-paragraph preview
python3 scripts/docx_typeset.py apply  paper.docx --profile ieee -o out.docx

audit and plan never write. apply writes a new file and re-audits what it wrote, so the report describes the actual output, not the intention.

Profiles: cn-thesis ieee acm springer-lncs elsevier apa7 mla9. (base exists only to be inherited from.)

Read plan before apply on anything that matters. It shows the role assigned to each paragraph — that is where a misclassified heading shows up, and it costs nothing to look.

Why it removes direct formatting

Word's cascade puts direct run formatting above the style. A document full of hand-set 宋体/小四 runs will ignore a perfectly good style definition, which is why "I applied the style and nothing happened" is the usual complaint. apply strips the conflicting properties so the style actually wins, while keeping bold and italic on body text because those carry meaning rather than formatting.

LaTeX: the six verbs

python3 scripts/tex_typeset.py audit  main.tex          # rules + .bib lint
python3 scripts/tex_typeset.py fix    main.tex -o out.tex
python3 scripts/tex_typeset.py fmt    main.tex --check  # reindent; --check writes nothing
python3 scripts/tex_typeset.py build  main.tex          # compile, explain the log
python3 scripts/tex_typeset.py clean  main.tex
python3 scripts/tex_typeset.py rules                    # what each rule checks

audit and fmt --check are safe on a repository you do not own. fix re-reads the file it wrote and audits that — the only evidence a fix worked is the file on disk.

This covers three areas the LaTeX docs go into: aesthetics (~ before citations, abbreviation spacing, en-dash ranges, display-equation punctuation), troubleshooting (reading the log instead of guessing), and engineering (structure, encoding, reproducible builds).

Not overlapping with paper-spine

paper-spine-latex/scripts/latex_guard.py checks structural integrity — brace pairing, environment closure, duplicate labels, citation keys missing from the bib, absent graphics. It contains no geometry, font, margin, or spacing checks at all. This skill checks the typographic layer. Running both is reasonable and produces no duplicate findings.

Progressive disclosure

Read the reference only when the task reaches it.

FileRead when
references/custom-profile.mdwriting a profile for a spec that is not shipped
references/apa-mla.mdAPA or MLA, especially the manual steps
references/ooxml.mdthe docx engine needs changing
references/latex-aesthetics.mdjudging what "elegant" means in LaTeX
references/latex-troubleshooting.mda compile fails
references/latex-engineering.mdproject structure, encoding, reproducibility

Rules

  • audit before apply. Reformatting is destructive to formatting by definition; know what changes first.
  • Never invent a profile value. If the spec does not state it, inherit it. A guessed margin is indistinguishable from a measured one in the output and impossible to check later.
  • Record what could not be expressed. Some requirements the engine cannot reach — run-in headings, bylines, custom trim sizes. Put them in a comment at the top of the profile as manual steps. Every shipped profile does this.
  • Verify geometry from the file, not the profile. A margin that silently reverted to an inherited value produces a plausible-looking wrong document. references/custom-profile.md has a one-liner that reads the block size back out of the .docx.
  • A leftover warning is often correct. A caption on the wrong side of a table is the document's problem, not the profile's.

Requirements

python-docx and lxml for Word; PyYAML to read .yaml profiles (a .json profile needs no extra dependency). LaTeX verbs need no Python packages, but build needs a TeX engine, and audit --chktex uses chktex when installed.

pip install -r requirements.txt

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.