更改文档类别“书籍”中“章节”和“公式”计数器的格式

更改文档类别“书籍”中“章节”和“公式”计数器的格式

我正在使用文档类“book”。我正在使用以下代码

\documentclass{book}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\theoremstyle{definition}
\newtheorem{definition}{Def{i}nition}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{proposition}[definition]{Proposition}
\begin{document}
\mainmatter
\chapter{Quadratic Equation}
\section{Introduction}
\begin{definition}
\quad An equation $ax^2 + bx + c = 0,\ a\neq 0,\ a,\ b,\ c \in     \mathbb{R}$ is a called \textbf{quadratic equation}. The values of $x$ which satisfies it, is called its \textbf{roots}.
\end{definition}
\begin{proposition}
\quad Roots of the quadratic $ax^2 + bx + c = 0,\ (a\neq 0,\ a,\ b,\ c \in \mathbb{R}$) are given by\\
\begin{align}
    x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\end{align}
\end{proposition}
\end{document}

我希望章节编号为“1”而不是“1.1”,方程编号也应为“1”而不是“1.1”。编号定义和命题应为 1.1 和 1.2。

我尝试了很多方法来实现这个效果,但是还是没能实现。请帮帮我。

排版

答案1

假设你的 TeX 发行版是最新的,你可以通过添加指令来实现格式化目标

\counterwithout{equation}{chapter}
\counterwithout{section}{chapter}

在序言中。如果您的 TeX 发行版有些过时,则必须chngcntr在执行前面两个指令之前加载该包。

一些额外的评论:

  • \\无需在环境开始前插入显式换行符align。事实上,我更进一步说,\\在那个位置插入是一种不好的做法。

  • 由于命题中显示的方程由一行组成,因此您应该align用环境替换环境equation

  • 我不会写一个内联方程,而是$ax^2 + bx + c = 0,\ a\neq 0,\ a,\ b,\ c \in \mathbb{R}$写三个 [3!] 单独的内联方程:`$ax^2 + bx + c = 0$, $a\neq 0$, $a,\ b,\ c \in \mathbb{R}$。如果没有其他选择,写三个短方程而不是一个长方程将简化 TeX 寻找合适换行符的工作。

    同样地,我会$ax^2 + bx + c = 0,\ (a\neq 0,\ a,\ b,\ c \in \mathbb{R}$)用替换$ax^2 + bx + c = 0$, ($a\neq 0$, $a,b,c\in\mathbb{R}$)

  • 我认为{i}in的目的\newtheorem{definition}{Def{i}nition}[section]是为了分解fi连字符。如果是这样,请注意,使用{}分解连字符在 pdfLaTeX 下有效,但在 XeLaTeX 和 LuaLaTeX 下无效。最好写成\newtheorem{definition}{Def\kern0ptinition}[section]

在此处输入图片描述

\documentclass{book}
\usepackage{amsmath, amsthm, amssymb}

\theoremstyle{definition}
\newtheorem{definition}{Def\kern0ptinition}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{proposition}[definition]{Proposition}

\counterwithout{equation}{chapter}
\counterwithout{section}{chapter}

\begin{document}
\mainmatter
\chapter{Quadratic Equation}
\section{Introduction}
\begin{definition}
An equation $ax^2 + bx + c = 0$, $a\neq 0$, $a, b, c \in\mathbb{R}$ is a 
called a \textbf{quadratic equation}. The values of $x$ which satisfies 
it are called its \textbf{roots}.
\end{definition}
\begin{proposition}
The roots of the quadratic $ax^2 + bx + c = 0$, ($a\neq 0$, 
$a,b,c\in\mathbb{R}$) are given by
\begin{equation}
    x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \,.
\end{equation}
\end{proposition}
\end{document}

相关内容