TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

share|improve this question
Your code contains some errors: instead of \setcounter{xpar}, you should use \setcounter{xpar}{1} (or another value) or \stepcounter{xpar}, and instead of \newcommand{xp}{...} you should use \newcommand{\xp}{...}. – Gonzalo Medina Aug 4 '11 at 21:44
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.


  \ifx #1\empty


\xp Some text.

\xp[3] Some text.

\xp Some text.

share|improve this answer
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

Your Answer


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.