| name | sdu-thesis-formatter |
| description | This skill should be used when the user needs to format a Word (.docx) thesis document according to the Shandong University undergraduate graduation thesis (design) writing standards. Triggers include requests like "按山大论文格式修改", "格式不对帮我改一下", "套用毕业论文模板", or any mention of 山东大学毕业论文格式/本科毕设格式排版. The skill handles page margins, heading styles, body text indentation, header/footer, abstract, and references formatting automatically via a Python script.
|
SDU Thesis Formatter
Automatically reformat a Word (.docx) file to comply with the Shandong University
Undergraduate Graduation Thesis (Design) writing standards (山东大学本科毕业论文撰写规范).
When to Use
Load this skill whenever a user asks to:
- Format or reformat a graduation thesis / 毕业论文 for Shandong University
- Apply the official SDU thesis template style to a .docx document
- Fix heading levels, margins, line spacing, or indentation in a thesis document
- Batch-correct font sizes, paragraph spacing, header text, or reference section formatting
Workflow
Step 1 — Identify the target file
Confirm the path to the .docx file that needs formatting. Ask the user if not provided.
Step 2 — Run the formatter script
Execute scripts/format_thesis.py with the input file path.
The script produces a new file with _格式修改版 appended to the filename.
python scripts/format_thesis.py <input.docx> [output.docx]
input.docx — Path to the original thesis file
output.docx — (Optional) Explicit output path; defaults to <input stem>_格式修改版.docx
Step 3 — Verify key formatting points
After the script runs, confirm the following manually or by re-reading the document XML:
| Item | Target value |
|---|
| Page margins | Top/Bottom 2.5 cm · Left/Right 3.0 cm |
| Body font | 宋体 12pt (小四) |
| Line spacing | 1.5× for body & headings |
| Heading 1 | 黑体 三号 (16pt), centered, bold, para-before 0.8行, para-after 0.5行 |
| Heading 2 | 黑体 四号 (14pt), bold, para-before/after 0.5行 |
| Heading 3 | 黑体 小四 (12pt), bold |
| First-line indent | 480 DXA (2 characters) for all body paragraphs |
| Page header | "山东大学本科毕业论文(设计)" · 小五宋体 · centered |
| Reference title | 黑体 小二 (18pt), bold, centered, no indent |
| Reference body | Single line spacing |
| Abstract heading | "摘要" bold |
Step 4 — Deliver the formatted file
Send the _格式修改版.docx output file to the user.
Summarize what was changed and note anything that may need manual review (e.g., figure captions, tables, special characters).
Important Notes
- The script relies on direct OOXML (
lxml) manipulation; ensure lxml is installed.
python-docx is optional and can be used to generate test documents.
- Some styles (e.g., custom named styles not matching
Heading 1/2/3 or Normal) may need manual adjustment after running.
- For complex documents with multi-level numbering or embedded objects, prompt the user to do a visual spot-check in Word after formatting.
- Detailed format specifications are in
references/sdu-thesis-format.md.
Dependencies
lxml>=4.9.0
Optional:
python-docx>=1.1.0
Install with:
pip install lxml