Format academic manuscripts to match a target journal's style. Use when users provide a sample paper (范文) from a journal and want their manuscript reformatted to match. Supports Word (.docx) and LaTeX (.tex) input/output. Covers Chinese and English journals. Handles title/abstract formatting, heading styles, body text font/size/spacing, figure/table captions, reference/bibliography style, page layout (margins, columns, headers/footers), footnotes, and section numbering.
Reformat an academic manuscript to match the style of a target journal, based on a sample paper (范文).
Ask the user for:
.docx or .tex..docx, .tex, or plain text..docx or .tex (default: same as manuscript format).If sample is .docx:
Run the analysis script:
pip install python-docx 2>/dev/null
python ~/.claude/skills/paper-formatter/scripts/analyze_docx.py "<sample.docx>" "<output_rules.json>"
This extracts:
If sample is .tex:
Read the .tex file and extract style information from the preamble:
\documentclass options (font size, paper, columns)\usepackage{geometry} marginsfontspec, xeCJK, ctex)\usepackage{setspace} line spacing\titleformat / \titlesec heading stylesnatbib, biblatex) and style\fancyhdr header/footer settingsProduce a JSON style-rules object with the same structure as the docx analyzer output.
Show the user a summary of extracted formatting rules organized by the checklist in references/formatting-elements.md:
Ask the user to confirm or adjust any rules before proceeding.
Read the user's manuscript and extract structured content:
{
"title": "...",
"authors": ["..."],
"affiliations": ["..."],
"abstract": "...",
"keywords": ["..."],
"sections": [
{
"heading": "Introduction",
"level": 1,
"content": ["paragraph1...", "paragraph2..."],
"subsections": [...]
}
],
"references": ["[1] ...", "[2] ..."],
"acknowledgments": "...",
"footnotes": ["..."]
}
For .docx manuscripts: use python-docx to read paragraphs, classify by style (similar to analyze_docx.py logic).
For .tex manuscripts: parse section commands (\section, \subsection), extract text between them, identify \begin{abstract}, \bibliography, etc.
For plain text: ask the user to identify sections or use heuristic detection (numbered headings, "Abstract:", "References" headers).
If output is .docx:
Save the structured content to a temporary JSON file, then run:
python ~/.claude/skills/paper-formatter/scripts/format_docx.py "<content.json>" "<style_rules.json>" "<output.docx>"
If output is .tex:
python ~/.claude/skills/paper-formatter/scripts/generate_latex.py "<content.json>" "<style_rules.json>" "<output.tex>"
After generating the output:
ctexart document class for LaTeX outputRefer to references/common-citation-styles.md for detailed formatting rules for:
Refer to references/formatting-elements.md for the complete list of formatting elements to check and apply.
python-docx: Required for .docx analysis and generation. Install with pip install python-docx.ctex, xeCJK packages and appropriate Chinese fonts installed.