From b8b985c4fe1fde3f668a61cdf854955e1df92678 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Mon, 15 Apr 2024 17:01:31 +0800 Subject: [PATCH] Refine handling of student-id option, fix #945 Signed-off-by: Shengqi Chen --- CHANGELOG.md | 4 ++++ thuthesis.dtx | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9864c944..d2421a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ ## [Unreleased] +### Changed + +- 更新 `student-id` 选项的处理逻辑,非 `proposal` 类型默认忽略,并增加警告([#945](https://github.com/tuna/thuthesis/issues/945)) + ## [v7.5.0] - 2024-03-29 ### Added diff --git a/thuthesis.dtx b/thuthesis.dtx index e45eefe9..d6abb8ad 100644 --- a/thuthesis.dtx +++ b/thuthesis.dtx @@ -4586,14 +4586,15 @@ \restoregeometry } \newcommand\thu@set@student@id{% - \ifthu@thesis@type@proposal - \ifx\thu@student@id\@empty - \thusetup{student-id=2000310000}% + \ifthu@thesis@type@proposal\else + \ifx\thu@student@id\@empty\else + \thu@warning{`studen-id' in "\protect\thusetup" would be ignored when `thesis-type' is not proposal.}% \fi \fi } \thu@set@student@id \thu@option@hook{thesis-type}{\thu@set@student@id} +\thu@option@hook{student-id}{\thu@set@student@id} % \end{macrocode} % % 涉密信息 @@ -4658,7 +4659,13 @@ \thu@info@item{工程领域}{}{\thu@engineering@field}% \thu@info@item{申请人}{\thu@name@title}{\thu@author}% \fi - \thu@info@item{学号}{}{\thu@student@id}% + \ifthu@thesis@type@proposal + \ifx\thu@student@id\@empty + \thu@warning{Missing option `student-id' in "\protect\thusetup", ID will not appear on cover.} + \else + \thu@info@item{学号}{}{\thu@student@id}% + \fi + \fi \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}% \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}% \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}%