exam-zh编译未通过

发布于 2025-04-15 08:49:38

这是报错截图

b1ca5c6346a9cc350a86fc889956c6d9.png

代码文件demo.tex

.cls文件 USTBExam.cls

查看更多

关注者
0
被浏览
112
1 个回答
Sagittarius Rover
Sagittarius Rover 20小时前
我要成为Typst糕手/(ㄒoㄒ)/~~

TL25中直接使用latexmk -pdfxe编译确实会出现:

! LaTeX Error: The key 'exam-zh/solution/show-answer' is unknown and is being
(LaTeX)        ignored.

For immediate help type H <return>.
 ...

l.241 }

向上溯源,这个问题报错显然是因为Tl25自带的v0.2.5exam-zh不认识这个key...

USTBexam.cls中,此处写死solution/show-answer = true,,是没有考虑到exam-zh后来的可能更新的...:

% Line 211
\examsetup{
  page = {
    foot-content = {
      \l_ustbexam_title_tl \, 第~\thepage~页 \quad 共~\lastpage@lastpage~页
    },
  },
  sealline = {
    show        = true,
    scope       = mod-2,
    circle-show = false,
    line-type   = dotted,
    odd-info-content = {{装},{订},{线},{内},{不},{要},{答},{题}},

    odd-info-xshift = 12mm,
    text = {自觉遵守考试规则,诚信考试,绝不作弊},% \\装订线内不要答题},
    text-direction-vertical = true,
    text-width = 0.6\textheight,
    text-format  = \normalfont,
    text-xshift = 20mm
  },
  scoringbox/type = onecolumn,
  symbols/change-frac-style = true,
  symbols/change-dfrac-style = true,
  solution/blank-type = hide,
  solution/show-answer = true,
  solution/label-content = 解,
  question/show-answer = true,
  problem/show-answer = true,
  paren/show-answer = true,
  fillin/show-answer = true,
}

进一步回溯,我们发现OP上传的文件信息为:

\ProvidesExplClass {USTBExam} {2022-11-04} {v2.0} {An exam template for USTB}

image.png

开发者在写该.cls此时大概率使用的是TL23自带的v0.1.20前后的版本,我们进一步查看其文档:

由于我没找到v0.1.20.pdf下载链接,用[0.1.23] - 2022-12-20代替: https://gitee.com/xkwxdyy/exam-zh/releases/download/v0.1.24/exam-zh-doc.pdf

在0.2.0版本之前的文档:
image.png

现在TL25时对应0.2.5的文档:
image.png

对于solution/show-answer这一键值对已经发生了更新...这也是为什么报错的原因。

要想解决这一问题,请保持版本依赖的颗粒度对齐

Remarks:

  • 这仅仅是其中一个错误,USTBExam.cls还有多少mismatch...我不知道,我也没有改的任何动机
  • 不再建议使用exam-zhv0.1.x版本,这是USTBExam.cls没有及时随着exam-zh更新的问题,理论上,USTBExam-v2.0从如今来看已经obsoleted,不应该再被使用
  • latexstudio推文的作用是仅仅是做介绍,在2025年下载2023年的推文附件,是有很大的风险的,尤其是上游exam-zh发生了从v0.1v0.2破坏性更新,由此产生的版本错配问题自然由下载者负责...
  • 还发现USTBExam.cls已经更新到v2.3 https://github.com/htharoldht/USTBExam/releases/tag/v2.3.0 你可以自行测试关注下是否已经修复,关于模板问题,请向开发者提issues
  • 关于你在tag中提到的『师生两版』,与本问题无关,建议开新的问题
  • ❗❗❗❗❗标签不要写一大堆东西,简要的宏包或者模板名即可...(我已经第N次提醒) 好好看看正常的tag要怎么写....

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览