简体   繁体   English

LaTeX中的定理编号

[英]Theorem numbering in LaTeX

I have a problem with theorem numbering in LaTeX. I can make it number by subsection, eg我对 LaTeX 中的定理编号有疑问。我可以按小节编号,例如

Theorem 1.2.1定理 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定理 2.1

I use我用

\newtheorem{thm}{Theorem}[subsection]

for the numbering.用于编号。

Putting the following code in the preamble seems to have the desired effect:将以下代码放在序言中似乎可以达到预期的效果:

\usepackage{amsthm}
\newtheorem{thm}{Theorem}[subsection]
\renewcommand{\thethm}{\arabic{subsection}.\arabic{thm}}

I don't understand why you want this particular theorem numbering system, but the code does what you want:我不明白你为什么想要这个特定的定理编号系统,但代码可以满足你的要求:乳胶输出

Does this work?这行得通吗?

\newtheorem{thm}{Theorem}[section]

See these LaTeX tips .请参阅这些LaTeX 提示

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"). AMS 定理 Package仅提供一种方法来控制编号何时重置(部分,小节),如果它与其他环境(推论,引理)和编号顺序(“1.1 定理”与“定理 1.1”)相关联。

Theorem's get their numbering from the \thesection or \thesubsection command.定理的编号来自\thesection\thesubsection命令。 You can redefine the \thesubsection command to get the numbering you want, but that will also affect everything else that uses \thesubsection .您可以重新定义\thesubsection命令以获得所需的编号,但这也会影响使用\thesubsection所有其他内容。

In a slightly less hacky way, you may create a fake counter that is reset with subsection , and redefine its \the to your liking:以一种稍微不那么古怪的方式,您可以创建一个用subsection重置的假计数器,并根据您的喜好重新定义它的\the

\newcounter{fakecnt}[subsection]
\def\thefakecnt{\arabic{subsection}}
\newtheorem{thm}{Theorem}[fakecnt]

Insert this line in your preamble (or anywhere else before the \newtheorem statement):将此行插入您的序言(或 \newtheorem 语句之前的任何其他位置):

\renewcommand{\thesubsection}{\arabic{subsection}}

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.这将重置 thm 环境的编号命令以忽略部分编号(在为定理编号时)并仅显示小节编号和定理编号。 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.因此,正如您所描述的,第一节第二小节中的第一个定理将编号为 2.1。 Alternatives to \arabic include: \arabic 的替代品包括:

  • \Roman - produces capital roman numbers, such as II.1 \Roman - 产生大写罗马数字,例如 II.1
  • \roman - produces lower-case roman numbers, such as ii.1 \roman - 生成小写罗马数字,例如 ii.1
  • \Alph - produces capital letters, such as B.1 \Alph - 生成大写字母,例如 B.1
  • \alph - produces lower-case letters, such as b.1 \alph - 生成小写字母,例如 b.1

You can use this command for renew command section and subsection and theorem's and...您可以使用此命令更新命令部分和小节以及定理和...

\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{(\alph{subsection})}‎‎‎

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM