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

By rearranging (copy-and-pasting) math environments the automatically RefTeX generated label numbers




become shuffled which makes the referencing to individual equations difficult.

How it is possible to rename the label names so that an increasing order is recovered?

share|improve this question
Much of the point of the \label / \ref system is that you can use labels that are meaningful to you, rather than being a random number, and then LaTeX sorts out the numbering for you. I would recommend using e.g. a label such as eq:Einstein for the Einstein equation, instead of numbered labels. – Andrew Swann Jan 8 '13 at 14:32
@AndrewSwann Reftex allows you to insert labels with context information (using C-c C-) ), which, together with automatic numbering, makes the key of the label more or less useless. – T. Verron Jan 8 '13 at 14:43
@T.Verron I use that mechanism of reftex all the time, but find itvery helpful to have keys that have meaningful names when working with my source. – Andrew Swann Jan 8 '13 at 20:53
up vote 8 down vote accepted

I like how you asked "how is it possible to..." instead of "is it possible to...". Because of course it is possible, reftex being awesome and OCD-friendly. :)

reftex-renumber-simple-labels is an interactive autoloaded Lisp function.

Renumber all simple labels in the document to make them sequentially.

So... M-x reftex-renumber-simple-labels RET y and you are done. It should even work across files. Note that you will get an error if the labels are already ordered, though.

share|improve this answer

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.