Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

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}
share|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
    
oh sorry just put a . at the end of the two definitions of \labelenumi. –  David Carlisle Dec 14 '12 at 17:07
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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