Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: 允许定理环境共享编号 #207

Closed
4 tasks done
Undefined01 opened this issue May 7, 2023 · 3 comments
Closed
4 tasks done

[Feature]: 允许定理环境共享编号 #207

Undefined01 opened this issue May 7, 2023 · 3 comments
Labels
enhancement New feature or request math Symbols and theorems

Comments

@Undefined01
Copy link

先决条件

现有模板的不便之处

目前模板提供了 \njusetup[theorem] 定义定理环境。但是这个指令默认各个定理之间独立编号。正常而言这个问题不大,但是对于 theoremcorollarylemma 等强相关的环境使用共享的编号会更为合理。

提出可能的解决方案

希望能够提供一个较为方便的选项设置定理使用共享的编号。

如果设计或实现较为麻烦,也可以直接暴露一个选项手动指定需要使用的counter,手动让多个环境使用同一个counter也能达到效果。现在的counter选项只能指定父计数器,而不能直接指定使用这个计数器。

提出考虑过的方案

No response

额外信息

No response

@Undefined01 Undefined01 added the enhancement New feature or request label May 7, 2023
@atxy-blip
Copy link
Member

模板没有对 \newtheorem 的第一个可选参数做封装,这个方便做。最近事情比较多,这周末前或许能写出来吧。

image

@atxy-blip atxy-blip added the math Symbols and theorems label May 7, 2023
@atxy-blip
Copy link
Member

顺手写了,测试例如下。新版的 cls 文件见 njuthesis.zip

\documentclass{njuthesis}

\njusetup[theorem]{
    share-counter = true,
    define
}

\njusetup[theorem]{
    body-font = \ttfamily,
    % share-counter = false,
    type = {
        { {exercise} {习题} },
        { {solution} {解} }
    },
    define
}

\begin{document}
\chapter{foo}
\ExplSyntaxOn
\clist_map_inline:nn
  { axiom, axiom, theorem, exercise, example, solution, exercise }
  { \begin{#1} test \end{#1} }
\ExplSyntaxOff
\end{document}

image

@Undefined01
Copy link
Author

很完美,感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request math Symbols and theorems
Projects
None yet
Development

No branches or pull requests

2 participants