Files
md2word/docx_thesis/config.py
2026-05-07 21:37:06 +08:00

91 lines
5.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from dataclasses import dataclass
@dataclass
class ThesisFormat:
"""毕业论文格式配置(桂林理工大学理工类标准)。
依据《要求.txt》中第2、3节的规定。
所有尺寸单位:厘米(cm) 或 磅(pt),按字段说明为准。
"""
# ════════════════════════════════════════════
# 页面设置 (§2.2)
# ════════════════════════════════════════════
page_width: float = 21.0 # A4
page_height: float = 29.7 # A4
margin_top: float = 3.0 # 上3.0cm
margin_bottom: float = 2.5 # 下2.5cm
margin_left: float = 3.0 # 左3.0cm
margin_right: float = 2.0 # 右2.0cm
footer_distance: float = 1.5 # 页脚1.5cm
# ════════════════════════════════════════════
# 字体 (§3.1) — 理工类全文宋体
# ════════════════════════════════════════════
font_cn: str = "宋体"
font_cn_heading: str = "宋体" # 标题也用宋体(加粗区分)
font_en: str = "Times New Roman"
font_code: str = "Courier New"
font_heading_en: str = "Times New Roman"
# ════════════════════════════════════════════
# 字号(磅)(§3.2)
# ════════════════════════════════════════════
# 中文:三号=16pt 小三=15pt 四号=14pt 小四=12pt 五号=10.5pt 小五=9pt
size_abstract_title: float = 16 # 三号 — 摘要题头
size_chapter: float = 16 # 三号 — 第一层次(章)
size_section: float = 15 # 小三 — 第二层次(节)
size_subsection: float = 14 # 四号 — 第三层次(条)
size_subsubsection: float = 12 # 小四 — 第四层次(款)
size_body: float = 12 # 小四 — 正文
size_keyword_label: float = 12 # 小四 — 关键词题头
size_reference: float = 10.5 # 五号 — 参考文献条目
size_code: float = 9 # 小五 — 代码块
size_footer: float = 9 # 小五 — 页脚页码
# ════════════════════════════════════════════
# 段落间距(磅)
# ════════════════════════════════════════════
spacing_before_chapter: int = 0
spacing_after_chapter: int = 0
spacing_before_section: int = 0
spacing_after_section: int = 0
spacing_before_subsection: int = 0
spacing_after_subsection: int = 0
# ════════════════════════════════════════════
# 行距 (§2.2) — 单倍行距
# ════════════════════════════════════════════
line_spacing_body: float = 1.0
line_spacing_heading: float = 1.0
line_spacing_reference: float = 1.0
line_spacing_code: float = 1.0
# ════════════════════════════════════════════
# 缩进
# ════════════════════════════════════════════
first_line_indent_chars: int = 2 # 正文首行缩进2字符
# ════════════════════════════════════════════
# 文档网格 (§2.2) — 每页32行×每行42字
# ════════════════════════════════════════════
grid_chars_per_line: int = 42
grid_lines_per_page: int = 32
# ════════════════════════════════════════════
# 章节标题文字识别
# ════════════════════════════════════════════
abstract_title_cn: str = "摘 要"
abstract_title_en: str = "Abstract"
toc_title: str = "目 次"
acknowledgement_title: str = "致谢"
references_title: str = "参考文献"
appendix_title: str = "附录"
# ════════════════════════════════════════════
# 摘要关键词标记
# ════════════════════════════════════════════
keywords_label_cn: str = "关键词:"
keywords_label_en: str = "Key words:"