agentleFS
DBQDSSDBQDSS/aimath-translations-skill/skills/latex-display-layout-audit/SKILL.md

latex-display-layout-audit

Skill5 starsChanged 56 days agoMITView on GitHub

Compare display-math layout in a LaTeX AI or mathematics translation with the original PDF and repair confirmed wrapping, alignment, nesting, or OCR spacing defects while preserving equation numbers and labels.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when a displayed formula looks excessively wrapped, misaligned, nested incorrectly, or affected by OCR spacing.

    line 10
  2. Distinctive:

    If images cannot be inspected, report the limitation and use measurements without claiming a visual comparison.

    line 22
  3. Very specific:

    Before editing, record the label-to-printed-number map from .aux, including custom \tag, starred environments, and per-row \notag behavior.

    line 40
  4. Very specific:

    Do not replace an environment blindly merely because a scanner finds nesting.

    line 49
  5. Very specific:

    Verify the spelling against the original before changing Hilbert - Schmidt or similar prose inside \text{...}.

    line 68
  6. Very specific:

    Only supply an exact --term after checking its spelling and spacing on the source page.

    line 77
  7. Distinctive:

    Do not apply a prose spacing rewrite to code or pseudocode operators.

    line 78
  8. Distinctive:

    Run the project's full build and inspect final logs for errors, unresolved references, missing glyphs, clipping, and remaining rerun …

    line 82

≈ “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

Display-Math Layout Audit

Use when a displayed formula looks excessively wrapped, misaligned, nested incorrectly, or affected by OCR spacing. Obtain the original page before editing.

Locate And Measure

  1. Find the source block using a distinctive formula fragment or nearby prose.
  2. Locate the original page from its heading, number, or text layer; calibrate printed-to-physical page mapping for that PDF. Do not reuse another book's offset.
  3. Render the original and translated formula regions. Text-layer bounding boxes help locate a formula, but the rendered glyphs determine its appearance.
  4. Compare logical line count, relation alignment, horizontal centering, and glyph style. \Re and italic Re, for example, are not interchangeable. If images cannot be inspected, report the limitation and use measurements without claiming a visual comparison.

Scan For Candidates

From this skill's directory:

python scripts/scan_layout_oddities.py path/to/chapters

The scanner reports nested math environments and numbered environments whose rows all carry \notag or \nonumber. Treat these as candidates: an aligned or split inside a suitable outer display can be valid. All-notag derivations are often intentional. A leading & alone is not evidence of a defect.

Preserve Numbering During Repairs

Before editing, record the label-to-printed-number map from .aux, including custom \tag, starred environments, and per-row \notag behavior.

Source blockRepair constraint
Fully unnumberedRewrap or regroup without introducing a number.
Numbered or labeledKeep every label, tag, numbered row, and counter effect.
Mixed numbered/unnumbered rowsInspect each row and preserve its number behavior.

Do not replace an environment blindly merely because a scanner finds nesting. Fix only the confirmed spacing or break points. Under a MathTranslations template, use its align family conventions; for other projects preserve their native display conventions. Never wrap a top-level align/align* inside \[ ... \].

For an unnumbered formula that needs a second line within an align* block:

\begin{align*}
\lambda_1 &= -\alpha - \frac{\varepsilon}{\sqrt{2}}, \\
\lambda_1 &\leq \lambda_2 \leq \cdots \leq \lambda_n.
\end{align*}

Choose breaks and alignment from the source's mathematical grouping and the available text width. Do not force the source's line count if it clips the translation.

OCR Hyphen Spacing

Verify the spelling against the original before changing Hilbert - Schmidt or similar prose inside \text{...}. The helper supports a dry run:

python scripts/fix_hyphen_spacing.py path/to/chapters
python scripts/fix_hyphen_spacing.py path/to/chapters --apply --term "Hilbert - Schmidt"

It backs up changed files and preserves existing line endings, including LF. Only supply an exact --term after checking its spelling and spacing on the source page. Do not apply a prose spacing rewrite to code or pseudocode operators.

Build And Compare

  • Run the project's full build and inspect final logs for errors, unresolved references, missing glyphs, clipping, and remaining rerun requests.
  • Compare the complete label-to-number map before/after; label count alone is insufficient. Recheck index/page references if pagination changed.
  • Render repaired formula pages and compare them with the original crops. Source line counts do not measure rendered layout quality.
  • Preserve encoding and line endings. Read complete source lines: truncated output can hide a \notag and create a false diagnosis.
  • Report confirmed repairs, remaining candidates, and any tool limitations. Shell or toolchain failures must be diagnosed in the current environment.

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.