# Numbering multiple paragraphs at once

I am drawing up a document that has numbered paragraphs. 1-36 are numbered normally and I have no problems. However, on paragraph 37, I need something like:

35 Normal paragraph.

36 Normal paragraph.

37-46 The following paragraphs correspond to text text text text, text text.

47 Normal paragraph.

I'm numbering my paragraphs using:

\newcounter{xpar}
\setcounter{xpar}{1}
\newcommand{\xp}{\arabic{xpar}\stepcounter{xpar}.\hspace{.5in}}


Can anyone help me figure out how to number the paragraph with a 37-46, and then continue on with 47?

-
Good catch; I already had those corrections...just typed this in here too quickly. Bad form on my part. Thanks, though. – Robert Ray Aug 4 '11 at 21:47

Add an optional argument for the "number of additional paragraphs" to the definition of your \xp macro. If the optional argument is empty, typeset the paragraph label as usual. If not, increase your custom counter as appropriate and also typeset the (new) label.

\documentclass{article}

\newcounter{xpar}
\newcommand{\xp}[1][]{%
\stepcounter{xpar}%
\arabic{xpar}%
\ifx #1\empty
\else
--\arabic{xpar}%
\fi
.\hspace{.5in}\ignorespaces
}

\begin{document}

\xp Some text.

\xp[3] Some text.

\xp Some text.

\end{document}

-
I think adding #1-1 is a bit more intuitive. – Caramdir Aug 4 '11 at 21:47
I like this solution better, so I will delete mine. – Gonzalo Medina Aug 4 '11 at 21:49
Just a suggestion: you could add something like \newlength\mylen before the definition of \xp, and change the \else part to \else \addtocounter{xpar}{#1}\settowidth\mylen{--\arabic{xpar}}% --\arabic{xpar}\hspace{-\mylen}% so that all the paragraphs would have the same indentation. – Gonzalo Medina Aug 4 '11 at 22:01
This solution worked perfectly. – Robert Ray Aug 4 '11 at 22:03
@Robert: Thanks! Don't forget to accept my answer after some time if no better one comes along. :-) – lockstep Aug 4 '11 at 22:10