Skip to content

模块:格式检查

触发词: format, 格式检查, lint, style check

检查项目:

类别检查内容标准
页边距上下左右边距通常 1 英寸(2.54cm)
行间距单倍/双倍行距根据期刊要求
字体正文字体与大小Times New Roman 10-12pt
标题各级标题格式层次清晰,编号正确
图表标题位置与格式图下表上,编号连续
引用引用格式一致性数字/作者-年份格式

脚本用法:

bash
uv run python ../scripts/check_format.py main.typ
uv run python ../scripts/check_format.py main.typ --strict

Typst 格式检查要点:

typst
// 页面设置
#set page(
  paper: "a4",  // 或 "us-letter"
  margin: (x: 2.5cm, y: 2.5cm)
)

// 文本设置
#set text(
  font: "Times New Roman",
  size: 11pt,
  lang: "en"
)

// 段落设置
#set par(
  justify: true,
  leading: 0.65em,
  first-line-indent: 1.5em
)

// 标题设置
#set heading(numbering: "1.1")

常见格式问题:

  • 页边距不一致
  • 字体混用(中英文字体未分离)
  • 图表编号不连续
  • 引用格式不统一

基于 MIT 许可发布