LaTeX 中的定理编号
我对 LaTeX 中的定理编号有疑问。 我可以按分段编号,例如
定理1.2.1
用于第一节第二小节中的第一个定理。 但我需要它来告诉我 只有小节和定理的编号,而不是节号,如下所示:
定理2.1
我用于
\newtheorem{thm}{Theorem}[subsection]
编号。
I have a problem with theorem numbering in LaTeX. I can make it number by subsection, e.g
Theorem 1.2.1
for the first theorem in the second subsection of the first section. But I need it to show me
only the numbers of the subsection and the theorem, but not the section number, like this:
Theorem 2.1
I use
\newtheorem{thm}{Theorem}[subsection]
for the numbering.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
将以下代码放在序言中似乎达到了预期的效果:
我不明白为什么你想要这个特定的定理编号系统,但代码做了你想要的事情:
Putting the following code in the preamble seems to have the desired effect:
I don't understand why you want this particular theorem numbering system, but the code does what you want:
这有效吗?
请参阅这些 LaTeX提示。
Does this work?
See these LaTeX tips.
没有简单的方法可以做到这一点。 AMS 定理包仅提供了一种控制编号的方法重置(节、小节),如果它与其他环境(推论、引理)和数字顺序(“1.1 定理”与“定理 1.1”)相关。
定理从
\thesection
或\thesubsection
命令获取编号。 您可以重新定义\thesubsection
命令来获取所需的编号,但这也会影响使用\thesubsection
的其他内容。There's no easy way to do this. The AMS Theorem Package only provides a way to control when numbering resets (section, subsection), if it's tied to other environments (corollary, lemma) and number order ("1.1 Theorem" vs. "Theorem 1.1").
Theorem's get their numbering from the
\thesection
or\thesubsection
command. You can redefine the\thesubsection
command to get the numbering you want, but that will also affect everything else that uses\thesubsection
.将此行插入到序言中(或 \newtheorem 语句之前的任何其他位置):
这将重置 thm 环境的编号命令以忽略章节编号(对定理编号时)并仅显示小节编号和定理编号。 章节编号仍将显示在章节标题前面,只是章节中包含的定理不显示。 因此,正如您所描述的,第一部分第二小节中的第一个定理将编号为 2.1。
\arabic 的替代方案包括:
Insert this line in your preamble (or anywhere else before the \newtheorem statement):
This will reset the numbering command of the thm environment to ignore the section numbers (when numbering theorems) and display only the subsection numbers and theorem numbers. Section numbers will still be displayed in front of section headings, just not the theorems included within the sections. So, just as you describe, the first theorem in the second subsection of the first section will be numbered 2.1.
Alternatives to \arabic include:
以一种稍微不那么黑客的方式,您可以创建一个用
subsection
重置的假计数器,并根据您的喜好重新定义其\the
:In a slightly less hacky way, you may create a fake counter that is reset with
subsection
, and redefine its\the
to your liking:您可以使用此命令来更新命令部分和小节以及定理和...
You can use this command for renew command section and subsection and theorem's and ...