LaTeX 中的定理编号

发布于 2024-07-24 09:47:07 字数 287 浏览 3 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

恍梦境° 2024-07-31 09:47:07

将以下代码放在序言中似乎达到了预期的效果:

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

我不明白为什么你想要这个特定的定理编号系统,但代码做了你想要的事情:
LaTeX 输出

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:
LaTeX output

榕城若虚 2024-07-31 09:47:07

这有效吗?

\newtheorem{thm}{Theorem}[section]

请参阅这些 LaTeX提示

Does this work?

\newtheorem{thm}{Theorem}[section]

See these LaTeX tips.

梦回旧景 2024-07-31 09:47:07

没有简单的方法可以做到这一点。 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.

溺ぐ爱和你が 2024-07-31 09:47:07

将此行插入到序言中(或 \newtheorem 语句之前的任何其他位置):

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

这将重置 thm 环境的编号命令以忽略章节编号(对定理编号时)并仅显示小节编号和定理编号。 章节编号仍将显示在章节标题前面,只是章节中包含的定理不显示。 因此,正如您所描述的,第一部分第二小节中的第一个定理将编号为 2.1。
\arabic 的替代方案包括:

  • \Roman - 生成大写罗马数字,例如 II.1
  • \roman - 生成小写罗马数字,例如 ii.1
  • \Alph - 生成大写字母,例如 B.1
  • \alph - 生成小写字母,例如 b.1

Insert this line in your preamble (or anywhere else before the \newtheorem statement):

\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. 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:

  • \Roman - produces capital roman numbers, such as II.1
  • \roman - produces lower-case roman numbers, such as ii.1
  • \Alph - produces capital letters, such as B.1
  • \alph - produces lower-case letters, such as b.1
九命猫 2024-07-31 09:47:07

以一种稍微不那么黑客的方式,您可以创建一个用 subsection 重置的假计数器,并根据您的喜好重新定义其 \the

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

In a slightly less hacky way, you may create a fake counter that is reset with subsection, and redefine its \the to your liking:

\newcounter{fakecnt}[subsection]
\def\thefakecnt{\arabic{subsection}}
\newtheorem{thm}{Theorem}[fakecnt]
你的背包 2024-07-31 09:47:07

您可以使用此命令来更新命令部分和小节以及定理和...

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

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})}‎‎‎
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文