Skip to main content

PyPI version Tests License Changelog Downloads

A command-line tool to transform arXiv papers into a single LaTeX source that can be used as a prompt for asking LLMs questions about the paper. It downloads the source files, automatically finds the main tex file containing \documentclass, and flattens multiple files into a single coherent source by resolving \input and \include commands. The tool also provides options to remove LaTeX comments and appendix sections from the output (which can be useful to shorten the prompt).

Installation

pip install arxiv-to-prompt

Usage

# Display LaTeX source
arxiv-to-prompt 2303.08774

# Display LaTeX source without comments
arxiv-to-prompt 2303.08774 --no-comments

# Display LaTeX source without appendix sections
arxiv-to-prompt 2303.08774 --no-appendix

# Combine options (no comments and no appendix)
arxiv-to-prompt 2303.08774 --no-comments --no-appendix

# Copy to clipboard
arxiv-to-prompt 2303.08774 --copy # or -c

You can use either the arXiv ID (e.g., 2303.08774) or the full URL (e.g., https://arxiv.org/abs/2303.08774). It will automatically download the most recent version of the paper, so you don't need to specify the version (to get a specific one, append it to the ID, e.g. 2303.08774v2). Downloaded papers are cached locally, so subsequent runs for the same paper will use the cached version without re-downloading.

Advanced Options

# Force re-download even if the paper is already cached
arxiv-to-prompt 2303.08774 --force-download

# Process a local folder containing TeX files (instead of downloading from arXiv)
arxiv-to-prompt --local-folder /path/to/tex/files

# Cache locking is on by default (120s timeout); increase/decrease it if needed
arxiv-to-prompt 2303.08774 --lock-timeout 300

# List all sections (with subsections indented)
arxiv-to-prompt 2307.09288 --list-sections
# Introduction
# Pretraining
#   Pretraining Data
#   Training Details
#     Training Hardware \& Carbon Footprint
#   ...

# Extract specific sections
arxiv-to-prompt 2307.09288 --section "Introduction" --section "Pretraining"

# Ambiguous names show a helpful error
arxiv-to-prompt 2307.09288 --section "Human Evaluation"
# Warning: 'Human Evaluation' is ambiguous. Found at:
#   - Fine-tuning > RLHF Results > Human Evaluation
#   - Appendix > Additional Details for Fine-tuning > Human Evaluation
# Use path notation to disambiguate.

# Use path notation when the same name appears multiple times
arxiv-to-prompt 2307.09288 --section "Fine-tuning > RLHF Results > Human Evaluation"

# Output figure file paths instead of LaTeX text
arxiv-to-prompt 2303.08774 --figure-paths

# Figure paths from main body only (exclude appendix and commented-out figures)
arxiv-to-prompt 2303.08774 --figure-paths --no-appendix --no-comments

# Output only the abstract text
arxiv-to-prompt 2303.08774 --abstract

# Expand \newcommand and related macro definitions inline
arxiv-to-prompt 2303.08774 --expand-macros

# Get a specific version instead of the most recent one
arxiv-to-prompt 1706.03762v1

# Show what changed between two versions of a paper as a unified diff
# (use --diff-context N to change the lines of context around each change, default 3)
arxiv-to-prompt 1706.03762 --diff v6 v7

# Print token count (requires pip install 'arxiv-to-prompt[tokens]')
arxiv-to-prompt 2303.08774 --token-count
# 33332

# Combine with other flags to see how they affect token count
arxiv-to-prompt 2303.08774 --no-comments --no-appendix --token-count
# 18370

# Combine with the `llm` library from https://github.com/simonw/llm to chat about the paper
arxiv-to-prompt 1706.03762 | llm -s "explain this paper"

# Or pipe a version diff to ask what changed
arxiv-to-prompt 1706.03762 --diff v6 v7 | llm -m openrouter/openai/gpt-6.1-terra -s "what changed between these two paper versions of arXiv?"
# Example response:
#   In v7, the strikethrough was removed from all eight authors' email addresses.
#   The addresses themselves did not change. The now-unused LaTeX `ulem` package,
#   which provided the strikethrough formatting, was also removed. No changes to
#   the paper's research content appear in the provided diff.

Python API

You can also use arxiv-to-prompt in your Python code:

from arxiv_to_prompt import process_latex_source

# Get LaTeX source with comments
latex_source = process_latex_source("2303.08774")

# Get LaTeX source without comments
latex_source = process_latex_source("2303.08774", keep_comments=False)

# Get LaTeX source without appendix sections
latex_source = process_latex_source("2303.08774", remove_appendix_section=True)

# Combine options (no comments and no appendix)
latex_source = process_latex_source("2303.08774", keep_comments=False, remove_appendix_section=True)

# Force re-download even if the paper is already cached
latex_source = process_latex_source("2303.08774", use_cache=False)

# Process LaTeX sources from a local folder (instead of downloading from arXiv)
latex_source = process_latex_source(local_folder="/path/to/tex/files")

# Get resolved figure file paths instead of LaTeX text
figure_paths = process_latex_source("2303.08774", figure_paths_only=True)

# Get only the abstract text
abstract = process_latex_source("2303.08774", abstract_only=True)

# Expand custom macro definitions inline
latex_source = process_latex_source("2303.08774", expand_macros_flag=True)

# Get a unified diff between two versions of a paper
# (accepts the same text-processing options as process_latex_source)
from arxiv_to_prompt import diff_versions
diff = diff_versions("1706.03762", "v6", "v7", keep_comments=False)

# Count tokens (requires pip install 'arxiv-to-prompt[tokens]')
from arxiv_to_prompt import count_tokens
token_count = count_tokens(latex_source)

Projects Using arxiv-to-prompt

Here are some projects and use cases that leverage arxiv-to-prompt:

  • arxiv-latex-mcp: MCP server that fetch and process arXiv LaTeX sources for precise interpretation of mathematical expressions in papers.
  • arxiv-tex-ui: chat with an LLM about an arxiv paper by using the latex source.
  • paper2slides: transform an arXiv paper into slides.
  • notations-cli: extract notation tables from arXiv papers using LLMs, generating searchable HTML documentation of mathematical symbols and their definitions.
  • ArXivToPrompt: iOS app that allows users to easily extract LaTeX source from arXiv papers on their iPhone and copy it to the clipboard for use with LLM apps.
  • arxiv_recommender: recommendation system for arXiv papers.
  • ScienceClaw: a self-evolving AI research colleague for scientists.
  • ai-assistant-workspace: AI assistant workspace.

Metadata

Release files for arxiv-to-prompt 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arxiv-to-prompt 0.16.0
File Size Uploaded Provenance Actions
arxiv_to_prompt-0.16.0.tar.gz 37.3 kB With provenance Details for arxiv_to_prompt-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arxiv-to-prompt 0.16.0
File Interpreter ABI Platform Actions
arxiv_to_prompt-0.16.0-py3-none-any.whl Python 3 none any Details for arxiv_to_prompt-0.16.0-py3-none-any.whl

Total release size: 58.6 kB

Release files / arxiv_to_prompt-0.16.0.tar.gz

Download URL arxiv_to_prompt-0.16.0.tar.gz
Size 37.3 kB
Tags Source
SHA-256 checksum
How to use checksums
06193cbc02faf7219b8753275a04a3b89d64f6a753b1dd027fc8b295bc281132
BLAKE2b-256 checksum
How to use checksums
5f60ee2ca59b31f649ea048a4a8180529e2f9699bc6ae016656de4b71b1312de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / arxiv_to_prompt-0.16.0-py3-none-any.whl

Download URL arxiv_to_prompt-0.16.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b74667ea9cea82268420dd71a3d87f2dd3d4f26c8fc71b8e2b37033082aa922f
BLAKE2b-256 checksum
How to use checksums
88c3dc924a46f152ee7f38d98c5da9b16ad515025d593ed39591b5cdcc32153a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for arxiv-to-prompt 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for arxiv_to_prompt-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page