feat(latex): 新增 LaTeX 排版系统,从 Markdown 生成 ctexbook
- 新增 officefile/latex/ 目录,包含 main.tex、preamble.tex 及 14 个章节 + 10 个附录 tex 文件 - md→tex 转换流程:pandoc 转换 + _postprocess.py 后处理(去编号、修破折号、清标签) - 修复 5 个 md 源文件的标题层级(H1→H2 降级,统一层级结构) - 配置 VS Code LaTeX Workshop(xelatex + ctexbook 编译链) - 新增 VS Code workspace 和 .gitignore(排除 LaTeX 编译产物) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import re, os
|
||||
|
||||
outdir = r'e:/Project/SI/2026_DesignAI/officefile/latex/chapters'
|
||||
total = 0
|
||||
|
||||
for fname in sorted(os.listdir(outdir)):
|
||||
if fname == 'ch13-conclusion.tex' or not fname.endswith('.tex'):
|
||||
continue
|
||||
fpath = os.path.join(outdir, fname)
|
||||
with open(fpath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
for cmd in ['section', 'subsection', 'subsubsection']:
|
||||
pattern = re.compile(r'\\' + cmd + r'\{(\d+\.[^}]+)\}')
|
||||
matches = pattern.findall(content)
|
||||
for m in matches[:3]:
|
||||
head = m[:60]
|
||||
print(f' \\{cmd}{{{head}}}')
|
||||
if len(matches) > 3:
|
||||
print(f' ... and {len(matches)-3} more \\{cmd} with numbers')
|
||||
total += len(matches)
|
||||
|
||||
print(f'\nTotal headings with numeric prefix: {total}')
|
||||
Reference in New Issue
Block a user