如何使 \begin{align} 计数器重新开始?

如何使 \begin{align} 计数器重新开始?

我先\begin{align}用文档中的方程式做了一次,然后又做了第二次。但我注意到计数器没有重新开始。

例如,这是第二个等式,它应该重新从一开始。

在此处输入图片描述

这是我希望可以重现该问题的代码,但照片就出自于此。

\usepackage{amsmath}

\begin{document}

\begin{align}
\neg\phi\rightarrow\Box\neg\phi,w_i \mbox{ contrapositive of }T\\
\neg\neg\phi\rightarrow\neg\Box\neg\phi,w_i \mbox{ negation of }1
\end{align}

blabla    

\begin{align}
&\neg(\Diamond\Diamond p\rightarrow\Box\Diamond p),w_i\mbox{ hypothesis}\\
&\Diamond\Diamond p,w_i\mbox{ from } R_{\neg}\mbox{ on }3\\
&\neg\Box\Diamond p,w_i\mbox{ from } R_{\neg}\mbox{ on }3\\
&\Diamond\neg\Diamond p,w_i\mbox{ from } R_{\neg\Box}\mbox{ on }5\\
&\Diamond\Box\neg p,w_i\mbox{ from } R_{\neg\Diamond}\mbox{ on }\\
&w_iRw_j\mbox{ from } R_{\Diamond}\mbox{ on }\\
&\Box\neg p,w_j\mbox{ from }R_{\Diamond}\mbox{ on }\\
&w_jRw_k\mbox{ from } R_{\Box}\mbox{ on }\\
&\neg p,w_k\mbox{ from } R_{\Box}\mbox{ on }\\
&w_iRw_j\mbox{ from } R_{\Diamond}\mbox{ on }4\\
&\Diamond p,w_j\mbox{ from }R_{\Diamond}\mbox{ on }4\\
&w_jRw_k\mbox{ from } R_{\Box}\mbox{ on }13\\
&p,w_k\mbox{ from }R_{\Diamond}\mbox{ on }13
\end{align}

\end{document}

答案1

除非另有说明,计数器通常具有全局范围。在这种情况下,align使用equation计数器,您可以根据需要(重新)设置它:

\begin{align}
  <your first alignment>
\end{align}

<some textual content>%
\setcounter{equation}{0}% Restart equation counter
\begin{align}
  <your second alignment>
\end{align}

答案2

我完全不推荐这种做法,因为它会让读者感到困惑,而且潜在的超链接会引导读者进入错误的地方:

放入。请注意\setcounter{equation}{0},这也会对 产生影响。\align\g@addto@macro\align*

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter
\g@addto@macro{\align}{\setcounter{equation}{0}}
\makeatother

\begin{document}

\begin{align}
\neg\phi\rightarrow\Box\neg\phi,w_i \mbox{ contrapositive of }T\\
\neg\neg\phi\rightarrow\neg\Box\neg\phi,w_i \mbox{ negation of }1
\end{align}

blabla    

\begin{align}
&\neg(\Diamond\Diamond p\rightarrow\Box\Diamond p),w_i\mbox{ hypothesis}\\
&\Diamond\Diamond p,w_i\mbox{ from } R_{\neg}\mbox{ on }3\\
&\neg\Box\Diamond p,w_i\mbox{ from } R_{\neg}\mbox{ on }3\\
&\Diamond\neg\Diamond p,w_i\mbox{ from } R_{\neg\Box}\mbox{ on }5\\
&\Diamond\Box\neg p,w_i\mbox{ from } R_{\neg\Diamond}\mbox{ on }\\
&w_iRw_j\mbox{ from } R_{\Diamond}\mbox{ on }\\
&\Box\neg p,w_j\mbox{ from }R_{\Diamond}\mbox{ on }\\
&w_jRw_k\mbox{ from } R_{\Box}\mbox{ on }\\
&\neg p,w_k\mbox{ from } R_{\Box}\mbox{ on }\\
&w_iRw_j\mbox{ from } R_{\Diamond}\mbox{ on }4\\
&\Diamond p,w_j\mbox{ from }R_{\Diamond}\mbox{ on }4\\
&w_jRw_k\mbox{ from } R_{\Box}\mbox{ on }13\\
&p,w_k\mbox{ from }R_{\Diamond}\mbox{ on }13
\end{align}

\end{document}

相关内容