arXiv論文のURLまたはIDを渡すとTeXソースをダウンロードし、図(Figure)・表(Table)のキャプション情報と画像ファイルを抽出する。arXivのURL(abs/pdf/html形式)やarXiv IDに対応。ユーザーが「arXivの論文から図を抽出して」「この論文のFigureを取り出して」「arxivペーパーの図表情報を取得して」「論文の図表を取得して」と言った場合に使用。arXiv URLや論文IDが含まれる場合にトリガーされる。
arXiv論文のTeXソースから図(Figure)と表(Table)のキャプション情報と画像ファイルを抽出するスキル。
uv run ~/.claude/skills/arxiv-figure-extractor/scripts/extract_figures.py <arxiv-url-or-id> <output-dir>
# abs URL
uv run ~/.claude/skills/arxiv-figure-extractor/scripts/extract_figures.py https://arxiv.org/abs/2301.12345 ./output
# arXiv IDのみ
uv run ~/.claude/skills/arxiv-figure-extractor/scripts/extract_figures.py 2301.12345 ./output
# PDFのみを使う(TeXソースが利用できない場合)
uv run --with pymupdf ~/.claude/skills/arxiv-figure-extractor/scripts/extract_figures.py 2301.12345 ./output --pdf-only
https://arxiv.org/e-print/<arxiv_id> からTeXソース (tar.gz) をダウンロード.texファイルを特定\input / \include を再帰的に展開して全ソースを収集\begin{figure}...\end{figure} 環境を解析
\caption{...} からキャプションを抽出\label{...} からラベルを抽出\includegraphics{...} から画像ファイルパスを解析・コピー\begin{table}...\end{table} 環境のキャプションを抽出TeXソースが入手できない場合、PDFからキャプションテキストのみを抽出(画像なし)。
PyMuPDFが必要: uv run --with pymupdf ... --pdf-only
output-dir/
├── figures_summary.json # 抽出結果のサマリー
└── images/ # 抽出された画像ファイル(TeXソース利用時のみ)
├── figure_01_overview.pdf
├── figure_02_results.png
└── ...
{
"source": "tex",
"total_figures": 5,
"total_tables": 2,
"items": [
{
"kind": "figure",
"number": 1,
"label": "fig:overview",
"caption": "Overview of our proposed method.",
"image_files": ["images/figure_01_overview.pdf"]
},
{
"kind": "table",
"number": 1,
"label": "tab:results",
"caption": "Results on benchmark datasets.",
"image_files": []
}
]
}
extract_figures.py - メインスクリプト。外部依存なしで uv run で実行可能(PDFフォールバック時は --with pymupdf が必要)