对齐不会增加方程计数器

对齐不会增加方程计数器

对齐环境不会推进方程计数器。以下是产生以下输出的代码:

\documentclass{report}

\usepackage{mathtools,amsthm}



\begin{document}
 \numberwithin{section}{chapter}
    \numberwithin{equation}{section}
    \let\realequation\equation
    \def\equation{\setcounter{equation}{\arabic{subsection}}%
       \refstepcounter{subsection}%
       \realequation}

    \theoremstyle{definition}
    \newtheorem{thm}[subsection]{Theorem}
    \newtheorem{lemma}[subsection]{Lemma}
    \newtheorem{corol}[subsection]{Corollary}
    \newtheorem{defn}[subsection]{Definition} % definition numbers are dependent on theorem numbers
    \newtheorem{defns}[subsection]{Definitions} % definition numbers are dependent on theorem numbers
    \newtheorem{prop}[subsection]{Proposition} % proposition numbers are dependent on theorem numbers
    \newtheorem{exmp}[subsection]{Example} % same for example numbers
    \newtheorem*{remark}{Remark}
    \newtheorem{enum_remark}[subsection]{Remark}
    \newtheorem{exercises}[subsection]{Exercises}
    \newtheorem*{opex}{Opening Exercises}

        \begin{align} \label{nchoosed}
            \begin{split}
            \prescript{}{n}C_d = \binom{n}{d} 
                &=  \frac{n \cdot (n-1) \cdot (n-2) \cdots (n - d + 1)}{d!} \\
                &= \frac{n!}{d! (n-d)!}
            \end{split}
        \end{align}

some text
    \begin{equation}
        a = b
    \end{equation}
\end{document}

在此处输入图片描述

该文档的设置使得单个计数器贯穿每个章节,并按小节、定理、方程式等推进。

答案1

在此处输入图片描述

对齐会使方程计数器前进,但您已重新定义方程以忽略这一点并使用子部分计数器,因此它们自然都使用 1

这使得子部分和方程计数器相同,因此如果任何构造增加一个,另一个的值就会发生变化。

\documentclass{report}

\usepackage{mathtools,amsthm}

 \numberwithin{section}{chapter}
 \numberwithin{equation}{section}

% make equation counter an alias for subsection
\makeatletter
\let\c@equation\c@subsection
\makeatother



    \theoremstyle{definition}
    \newtheorem{thm}[subsection]{Theorem}
    \newtheorem{lemma}[subsection]{Lemma}
    \newtheorem{corol}[subsection]{Corollary}
    \newtheorem{defn}[subsection]{Definition} % definition numbers are dependent on theorem numbers
    \newtheorem{defns}[subsection]{Definitions} % definition numbers are dependent on theorem numbers
    \newtheorem{prop}[subsection]{Proposition} % proposition numbers are dependent on theorem numbers
    \newtheorem{exmp}[subsection]{Example} % same for example numbers
    \newtheorem*{remark}{Remark}
    \newtheorem{enum_remark}[subsection]{Remark}
    \newtheorem{exercises}[subsection]{Exercises}
    \newtheorem*{opex}{Opening Exercises}

  \begin{document}

first align
      \begin{align} \label{nchoosed}
            \begin{split}
            \prescript{}{n}C_d = \binom{n}{d} 
                &=  \frac{n \cdot (n-1) \cdot (n-2) \cdots (n - d + 1)}{d!} \\
                &= \frac{n!}{d! (n-d)!}
            \end{split}
        \end{align}

some text
    \begin{equation}
        a = b
    \end{equation}

second align
      \begin{align} \label{nchoosedz}
            \begin{split}
            \prescript{}{n}C_d = \binom{n}{d} 
                &=  \frac{n \cdot (n-1) \cdot (n-2) \cdots (n - d + 1)}{d!} \\
                &= \frac{n!}{d! (n-d)!}
            \end{split}
        \end{align}

some text
    \begin{equation}
        a = b
    \end{equation}
\end{document}

相关内容