Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NJUThesis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NJU LUG
NJU LaTeX Templates
NJUThesis
Commits
d3f2148c
Commit
d3f2148c
authored
1 year ago
by
atXY
Browse files
Options
Downloads
Patches
Plain Diff
feat: 新增定理类环境共享计数器选项 (#206,#207)
parent
736c8d54
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+10
-0
10 additions, 0 deletions
CHANGELOG.md
docs/njuthesis-setup.def
+8
-7
8 additions, 7 deletions
docs/njuthesis-setup.def
source/njuthesis.dtx
+62
-20
62 additions, 20 deletions
source/njuthesis.dtx
with
80 additions
and
27 deletions
CHANGELOG.md
+
10
−
0
View file @
d3f2148c
...
...
@@ -6,6 +6,14 @@
## [未发布]
### 新增
-
新增定理类环境共享计数器选项
`theorem/share-counter`
- [#207]
### 修复
-
修复批量创建环境时缺少
`\crefname`
的问题 - [#206]
## [1.2.1] - 2023-05-03
### 修复
...
...
@@ -547,6 +555,8 @@
[
#200
]:
https://github.com/nju-lug/NJUThesis/discussions/200
[
#202
]:
https://github.com/nju-lug/NJUThesis/discussions/202
[
#204
]:
https://github.com/nju-lug/NJUThesis/issues/204
[
#206
]:
https://github.com/nju-lug/NJUThesis/issues/206
[
#207
]:
https://github.com/nju-lug/NJUThesis/issues/207
[
更新日志
]:
https://keepachangelog.com/zh-CN/1.0.0/
[
语义化版本
]:
https://semver.org/lang/zh-CN/
...
...
This diff is collapsed.
Click to expand it.
docs/njuthesis-setup.def
+
8
−
7
View file @
d3f2148c
% njuthesis 参数设置文件 v1.
2.1
2023-05-0
3
% njuthesis 参数设置文件 v1.
3.0
2023-05-0
7
% 一些提醒:
% 1. \njusetup 内部千万不要有空行
...
...
@@ -214,12 +214,13 @@
% define,
% 默认创建内置的七种定理环境
%
% style = remark,
% header-font = \sffamily \bfseries,
% body-font = \normalfont,
% qed-symbol = \ensuremath { \male },
% counter = section,
% type = {...}
% style = remark,
% header-font = \sffamily \bfseries,
% body-font = \normalfont,
% qed-symbol = \ensuremath { \male },
% counter = section,
% share-counter = true,
% type = {...}
% 以上设置项在重新调用 theorem/define 后生效
}
...
...
This diff is collapsed.
Click to expand it.
source/njuthesis.dtx
+
62
−
20
View file @
d3f2148c
...
...
@@ -109,7 +109,7 @@ To produce the documentation run the original source files ending with
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<*!(driver|install)>
%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.
2.1
2023-05-0
3
1
3:3
0:00
%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.
3.0
2023-05-0
7
1
9:0
0:00
%<+!driver> +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$
%<class> {Thesis template for Nanjing University}
%<class>\ProvidesExplClass{njuthesis}
...
...
@@ -380,7 +380,7 @@ To produce the documentation run the original source files ending with
% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn}
% {git+nju-lug-email-3104-issue-@yaoge123.cn}}}
%
% \date{v1.
2.1
\quad 2023-05-0
3
}
% \date{v1.
3.0
\quad 2023-05-0
7
}
%
% \maketitle
%
...
...
@@ -1870,16 +1870,24 @@ To produce the documentation run the original source files ending with
% 定理计数器范围。
% \end{function}
%
% \begin{function}[added=2023-05-07]{theorem/share-counter}
% \begin{syntax}
% \OPT{share-counter} = <\TFF>
% \end{syntax}
% 是否共享计数器。
% \end{function}
%
% 模板的默认设置等效于
%
% \begin{latexexample}[moretexcs={\njusetup,\bfseries,\itshape,\mdlgwhtsquare},
% emph={[2]theorem},emph={[3]style,header-font,body-font,qed-symbol,counter}]
% \njusetup[theorem]{
% style = plain,
% header-font = \normalfont \bfseries ,
% body-font = \itshape ,
% qed-symbol = \ensuremath { \mdlgwhtsquare },
% counter = chapter
% style = plain,
% header-font = \normalfont \bfseries ,
% body-font = \itshape ,
% qed-symbol = \ensuremath { \mdlgwhtsquare },
% counter = chapter,
% share-counter = false
% }
% \end{latexexample}
%
...
...
@@ -1926,12 +1934,14 @@ To produce the documentation run the original source files ending with
% \opt{theorem/type} 保存的列表以及前方的样式设置并创建相应环境。
% 这也就意味着该选项在 \opt{theorem/type} 为空时会报错。
%
% 在下面这个例子中,我们先创建了预置的七种环境,随后将定理内部文字字体改为
% 在下面这个例子中,我们先创建了预置的七种环境。除了无编号的
% \env{proof},其余六种共用一个计数器。随后我们将定理内部文字字体改为
% 宋体,定义了 \env{exercise} 和 \env{solution} 两种定理环境,后者没有编号。
%
% \begin{latexexample}[moretexcs={\njusetup,\normalfont},
% emph={[2]theorem},emph={[3]define,body-font,type}]
% \njusetup[theorem]{
% share-counter = true ,
% define ,
% body-font = \normalfont ,
% type = {
...
...
@@ -6143,6 +6153,13 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l_@@_thm_share_tl}
% 存储共享的计数器名称。
% \begin{macrocode}
\tl_new:N \l_@@_thm_share_tl
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\keys_define:nn { nju / theorem }
{
...
...
@@ -6185,6 +6202,15 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{theorem/share-counter}
% \changes{v1.3}{2023/05/07}{批量创建定理类环境时可以共享计数器。}
% 是否在分组内使用同一计数器。
% \begin{macrocode}
share-counter .bool_set:N = \l_@@_thm_share_bool,
share-counter .initial:n = false,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{theorem/define}
% 创建定理类环境。
% \begin{macrocode}
...
...
@@ -6193,21 +6219,22 @@ To produce the documentation run the original source files ending with
{
\clist_if_empty:NT \g_@@_thm_type_clist
{ \msg_error:nn { njuthesis } { empty-theorem-type } }
\tl_clear:N \l_@@_thm_share_tl
\clist_map_inline:Nn \g_@@_thm_type_clist
{ \@@_thm_define:nn ##1 }
{ \@@_thm_define:
N
nn
\l_@@_thm_share_tl
##1 }
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_thm_define:nn}
% \begin{macro}{\@@_thm_define:
N
nn}
% 配置定理环境。
% \begin{arguments}
% \item 环境名与类型标识,|clist| 型变量
% \item 定理头名称
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_thm_define:nn #1#2
\cs_new_protected:Npn \@@_thm_define:
N
nn #1#2
#3
{
\bool_if:NF \g_@@_opt_load_nthm_bool
{ \msg_error:nn { njuthesis } { missing-ntheorem } }
...
...
@@ -6218,7 +6245,7 @@ To produce the documentation run the original source files ending with
% 拆分环境名与类型标识。这里是考虑到标识符不一定出现在环境名中,
% 典型如 \env{proof} 环境默认无编号但也不含星号。
% \begin{macrocode}
\clist_set:Nn \l_@@_tmp_clist { #
1
}
\clist_set:Nn \l_@@_tmp_clist { #
2
}
\clist_pop:NN \l_@@_tmp_clist \l_@@_tmpa_tl
\clist_pop:NN \l_@@_tmp_clist \l_@@_tmpb_tl
% \end{macrocode}
...
...
@@ -6227,10 +6254,21 @@ To produce the documentation run the original source files ending with
\tl_if_in:NnT \l_@@_tmpb_tl { + }
{ \exp_args:NV \theoremsymbol \l_@@_thm_qed_symbol_tl }
\tl_if_in:NnTF \l_@@_tmpb_tl { * }
{ \@@_thm_new:VVn \l_@@_tmpa_tl \c_novalue_tl {#2} }
{ \@@_thm_new:VVn \l_@@_tmpa_tl \l_@@_thm_counter_tl {#2} }
{ \@@_thm_new:VVVn \l_@@_tmpa_tl \c_novalue_tl #1 {#3} }
{ \@@_thm_new:VVVn \l_@@_tmpa_tl \l_@@_thm_counter_tl #1 {#3} }
% \end{macrocode}
% 存储共享的计数器。
% \begin{macrocode}
\bool_if:NT \l_@@_thm_share_bool
{
\tl_gset_eq:NN #1 \l_@@_tmpa_tl
\bool_gset_false:N \l_@@_thm_share_bool
}
% \end{macrocode}
% 设置 \pkg{cleveref} 引用名。
% \begin{macrocode}
\bool_if:NT \g_@@_opt_load_cref_bool
{ \crefname
{
\l_@@_tmpa_tl
}
{#
2
} {#
2
} }
{
\exp_args:NV
\crefname \l_@@_tmpa_tl {#
3
} {#
3
} }
% \end{macrocode}
% 清除保存的证毕符号。
% \begin{macrocode}
...
...
@@ -6239,7 +6277,7 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_thm_new:nnn,\@@_thm_new:VVn}
% \begin{macro}{\@@_thm_new:nnn
n
,\@@_thm_new:
V
VVn}
% 包装 \tn{newtheorem} 以便展开输入的变量。根据 \file{interface3.pdf}
% 手册 5.3 节最后一段建议的展开顺序,这里将 |V| 型参数放在靠前的位置。
% \begin{arguments}
...
...
@@ -6250,17 +6288,21 @@ To produce the documentation run the original source files ending with
% 根据环境结束命令是否存在可以判断该环境是否有定义,
% 相应地可以利用局部定义切换定义和重定义环境的命令。
% \begin{macrocode}
\cs_new_protected:Npn \@@_thm_new:nnn #1#2#3
\cs_new_protected:Npn \@@_thm_new:nnn
n
#1#2#3
#4
{
\group_begin:
\cs_if_exist:cT { end #1 }
{ \cs_set_eq:NN \newtheorem \renewtheorem }
\tl_if_novalue:nTF {#2}
{ \newtheorem * {#1} {#3} }
{ \newtheorem {#1} {#3} [#2] }
{ \newtheorem * {#1} {#4} }
{
\tl_if_empty:nTF {#3}
{ \newtheorem {#1} {#4} [#2] }
{ \newtheorem {#1} [#3] {#4} }
}
\group_end:
}
\cs_generate_variant:Nn \@@_thm_new:nnn { VVn }
\cs_generate_variant:Nn \@@_thm_new:nnn
n
{
V
VVn }
% \end{macrocode}
% \end{macro}
%
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment