chore(latex): 清理临时文件,figures 加入 gitignore
删除 content_raw.tex、_test_ch04.tex、_check_jumps.py、_check_nums.py 将 officefile/latex/figures/ 加入 .gitignore Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,28 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
outdir = os.path.join(os.path.dirname(__file__), 'chapters')
|
|
||||||
for fname in sorted(os.listdir(outdir)):
|
|
||||||
if not fname.endswith('.tex'):
|
|
||||||
continue
|
|
||||||
fpath = os.path.join(outdir, fname)
|
|
||||||
with open(fpath, 'r', encoding='utf-8') as fh:
|
|
||||||
content = fh.read()
|
|
||||||
lines = content.split('\n')
|
|
||||||
prev_cmd = ''
|
|
||||||
prev_title = ''
|
|
||||||
for i, line in enumerate(lines):
|
|
||||||
s = line.strip()
|
|
||||||
matched = None
|
|
||||||
for cmd in ['\\chapter{', '\\section{', '\\subsection{', '\\subsubsection{']:
|
|
||||||
if s.startswith(cmd):
|
|
||||||
matched = cmd
|
|
||||||
break
|
|
||||||
if matched:
|
|
||||||
# Check for level jumps (skip of 1 or more intermediate levels)
|
|
||||||
levels = {'\\chapter{': 0, '\\section{': 1, '\\subsection{': 2, '\\subsubsection{': 3}
|
|
||||||
if prev_cmd and matched in levels and prev_cmd in levels:
|
|
||||||
jump = levels[matched] - levels[prev_cmd]
|
|
||||||
if jump > 1:
|
|
||||||
title = s[len(matched):-1]
|
|
||||||
print(f'{fname}:{i+1}: {prev_cmd.replace("{","")} -> {matched.replace("{","")} ({jump} levels): {title[:60]}')
|
|
||||||
prev_cmd = matched
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
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