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.

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

\begin{align}
  \label{eq:5}
    ...
\end{align}

texttexttext...

\begin{align}
  \label{eq:3}
   ...
\end{align}

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
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
add comment

1 Answer

up vote 6 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
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.