这个问题指的是此解决方案并尝试修改代码来支持altconditions
我的文档中的多个代码。
问题是允许在同一文档中设置两组替代条件。以下是 MWE:
\documentclass{article}
\usepackage{amsmath,amsthm,enumitem}
% THEOREM Environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\newlist{zfcaltconditions}{enumerate}{1}
\setlist[zfcaltconditions]{label=\textbf{ZFC.\arabic*$'$},ref=\textbf{ZFC.\arabic*}$'$}
\newcounter{zfcpairing}
\newlist{conditions}{enumerate}{2}
\newlist{sigmaaltconditions}{enumerate}{2}
\setlist[conditions]{label=\textbf{$\Sigma$\arabic*},ref=\textbf{$\Sigma$\arabic*}}
\setlist[sigmaaltconditions]{label=\textbf{$\Sigma$\arabic*$'$},ref=\textbf{$\Sigma$\arabic*}$'$}
\newcounter{sigmaaltconditions}
\newcounter{sigma3condition}
\newcounter{sigma4condition}
\begin{document}
\begin{enumerate}[before=\itshape,font=\normalfont,label=\textbf{ZFC.\arabic*}, series=zfc]
\item (Axiom 1 goes here)
\item \label{zfcpairing} \setcounter{zfcpairing}{\value{zfcpairing}} (Axiom 2 goes here)
\end{enumerate}
\begin{remark}
We could begin with a weaker statement:
\begin{zfcaltconditions}[start=\value{zfcpairing},before=\itshape,font=\normalfont]
\item\label{zfcpairingalternative} (Axiom 2' goes here)
\end{zfcaltconditions}
End of remark.
\end{remark}
\begin{enumerate}[resume,before=\itshape,font=\normalfont,label=\textbf{ZFC.\arabic*}]
\item (Axiom 3 goes here)
\end{enumerate}
\begin{definition}
Let $\Omega$ be a set. A $\Sigma$-algebra of subsets of $\Omega$ satisfies the following 4 properties:
\begin{conditions}
\item (Property 1 goes here)
\item (Property 2 goes here)
\item (Property 3 goes here)
\label{algebraofsetsunions}\setcounter{sigma3condition}{\value{sigmaaltconditions}}
\item (Property 4 goes here) \label{algebraofsetscountableunions}\setcounter{sigma4condition}{\value{sigmaaltconditions}}
\end{conditions}
\end{definition}
\begin{remark}
By De Morgan's Laws, property \ref{algebraofsetsunions} is equivalent to
\begin{sigmaaltconditions}[start=\value{sigma3condition}]
\item\label{algebraofsetsintersections} (Property 3' goes here)
\end{sigmaaltconditions}
Similarly, property \ref{algebraofsetscountableunions} is equivalent to
\begin{sigmaaltconditions}[start=\value{sigma4condition}]
\item\label{algebraofsetscountableintersections} (Property 4' goes here)
\end{sigmaaltconditions}
\end{remark}
\end{document}
输出应该给出
ZFC.1
ZFC.2
ZFC.2'
ZFC.3
和
Σ1
Σ2
Σ3
Σ4
Σ3'
Σ4'
相反,我们看到
ZFC.1
ZFC.2
ZFC.0'
ZFC.3
和
Σ1
Σ2
Σ3
Σ4
Σ0'
Σ0'
如何修改代码才能产生所需的结果?
答案1
\setcounter{zfcpairing}{\value{zfcpairing}}
确实是多余的。相反,您需要将 分配给计数器-zfcpairing
那只是因为您处于环境的第一级( )。同样,对于列表,与每个一起运行的计数器是(列表的第一级)...所以我使用了。\value
enumi
i
enumerate
conditions
\item
conditionsi
conditions
\value{conditionsi}
\documentclass{article}
\usepackage{amsmath,amsthm,enumitem}
% THEOREM Environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\newlist{zfcaltconditions}{enumerate}{1}
\setlist[zfcaltconditions]{label=\textbf{ZFC.\arabic*$'$},ref=\textbf{ZFC.\arabic*}$'$}
\newcounter{zfcpairing}
\newlist{conditions}{enumerate}{2}
\newlist{sigmaaltconditions}{enumerate}{2}
\setlist[conditions]{label=\textbf{$\Sigma$\arabic*},ref=\textbf{$\Sigma$\arabic*}}
\setlist[sigmaaltconditions]{label=\textbf{$\Sigma$\arabic*$'$},ref=\textbf{$\Sigma$\arabic*}$'$}
\newcounter{sigmaaltconditions}
\newcounter{sigma3condition}
\newcounter{sigma4condition}
\begin{document}
\begin{enumerate}[before=\itshape,font=\normalfont,label=\textbf{ZFC.\arabic*},series=zfc]
\item (Axiom 1 goes here)
\item \label{zfcpairing} \setcounter{zfcpairing}{\value{enumi}} (Axiom 2 goes here)
\end{enumerate}
\begin{remark}
We could begin with a weaker statement:
\begin{zfcaltconditions}[start=\value{zfcpairing},before=\itshape,font=\normalfont]
\item\label{zfcpairingalternative} (Axiom 2' goes here)
\end{zfcaltconditions}
End of remark.
\end{remark}
\begin{enumerate}[resume,before=\itshape,font=\normalfont,label=\textbf{ZFC.\arabic*}]
\item (Axiom 3 goes here)
\end{enumerate}
\begin{definition}
Let $\Omega$ be a set. A $\Sigma$-algebra of subsets of $\Omega$ satisfies the following 4 properties:
\begin{conditions}
\item (Property 1 goes here)
\item (Property 2 goes here)
\item (Property 3 goes here)
\label{algebraofsetsunions}\setcounter{sigma3condition}{\value{conditionsi}}
\item (Property 4 goes here)
\label{algebraofsetscountableunions}\setcounter{sigma4condition}{\value{conditionsi}}
\end{conditions}
\end{definition}
\begin{remark}
By De Morgan's Laws, property \ref{algebraofsetsunions} is equivalent to
\begin{sigmaaltconditions}[start=\value{sigma3condition}]
\item\label{algebraofsetsintersections} (Property 3' goes here)
\end{sigmaaltconditions}
Similarly, property \ref{algebraofsetscountableunions} is equivalent to
\begin{sigmaaltconditions}[start=\value{sigma4condition}]
\item\label{algebraofsetscountableintersections} (Property 4' goes here)
\end{sigmaaltconditions}
\end{remark}
\end{document}