9

I am preparing an outline of lectures for a course. Some topics will take more than one lecture. I want to create an enumerate environment that reflects this.

I want to end up with something like

  1. Topic 1.
2-3. Topic 2.
  4. Topic 3.
5-6. Topic 4.

I know that I can do this manually, e.g.,

\documentclass{article}

\begin{document}
\begin{enumerate}
    \item [1.] Topic 1.
    \item [2-3.] Topic 2.
    \item [4.] Topic 3.
    \item [5-6.] Topic 4.
\end{enumerate}
\end{document}

However, if I want to insert another topic in the middle of the list, I need to re-do everything by hand. Is there a way of doing this with one or more counters?

12

enter image description here

\documentclass{article}

\def\itemrange#1{%
\addtocounter{enumi}{1}%
\edef\labelenumi{\theenumi--\noexpand\theenumi}%
\addtocounter{enumi}{-1}%
\addtocounter{enumi}{#1}%
\item
\def\labelenumi{\theenumi}}

\begin{document}
\begin{enumerate}
    \item  Topic 1.
    \itemrange{1} Topic 2.
    \item  Topic 3.
    \itemrange{1} Topic 4.
\end{enumerate}
\end{document}
| improve this answer | |
  • This is a very nice solution. I have one nitpick: an itemrange does not put a period after the label, and the same is true of any items that occur after the first itemrange. – Andrew Uzzell Dec 14 '12 at 16:16
  • 1
    oh sorry just put a . at the end of the two definitions of \labelenumi. – David Carlisle Dec 14 '12 at 17:07
  • Can this be altered to work in \begin{enumerate*} environments? – L. Nielsen Jun 9 at 8:52
  • 1
    @L.Nielsen better to ask a new question as a new post rather than a comment on a years old answer. Also please supply a test document in your question (there is no enumerate* environment by default) – David Carlisle Jun 9 at 8:56
0

Disclaimer: This is a personal variation. People are free to have difference of opinion on this.

I would be doing it like this:

\documentclass{article}

\begin{document}
\begin{enumerate}
    \item  Topic 1
    \item  Topic 2
    \begin{enumerate}
        \item First session
        \item Second session
    \end{enumerate}
    \item  Topic 3
    \item  Topic 4
    \begin{enumerate}
        \item First session
        \item Second session
    \end{enumerate}
\end{enumerate}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.