Use when translating an English academic paper with LaTeX sources into Chinese and preserving compilability, structure, and reviewability matters.
Use this skill to normalize one paper into its own folder, translate the LaTeX source into Chinese, preserve compilability, check for missed English text, and rebuild the Chinese PDF with XeLaTeX.
Read references/translation-rules.md before editing any translated file.
Dependency guidance:
scripts/ require Python 3.10+ and use only the Python standard librarypyyamlpdfplumber, pypdf, or reportlabxelatexbibtex or biberNotes:
xelatex is missing, stop and report the missing TeX dependency instead of pretending the paper is fully verifiedKeep one paper per subfolder under the user's paper/ directory.
Input staging is allowed:
paper/Preferred layout:
paper/
<paper-slug>/
README.md
<paper-slug>_en.pdf
<paper-slug>_cn.pdf
<source-dir>/
<source-dir>_cn/
Rules:
llm-agent-survey-2503-21460v1.<paper-slug>_en.pdf and <paper-slug>_cn.pdf.<source-dir>/.<source-dir>_cn/.paper/ root should mainly contain shared folders plus one subfolder per paper, not duplicate loose PDFs or loose source trees for papers that have already been organized.README.md in Chinese with: paper title, one-paragraph summary, main contributions, method sketch, tags, and a short file map.First inspect the user's paper/ directory and identify which items belong to the target paper:
2503.21460v1.pdfarXiv-2503.21460v1/If the paper is not yet normalized:
<paper-slug>/<paper-slug>/<paper-slug>_en.pdf<paper-slug>/<source-dir>/Prefer moving over copying when the loose root-level items are clearly just staging inputs for this paper and are not referenced elsewhere by the user. If there is any doubt, keep the source, finish the translation, then ask before deleting ambiguous leftovers.
Run:
python3 scripts/collect_tex_tree.py /path/to/paper/<source-dir>
Use the output to identify:
.tex entrypointIf there are multiple main-file candidates, prefer the one that contains the complete paper body and bibliography.
Copy the English source directory to a sibling _cn directory before translating. Make all translation edits only inside the _cn tree.
Preserve these items unless compilation forces a minimal localized change:
If Chinese support is missing, patch only the translated copy's preamble to keep XeLaTeX compilation working. Do not rewrite unrelated formatting.
Preferred Chinese compilation strategy:
ctex with fontset=noneSource Han Serif SC, Noto Serif CJK SC, or Songti SCHiragino Sans GB or Noto Sans CJK SCRecommended visual combination for a polished Chinese translation:
newtxtext,newtxmath or another Times-like familySource Han Serif SC, Noto Serif CJK SC, or Songti SCHiragino Sans GBNoto Sans Mono CJK SC22pt to 26pt10pt1.02 to 1.05Recommended preamble patch template for translated copies:
\usepackage{newtxtext,newtxmath}
\usepackage[UTF8,fontset=none]{ctex}
% Prefer installed font family names first.
% If family lookup fails, replace these with explicit Path/Extension options
% that match fonts available on the current system.
\setCJKmainfont{Source Han Serif SC}
\setCJKsansfont{Source Han Serif SC}
\setCJKmonofont{Noto Sans Mono CJK SC}
\linespread{1.03}
Fontspec/XeCJK troubleshooting:
fc-list shows a font but XeLaTeX still says the font cannot be found, do not trust the family alias alone. Prefer Path=..., Extension=..., and the font basename.fontspec option lists, every key-value pair must be comma-separated. Missing commas often surface as a misleading “Misplaced '=' in key-value input” error.ctex auto-detects a problematic macOS fontset, switch to fontset=none and set CJK fonts explicitly.BoldFont or use AutoFakeBold for the CJK family.\setCJK... commands into section files.If the document class or template already has fragile paragraph-opening effects, disable them in the translated copy when they break Chinese layout. Example: \IEEEPARstart often looks wrong for Chinese first paragraphs and may need to be replaced with a normal paragraph opening.
When the paper is large, use multiple subagents in parallel.
Default threshold:
.tex content files, orParallelization rules:
Suggested split:
Apply the rules in references/translation-rules.md.
Minimum expectations:
Prefer natural Chinese academic prose over literal word-for-word rendering, but do not add or remove substantive claims.
Do not redraw or OCR-translate text embedded inside figures or screenshots unless the user explicitly asks for image editing. If an image contains English labels, leave the image unchanged and translate only the surrounding caption when useful.
After translation, review the _cn tree manually and with the helper script:
python3 scripts/check_translation_gaps.py /path/to/paper/<source-dir>_cn
Use the script output as a suspicion list, not as an oracle. Manually inspect any reported line before editing.
Review checklist:
Run:
python3 scripts/build_xelatex.py /path/to/paper/<source-dir>_cn
The script should auto-detect the main file, run the required XeLaTeX passes, and print the generated PDF path.
If the build fails:
If the PDF renders but layout looks suspicious, inspect the output visually and, when helpful, use the pdf skill to rasterize or spot-check pages.
Before finishing, verify that the paper now lives entirely inside its dedicated subfolder.
Cleanup rules:
docs/paper/ for the same paper unless the user explicitly wants to keep the staging copies.DS_StoreDefault expectation after cleanup:
paper/
docs/
<paper-slug>/
plus any other already organized paper folders.
Before finishing, provide:
paper/ root was normalized and whether any loose intake files were removed or retainedDo not claim completion until the translated PDF has been rebuilt successfully or you have clearly reported the blocking compile error.