From 1323f6144f0a34165f8f67c7ce3a8144de97b4ef Mon Sep 17 00:00:00 2001 From: NFC666 <2954834129@qq.com> Date: Tue, 27 Oct 2026 17:18:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=A8=A1=E6=8B=9F=E5=8D=B7):=20=E9=A2=9814?= =?UTF-8?q?=20=E7=9A=84=E7=A9=BA=E4=BD=8D=E5=86=99=E5=9C=A8=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E5=86=85=E5=AF=BC=E8=87=B4=E6=95=B4=E5=9D=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户报:$$\oint_L(2xy+\sin y)dx+(x^2+x\cos y+x)dy= ______\ .$$ 渲染失败。 根因:______ 写在 $$…$$ 的数学模式里。数学模式下 _ 是下标运算符, ______ 等于连续六个空下标,KaTeX 抛 Expected group after '_', 整个块被放弃、网页端显示成源码。同卷其它填空题的空位都在公式外, 所以只有这一处坏。 改法:公式块只放积分本体,空位回到正文—— …则曲线积分 $$\oint_L(2xy+\sin y)\,dx+(x^2+x\cos y+x)\,dy$$ 的值为 ______ 。 (答案 2π 不变,02a 解析无需改。) 工具:fix_gitea_math.py 新增 scan_math_underscore(),扫描公式内的连续下划线 并作为「提示」单独输出,不纳入 --apply(改法取决于题意,不能自动修)。 全库基于考研的学习 扫一遍:0 处同类问题。 校验:check_md_links 8 文件 100 链接 0 异常;fix_gitea_math 0 处待修。 --- .workbuddy/tools/md2pdf/fix_gitea_math.py | 25 +++++++++++++++++++ .../模拟卷/第一次模拟-数学一/01-模拟卷.md | 6 +++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.workbuddy/tools/md2pdf/fix_gitea_math.py b/.workbuddy/tools/md2pdf/fix_gitea_math.py index eb8fd4e..21a5a02 100644 --- a/.workbuddy/tools/md2pdf/fix_gitea_math.py +++ b/.workbuddy/tools/md2pdf/fix_gitea_math.py @@ -274,6 +274,21 @@ def fix_frontmatter(text): return '\n'.join(lines) + tail, hits +def scan_math_underscore(text): + """公式内部写 ``______`` 会被 KaTeX 当成连续空下标,抛 + ``Expected group after '_'`` 导致整块渲染失败(网页端显示成源码)。 + + 改法取决于题目意图(改成 ``\\underline{\\quad}`` 、或把空位挪到公式外), + 无法自动修,因此只报告、不纳入 ``--apply`` 。""" + base = mask_code(text) + hits = [] + for a, b in find_math_any(base): + seg = text[a:b + 1] + if '__' in seg.replace('\\_', ''): + hits.append((text.count('\n', 0, a) + 1, seg.replace('\n', ' ')[:90])) + return hits + + def main(): apply = '--apply' in sys.argv scope = None @@ -283,8 +298,11 @@ def main(): total_files = total_hits = 0 report = [] + warn = [] for path in sorted(iter_md_files(scope)): raw = open(path, encoding='utf-8').read() + for ln, seg in scan_math_underscore(raw): + warn.append((os.path.relpath(path, ROOT), ln, seg)) new, changes = fix_text(raw) new2, fm_hits = fix_frontmatter(new) if fm_hits: @@ -301,6 +319,13 @@ def main(): for rel, cnt in report: print(f' {cnt:4d} {rel}') print(f'--- 共 {total_files} 个文件,{total_hits} 处需要修 ---') + if warn: + print() + print('== 提示:公式内连续下划线(KaTeX 会整块渲染失败,需手工改)==') + for rel, ln, seg in warn: + print(f' L{ln:<5d}{rel}') + print(f' {seg}') + print(f'--- 共 {len(warn)} 处,请把空位挪到公式外或改用 \\underline{{\\quad}} ---') if __name__ == '__main__': diff --git a/基于考研的学习/数学一/模拟卷/第一次模拟-数学一/01-模拟卷.md b/基于考研的学习/数学一/模拟卷/第一次模拟-数学一/01-模拟卷.md index f57ba43..c0f766a 100644 --- a/基于考研的学习/数学一/模拟卷/第一次模拟-数学一/01-模拟卷.md +++ b/基于考研的学习/数学一/模拟卷/第一次模拟-数学一/01-模拟卷.md @@ -140,9 +140,11 @@ $$H_0:\mu=\mu_0,\qquad H_1:\mu>\mu_0,$$ > **考点** · [H07 方向导数与梯度](03-考点手册-高等数学.md#user-content-h07-方向导数与梯度) -**14.** 设 $L$ 为椭圆 $\dfrac{x^2}{4}+y^2=1$ 取逆时针方向,则 +**14.** 设 $L$ 为椭圆 $\dfrac{x^2}{4}+y^2=1$ 取逆时针方向,则曲线积分 -$$\oint_L(2xy+\sin y)\,\mathrm{d}x+(x^2+x\cos y+x)\,\mathrm{d}y= ______\ .$$ +$$\oint_L(2xy+\sin y)\,\mathrm{d}x+(x^2+x\cos y+x)\,\mathrm{d}y$$ + +的值为 ______ 。 > **考点** · [H08 格林公式与曲线积分](03-考点手册-高等数学.md#user-content-h08-格林公式与曲线积分)