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?

  • 2
    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

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.

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.