math-pdf-bookmark
Skill5 starsChanged 56 days agoMITView on GitHub
Add precise clickable bookmarks to AI or mathematics PDFs, individually or in a folder. Use text-span geometry for PDFs with usable text; use OCR only where needed for scans. Verify that each bookmark lands on its actual heading rather than an assumed page.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- VesperaZephyr/agent-skillstheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- VesperaZephyr/agent-skills★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- aimath-translations-skillSkill
- latex-array-diagram-auditSkill
- latex-bookmark-anchor-auditSkill
- latex-display-layout-auditSkill
- latex-eq-numbering-auditSkill
- latex-footnote-fidelity-auditSkill
- latex-ocr-math-defect-auditSkill
- latex-translation-fidelity-auditSkill
- mathtranslation-build-verifySkill
- mathtranslation-cls-v31-upgradeSkill
- mathtranslation-hardrefSkill
- pdf-scanned-ocr-bookmarkSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
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
- Distinctive: line 8
Use when the user requests PDF bookmarks or a navigable table of contents.
- Very specific: line 19
Use the sibling pdf-scanned-ocr-bookmark instructions if OCR is required.
- Distinctive: line 33
Read detached page columns, full-width parentheses, and page ranges carefully.
- Distinctive: line 34
If a TOC lacks page numbers, locate headings sequentially in the body using a forward cursor, not the first occurrence of the title in the …
- Distinctive: line 42
Use a trustworthy page mapping to choose the page.
- Distinctive: line 44
If the mapping is unavailable, search within the interval bounded by verified neighboring entries.
- Distinctive: line 55
Use the installed PDF library's supported destination format.
- Distinctive: line 64
Check hierarchy, page bounds, live destinations, title/heading correspondence, and intended reading order.
- Distinctive: line 80
Do not claim full coverage when some targets were omitted or require OCR review.
≈ “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.
Files
Precise PDF Bookmarks
Use when the user requests PDF bookmarks or a navigable table of contents. Preserve the PDF content and map every bookmark to a verified page and heading position. Work on output copies before replacing originals within the requested scope.
Inventory And Classify
- Identify existing usable bookmarks; keep them unless the user requests changes.
- Sample body pages throughout the book, not just the final page. A scan with metadata text on one page must not be mistaken for a text-layer book.
- Distinguish usable text, pure scans, and hybrid books whose TOC alone is scanned. OCR only the affected pages of a hybrid book when the body already has good text.
- Use the sibling
pdf-scanned-ocr-bookmarkinstructions if OCR is required. Select concurrency based on measured memory and CPU capacity, not a fixed worker count inherited from another machine.
Reconstruct The TOC
- Locate actual TOC pages; distinguish them from a numbered bibliography or a list of other volumes. Check title/page correspondence in the body.
- For text-layer TOCs, cluster spans by vertical position, then sort by x to reconstruct number/title/page rows. A line may be split across several spans.
- Deduplicate repeated text spans. Require multiple leader characters when
stripping dot leaders so the period in
1. Titlesurvives. - Parse chapter, section, appendix, and part hierarchy from numbering and indentation. Calibrate clustering tolerances for the actual layout.
- Read detached page columns, full-width parentheses, and page ranges carefully. If a TOC lacks page numbers, locate headings sequentially in the body using a forward cursor, not the first occurrence of the title in the entire PDF.
Resolve Every Heading
- Determine the printed-to-physical page mapping from multiple verified anchors. Roman front matter, inserted plates, and restarted page numbering may require separate segments rather than a single offset.
- Use a trustworthy page mapping to choose the page; search that page for the heading's vertical position. Search neighboring pages only when evidence supports it.
- If the mapping is unavailable, search within the interval bounded by verified neighboring entries. Compare title tokens while preserving word boundaries; deleting spaces before tokenization destroys English word overlap.
- Exclude TOC pages, running heads, folios, and mentions inside body prose from heading matches. Respect chapter-local section numbering.
- Record unresolved entries for review. Never invent a target using the last cursor page, clamp a wrong page into range, or force a nonmonotonic destination to match its neighbor.
Write Destinations And Verify
Use the installed PDF library's supported destination format. For PyMuPDF,
simple TOC entries use 1-based page numbers; a fourth numeric value can specify
heading height in points. Do not pass an arbitrary unvalidated dictionary as a
destination. Read back get_toc(simple=False) to verify the resulting links.
OCR geometry is in pixels and must be converted with 72 / actual_render_dpi.
Text-span geometry is already in page coordinates; do not apply an OCR scale to it.
Account for page rotation and the library's coordinate convention when necessary.
Check hierarchy, page bounds, live destinations, title/heading correspondence, and intended reading order. Inspect bookmarks on headings below the page top. Reject collapsed destination sets and report any intentional nonmonotonic order. Confirm the output opens, retains page count/content, and is no longer being written before copying it back. A process log alone does not prove saved bookmarks exist.
Tool Availability And Delivery
Historical project helpers such as tlbmk.py, build_t1.py, diag.py,
verify.py, and recover_empties.py are not bundled with this skill. Use them
only if the current project supplies them; otherwise implement the required
focused processing with the available library. Do not assume private paths,
logs, worklist indices, or root variables belong to the current corpus.
Report input/output files, PDFs processed, bookmarks written and verified, skipped existing bookmarks, unresolved entries, and books without a usable TOC. Do not claim full coverage when some targets were omitted or require OCR review.
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
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.

