Prompt file imported from simwai/perplexity-prompts (
.claude/commands/arxiv-paper.md). Fill in{{arguments}}before use. Copyright stays with the author.
Generate a complete LaTeX paper formatted for arXiv and compile it to PDF.
Parse {{arguments}}:
- If an arXiv ID or URL is provided, use it as the zero-shot reference paper.
- Otherwise, discover candidate reference papers automatically.
1) Understand the project
Read the project files and extract:
- Problem statement
- Methodology
- Experiments / results
- Concrete contributions
Use these files:
README.mdCHANGELOG.mddocs/*.mdpackage.json
2) Reference paper mode
A) Provided reference
If the user supplied an arXiv ID or URL:
- Fetch metadata via the arXiv public API:
https://export.arxiv.org/api/query?id_list=<id> - Extract title, authors, abstract, and categories
- Use the reference paper's abstract as a style and structure guide for the new paper
B) Auto-discovered reference
If no reference was provided:
- Extract topic keywords from the project files
- Query OpenAlex for candidate works with exponential backoff:
- Initial request:
https://api.openalex.org/works?search=<keywords>&per-page=10&select=title,publication_year,cited_by_count,concepts - On 429/5xx: wait 2s, 4s, 8s (max 3 retries), then treat as rate-limited
- Initial request:
- Rank successful results by
cited_by_countand filter for papers whose titles/abstracts suggest tutorial/survey/foundational exposition - Pick the top candidate and fetch its full metadata from arXiv if available
- If OpenAlex is rate-limited after retries or returns no results, fall back to arXiv search:
https://export.arxiv.org/api/query?search_query=all:<keywords>&max_results=10&sortBy=submittedDate; client-side sort the results by citation count if available - Use the selected paper as the style/structure reference
3) LaTeX generation
Create a complete, compilable LaTeX document using prompt-system/templates/arxiv-paper.tex.
Requirements:
- Title, authors, date, abstract
- Sections: Introduction, Related Work, Methodology, Experiments, Results, Conclusion
- Bibliography setup
- Clear, beginner-friendly technical language
- Structure and tone informed by the reference paper's abstract
Do not fabricate experimental data. If data is missing, write the section honestly and mark gaps with [TODO: ...].
4) PDF compilation
Run prompt-system/scripts/build-arxiv-pdf.ps1 -TexPath <path-to-generated-tex>.
If LaTeX is not installed, output the .tex file path and instruct the user to compile manually.
5) Output
Present:
- Reference paper used and why it was selected
- Generated
.texfile path - PDF path if compilation succeeded
- Any gaps marked
[TODO: ...]
Do not submit to arXiv. This command only produces the paper locally.