| name | paper-doc |
| description | Convert paper_draft.md + generated figures into a formatted academic .docx file. Use when user says "生成文档", "export docx", "paper doc", or after paper writing and figure generation are complete. |
| argument-hint | ["output filename or default"] |
| allowed-tools | Bash(*), Read, Write, Edit, Grep, Glob |
Skill-8: Paper Doc Export
Export the final paper as: $ARGUMENTS
Overview
This skill converts paper_draft.md (from skill-6) + generated PNG figures (from skill-7) into a properly formatted academic .docx file ready for journal submission.
What it does:
- Parses markdown into structured Word document
- Applies academic formatting (Times New Roman, 12pt, 1.5 spacing, 2.54cm margins)
- Embeds PNG figures at
[Figure N: ...] placeholders
- Formats markdown tables into Word tables with headers
- Adds section numbering, page numbers
- Formats references section
Inputs
| File | Source | Purpose |
|---|
output/papers/paper_draft.md | skill-6 | Complete paper in markdown |
output/figures/**/*.png | skill-7 | PNG figures to embed |
Output
output/papers/final_paper.docx
Workflow
Phase 1: Pre-check
- Verify
output/papers/paper_draft.md exists
- Verify
output/figures/ has PNG files
- If figures missing, warn user — docx will have placeholder text instead of images
- Check dependencies:
pip install python-docx
Phase 2: Generate .docx
Run the conversion script:
pip install python-docx
python scripts/generate_docx.py \
--input output/papers/paper_draft.md \
--output output/papers/final_paper.docx \
--figures output/figures \
--verbose
What the script handles:
# Title → centered, 16pt bold
## Section → Heading 2, 14pt bold
### Subsection → Heading 3, 13pt bold
| table | → Word table with grid, bold header row
[Figure N: desc] → embedded PNG + centered caption
**bold** → bold run
*italic* → italic run
[N] references → preserved as-is (user converts to auto-references in Word)
- Page numbers in footer
- Mermaid code blocks → skipped (figures already generated as images)
Phase 3: Reference Formatting
The [N] citation markers in paper_draft.md are preserved in the docx. After export:
- Open the .docx in Word
- Use Word's "References" → "Insert Citation" to convert
[N] markers to auto-managed references
- Or use Zotero Word plugin: select each
[N], insert matching Zotero citation
- Generate bibliography via Word/Zotero
Tip: The reference list at the end of paper_draft.md contains full metadata (DOI, journal, year) — use this to match citations in Zotero/Mendeley.
Phase 4: Post-Export Review
After generating the docx:
- Open in Word and review:
- Manual adjustments (if needed):
- Adjust figure sizes for optimal layout
- Fine-tune table column widths
- Add line numbers (if journal requires)
- Apply journal-specific template if available
Phase 5: Update plan04.md
Update task H.8 status in plan04.md.
Formatting Specifications
| Element | Format |
|---|
| Font | Times New Roman |
| Body size | 12pt |
| Heading 1 | 14pt bold |
| Heading 2 | 13pt bold |
| Heading 3 | 12pt bold |
| Line spacing | 1.5 |
| Margins | 2.54cm all sides |
| Figure width | 5.5 inches (single column) |
| Caption | 10pt italic, centered |
| Reference | 10pt |
| Page numbers | Centered footer |
Key Rules
- Figures must be PNG: skill-7 outputs SVG+XML+PNG. This skill uses the PNG versions.
- References stay as [N]: User converts to auto-citations in Word after export.
- One script, one command:
python generate_docx.py does everything.
- Review in Word: Always open and review the .docx before considering it final.
- Always update plan04.md.
Dependencies
pip install python-docx
Composing
/paper-writing → output/papers/paper_draft.md
/figure-generation → output/figures/**/*.png
/paper-doc → output/papers/final_paper.docx ← YOU ARE HERE