Skip to main content

transform arXiv papers into a single latex prompt for LLMs

Project description

arxiv-to-prompt

PyPI version Tests License Changelog

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

Basic usage:

# Display LaTeX source with comments
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 | pbcopy

# 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"

The arXiv ID can be found in the paper's URL. For example, for https://arxiv.org/abs/2303.08774, the ID is 2303.08774. It will automatically download the latest version of the paper, so you don't need to specify the version.

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)

Projects Using arxiv-to-prompt

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

  • arxiv-latex-mcp: MCP server that uses arxiv-to-prompt to fetch and process arXiv LaTeX sources for precise interpretation of mathematical expressions in scientific papers.
  • arxiv-tex-ui: chat with an llm about an arxiv paper by using the latex source.

If you're using arxiv-to-prompt in your project, please submit a pull request to add it to this list!

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arxiv_to_prompt-0.2.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arxiv_to_prompt-0.2.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file arxiv_to_prompt-0.2.1.tar.gz.

File metadata

  • Download URL: arxiv_to_prompt-0.2.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.16

File hashes

Hashes for arxiv_to_prompt-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4e887ec86777fdabb87575e8aa32a64766155847c70c9107783587f4e17a580c
MD5 1373f713e172cbbfb36dd2bac9a409f6
BLAKE2b-256 4ff9105b4046a907251df900c59098b34ad341c9beb2033614a4ead6f1b0e62d

See more details on using hashes here.

File details

Details for the file arxiv_to_prompt-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for arxiv_to_prompt-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a1c137b0df1af8fb110fce1660ea382ba1554fa88d4b2bdb226cc8574d7d31c
MD5 38eb231c6b6fa704aeb066fa29f9a7f2
BLAKE2b-256 555debb0edd6e09caf7b8fff7f6a3b4581fcda54162eb9c960f15d7455c5ecb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page