Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Download and parse LaTeX source files from arXiv preprints
.claude/skills/brycewang-stanford-arxiv-latex-source/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 37% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 1% | 0% |
arXiv stores the original LaTeX source files for the vast majority of its 2.4 million+ preprints. Accessing LaTeX source provides major advantages over PDF parsing: exact mathematical notation as written by the author, structured sections and labels, machine-readable bibliography entries, and intact figure captions, table data, and cross-references.
For formula extraction, citation graph construction, section-level text analysis, or training data curation for scientific language models, LaTeX source is the gold standard. PDF parsing introduces OCR errors in equations, loses structural hierarchy, and mangles complex tables.
The e-print endpoint serves source bundles as gzip-compressed tarballs (.tar.gz) containing .tex files, figures, .bib/.bbl bibliography files, style files, and supplementary materials. No authentication is required.
No authentication or API key is required. The e-print endpoint is publicly accessible. However, arXiv asks that automated tools set a descriptive User-Agent header and comply with rate limits.
GET https://arxiv.org/e-print/{arxiv_id}application/gzip — a .tar.gz archive containing the source files| Param | Type | Required | Description | |-------|------|----------|-------------| | arxiv_id | string | Yes | arXiv identifier, e.g. 2301.00001 or 2301.00001v2 for a specific version |
bash # Download source archive (response: 200, application/gzip, ~1.3 MB) curl -sL -o source.tar.gz "https://arxiv.org/e-print/2301.00001"
# List archive contents tar tz -f source.tar.gz | head -10 # ACM-Reference-Format.bbx # ACM-Reference-Format.bst # Image_1.jpg # README.txt # acmart.cls
attachment; filename="arXiv-2301.00001v1.tar.gz"sha256:f1ffe8ec...The endpoint almost always returns a gzip-compressed tar archive. Rare cases (very old or single-file submissions) may return a single gzip-compressed .tex file without tar wrapper. Always verify format before extracting:
bashcurl -sL "https://arxiv.org/e-print/{arxiv_id}" -o source.gz file source.gz # "gzip compressed data, was 'XXXX.tar', ..."
Pair source downloads with the arXiv Atom API for structured metadata:
GET https://export.arxiv.org/api/query?id_list={arxiv_id}<title>, <author>, <summary>, <category>, <published>curl -s "https://export.arxiv.org/api/query?id_list=2301.00001"A source archive typically contains multiple files. To find the main document:
\documentclass in .tex files — this marks the root documentREADME.txt that may specify the main file.tex files contain \documentclass, prefer the one with \begin{document}pythonimport tarfile, re def find_main_tex(tar_path): with tarfile.open(tar_path, 'r:gz') as tar: tex_files = [m for m in tar.getmembers() if m.name.endswith('.tex')] for member in tex_files: content = tar.extractfile(member).read().decode('utf-8', errors='ignore') if r'\documentclass' in content and r'\begin{document}' in content: return member.name, content return None, None
LaTeX sections follow a predictable hierarchy:
pythonimport re def extract_sections(tex_content): pattern = r'\\(section|subsection|subsubsection)\{([^}]+)\}' sections = re.findall(pattern, tex_content) return [(level, title) for level, title in sections] # [('section', 'Introduction'), ('section', 'Related Work'), ...]
pythondef extract_equations(tex_content): patterns = [ r'\\\[(.+?)\\\]', r'\\begin\{equation\}(.+?)\\end\{equation\}', r'\\begin\{align\*?\}(.+?)\\end\{align\*?\}', ] equations = [] for pat in patterns: equations.extend(re.findall(pat, tex_content, re.DOTALL)) return equations
Parse .bib files (BibTeX entries) or .bbl files (compiled \bibitem commands):
pythondef extract_bibliography(tar_path): refs = [] with tarfile.open(tar_path, 'r:gz') as tar: for member in tar.getmembers(): if member.name.endswith('.bib'): content = tar.extractfile(member).read().decode('utf-8', errors='ignore') refs.extend(re.findall(r'@\w+\{([^,]+),(.+?)\n\}', content, re.DOTALL)) elif member.name.endswith('.bbl'): content = tar.extractfile(member).read().decode('utf-8', errors='ignore') refs.extend(re.findall(r'\\bibitem.*?\{(.+?)\}', content)) return refs
MyTool/1.0 (mailto:user@university.edu).bib/.bbl files for exact reference keys to construct citation graphspythonimport requests, tarfile, io, re, time, gzip def download_arxiv_source(arxiv_id, delay=1.0): """Download and extract all .tex files from an arXiv paper's source.""" url = f"https://arxiv.org/e-print/{arxiv_id}" headers = {"User-Agent": "ResearchTool/1.0 (mailto:user@example.com)"} resp = requests.get(url, headers=headers) resp.raise_for_status() time.sleep(delay) buf = io.BytesIO(resp.content) try: with tarfile.open(fileobj=buf, mode='r:gz') as tar: return {m.name: tar.extractfile(m).read().decode('utf-8', errors='ignore') for m in tar.getmembers() if m.name.endswith('.tex') and m.isfile()} except tarfile.ReadError: buf.seek(0) return {"main.tex": gzip.decompress(buf.read()).decode('utf-8', errors='ignore')} # Usage sources = download_arxiv_source("2301.00001") for fname, content in sources.items(): if r'\documentclass' in content: sections = re.findall(r'\\section\{([^}]+)\}', content) equations = re.findall(r'\\begin\{equation\}(.+?)\\end\{equation\}', content, re.DOTALL) print(f"{fname}: {len(sections)} sections, {len(equations)} equations")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 35,609 | 23,956 | -33% | 1 | 1 | 0% | 5,410 | 6,497 | +20% | 0 | 0 | — |
case-02 | fail→pass | 16,053 | 9,726 | -39% | 1 | 1 | 0% | 2,997 | 3,970 | +32% | 0 | 0 | — |
case-03 | pass→pass | 22,091 | 14,364 | -35% | 1 | 1 | 0% | 3,996 | 4,794 | +20% | 0 | 0 | — |
case-04 | pass→pass | 19,465 | 19,580 | +1% | 1 | 1 | 0% | 3,127 | 5,415 | +73% | 0 | 0 | — |
case-05 | pass→pass | 17,854 | 13,624 | -24% | 1 | 1 | 0% | 3,345 | 4,689 | +40% | 0 | 0 | — |
case-06 | pass→pass | 17,547 | 11,878 | -32% | 1 | 1 | 0% | 2,877 | 4,002 | +39% | 0 | 0 | — |
case-07 | pass→pass | 17,236 | 16,373 | -5% | 1 | 1 | 0% | 2,571 | 4,753 | +85% | 0 | 0 | — |
case-08 | pass→pass | 10,442 | 8,337 | -20% | 1 | 1 | 0% | 1,795 | 3,731 | +108% | 0 | 0 | — |
case-09 | pass→pass | 18,871 | 19,447 | +3% | 1 | 1 | 0% | 3,276 | 4,909 | +50% | 0 | 0 | — |
case-10 | fail→fail | 9,919 | 6,294 | -37% | 1 | 1 | 0% | 1,562 | 3,155 | +102% | 0 | 0 | — |
case-11 | fail→pass | 10,341 | 2,776 | -73% | 1 | 1 | 0% | 1,866 | 2,586 | +39% | 0 | 0 | — |
case-17 | pass→pass | 7,424 | 6,793 | -8% | 1 | 1 | 0% | 1,496 | 3,493 | +133% | 0 | 0 | — |
case-12 | fail→pass | 11,930 | 3,545 | -70% | 1 | 1 | 0% | 1,996 | 2,726 | +37% | 0 | 0 | — |
case-13 | fail→pass | 16,318 | 3,654 | -78% | 1 | 1 | 0% | 2,747 | 2,762 | +1% | 0 | 0 | — |
case-14 | pass→pass | 14,789 | 13,340 | -10% | 1 | 1 | 0% | 2,486 | 4,465 | +80% | 0 | 0 | — |
case-15 | fail→fail | 20,293 | 13,239 | -35% | 1 | 1 | 0% | 2,687 | 4,108 | +53% | 0 | 0 | — |
case-16 | fail→pass | 12,151 | 4,898 | -60% | 1 | 1 | 0% | 2,251 | 2,967 | +32% | 0 | 0 | — |
case-18 | pass→fail | 23,772 | 12,740 | -46% | 1 | 1 | 0% | 3,690 | 4,182 | +13% | 0 | 0 | — |
case-19 | pass→pass | 16,618 | 19,355 | +16% | 1 | 1 | 0% | 2,760 | 5,451 | +98% | 0 | 0 | — |
case-20 | pass→pass | 16,456 | 16,866 | +2% | 1 | 1 | 0% | 2,666 | 5,084 | +91% | 0 | 0 | — |
case-21 | pass→pass | 13,112 | 10,943 | -17% | 1 | 1 | 0% | 2,078 | 4,087 | +97% | 0 | 0 | — |
case-22 | pass→pass | 25,805 | 29,172 | +13% | 1 | 1 | 0% | 4,721 | 6,228 | +32% | 0 | 0 | — |
case-23 | pass→pass | 11,632 | 11,944 | +3% | 1 | 1 | 0% | 2,261 | 4,440 | +96% | 0 | 0 | — |
case-24 | fail→fail | 10,714 | 8,423 | -21% | 1 | 1 | 0% | 2,107 | 3,844 | +82% | 0 | 0 | — |
case-25 | pass→pass | 8,199 | 6,852 | -16% | 1 | 1 | 0% | 1,541 | 3,431 | +123% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +20 percentage points is the difference between those two pass rates over the 25 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.