2

The question refers to this solution and trying to modify the code to support multiple altconditions in my document.

The problem is to allow two sets of alternative conditions within the same document. Here is a 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}

The output should give

ZFC.1
ZFC.2
ZFC.2'
ZFC.3

and

Σ1
Σ2
Σ3
Σ4
Σ3'
Σ4'

Instead, we see

ZFC.1
ZFC.2
ZFC.0'
ZFC.3

and

Σ1
Σ2
Σ3
Σ4
Σ0'
Σ0'

How can the code be modified to produce the desired results?

9
  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Commented Jan 6, 2015 at 23:39
  • Ah! I didn't think of that! I was trying to spare everybody all the packages and stuff at the beginning because I didn't think it was relevant. But you're right! I've added them now, is this right? Commented Jan 6, 2015 at 23:48
  • 1
    Well, minimal is the key. Cut it down to the least amount of code showing the problem. e.g., geometry, pgf, hyperref, and others could be removed and the problem would likely persist. Same with any custom command definitions you have that aren't in the problem areas. Commented Jan 6, 2015 at 23:49
  • See minimal working example (MWE) for the canonical advice on this. Commented Jan 6, 2015 at 23:51
  • Please verify that the document I added to the top of your question shows the same errors you had before, and that those errors are the problem you're experiencing. In addition to cutting out several dozen lines that weren't showing errors, I had to modify some of the \begin and \end lines for the conditions and conditions2 environments to get this to build at all. If the \setcounter lines are truly the problem you're running into, please remove the rest of your document from the question so others can more clearly see the problem. That's much closer to a MWE you can get help with. Commented Jan 7, 2015 at 0:17

1 Answer 1

2

\setcounter{zfcpairing}{\value{zfcpairing}} is really superfluous. Instead, you need to assign to the zfcpairing counter the \value of enumi - that's just because you're in the first level (i) of the enumerate environment. Similarly, for the conditions list, the counter running with each \item is conditionsi (first level of the conditions list)... so I've used \value{conditionsi}.

enter image description here

\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}
3
  • Wonderful, thank you! In the future, if I do this in a third location in my document, I think I'll be able to figure out how, thanks to your example. Any suggestions as to what to read if I want to understand better what the part in the header is doing? For example, what the {2} in the \newlist{conditions}{enumerate}{2} means, or what series=zfc does? Would love to understand this better. Thanks again for your help! Commented Jan 8, 2015 at 20:00
  • @EthanAlvaree: \newlist{<listA>}{<listB>}{<num>} creates a list <listA> that is based on <listB> and has at most <num> levels. That is, you can only nest <num> version of <listA> inside one another. series=<name> "stores" the specific settings for that list so that later on you can reuse it. All of this is contained in the enumitem documentation.
    – Werner
    Commented Jan 8, 2015 at 20:34
  • I just discovered the extremely helpful series*=<name>, thanks to you. I hope this question's title is sufficient for others with the same question to find (if not, please suggest a better title and I will gladly edit my question). Thanks again for your help! Commented Jan 8, 2015 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .