8

As part of a tenure portfolio packet, I need to create a list with numbering of the form

A.5.0 Section
     A.5.50 Subsection
     A.5.60 Subsection
     A.5.70 Subsection

How can I get the enumerate environment to automatically (i.e., without using \setcounter each time) count by 10 or, in general, by n?

Edit: The solution should also be compatible with subsubsections. For example:

A.5.0 Section
     A.5.50 Subsection
         A.5.50.1 Subsubsection
         A.5.50.2 Subsubsection
     A.5.60 Subsection
     A.5.70 Subsection

2 Answers2

6

You could just customize the way the counter is printed to add a zero to the end.

\documentclass{article}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}0}
\renewcommand{\labelenumiii}{\theenumiii}
\begin{document}

\begin{enumerate}
  \item Top level
  \begin{enumerate}
     \setcounter{enumii}{4}
     \item Section
     \begin{enumerate}
     \setcounter{enumiii}{4}
         \item Subsection
         \item Subsection
         \item Subsection
     \end{enumerate}     
  \end{enumerate}
\end{enumerate}

\end{document}

enter image description here

Matthew Leingang
  • 44,937
  • 14
  • 131
  • 195
  • 2
    That is clever, Matthew. Later on, when they (hypothetically, as far I know) want me to count by fives, I will be in trouble, though. – adamglesser Aug 13 '13 at 22:59
  • @adamglesser: Yes, that would be tougher. :-) Francis's solution is more customizable to situations like that. – Matthew Leingang Aug 13 '13 at 23:50
3

I modified Matthew's answer slightly:

\documentclass{article}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}\addtocounter{enumiii}{9}}
\renewcommand{\labelenumiii}{\theenumiii}

\begin{document}

\begin{enumerate}
  \item Top level
  \begin{enumerate}
     \setcounter{enumii}{4}
     \item Section
     \begin{enumerate}
     \setcounter{enumiii}{49}
         \item Subsection
         \item Subsection
         \item Subsection
     \end{enumerate}     
  \end{enumerate}
\end{enumerate}

\end{document}

Suppose you want to count by n, then all you have to do is to change the \addtocounter command to

\addtocounter{enumiii}{n-1}

Ex. counter by 5:

\addtocounter{enumiii}{4}

enter image description here

Update

Here is an updated definition that satisfy your request:

\newcounter{countby}
\setcounter{countby}{10}
\addtocounter{countby}{-1}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}
\addtocounter{enumiii}{\arabic{countby}}}
\renewcommand{\theenumiv}{
\addtocounter{enumiii}{-\arabic{countby}}
\theenumi.\arabic{enumii}.\arabic{enumiii}.\arabic{enumiv}
\addtocounter{enumiii}{\arabic{countby}}
}
\renewcommand{\labelenumiv}{\theenumiv}

This time, you only need to find the command \setcounter{countby}{...} and set it with the desired number you want to count by. Here is an example, suppose for some reason we want to count by 17:

\setcounter{countby}{17}

enter image description here

Francis
  • 6,183
  • This is definitely on the right path. I didn't realize I could put the \addtocounter command where you did; very creative. One thing that it doesn't seem to be compatible with is additional subsubsections. I can't see how to make it wait until the end of the sublist before it adds to the counter. I've edited the original question to reflect this requirement. – adamglesser Aug 14 '13 at 00:15
  • That's really a nice; it reminds me of telescoping sums! I suspect one can slightly simplify all of the \renewcommands at the top using the syntax of the enumitem package (which I might have to do since I will have to go at least two sublayers deeper), but this will get me where I need to go. Thanks for the help. – adamglesser Aug 14 '13 at 01:38
  • 1
    One problem with this approach is when you \label and \ref inside the list. – Werner Aug 14 '13 at 04:15
  • @Werner: Indeed, since \ref calls \theenumN. However if I redefine \labelenumN instead this problem no longer exist. Though \ref inside the fourth level list is still messy. I tried to write a new definition of \item but so far without success. – Francis Aug 14 '13 at 21:15