Automatic labels

I am working with a long doc that contains equations. Some of the equations are numbered with the existing option. However if an automatic reference is included in the text a new label has to be included in the equation. This approach requires a double identification, first the equation is automatically labeled as i.e. (3), then a manual label is created as <label|eq3> and then the reference is included when desired <reference|eq3>.
I see three problems, the first is the mental confusion derived from double labeling, the second derives from the introduction of additional equation numbers, after a new one the coordination between automatic and manual labelling does not exist any more. (provided that numbers are used to identify manual labels, the only rational option). And the third is that not seeing the existing labels when referencing is a source of mistakes.

Is there any posibility to use eq numbering as a label to point when introducing references?



I do not know the answer to your question, although perhaps there are hints in the package “smart-ref”. On the other hand the smart-ref package perhaps yet provides the functionality you are looking for.

I did not find the mailing list thread where the working of smart-ref was discussed, let me synthetically tell you how it works:
you give a label to the equation, a label which starts with the letters eq:, that includes the colon at the end (for example <label|eq:logarithmic-dependence>), but when you reference it, you insert in the reference the current equation number, and the package will substitute the reference name for the number.

In addition to the smart-ref package you can use the preview-ref which lets you see which equation you are referring to as a small baloon when your pointer is on top of the reference.

Please let me know if this is a tool that helps you to achieve what you want—and if something does not work the way I described it, please let me know too, I went by memory.


Thanks a lot for your kind help. I have tested both packages and they work as you remembered.
With smart-ref you can point directly to the equation number, and with preview-ref you can observe the equation you are pointing to, what is unexpectedly usefuful to coordinate the doc.
However the manual introduction of a label is still needed. Following this approach you can forget the label text for each equation and keep-on working with numbers. I presume there is some background reason for this, but i wonder if there is some way to avoid manual labeling

Again thanks a lot

I think I am able to write a plug-in for automatic labelling (I would start from How can I see list of labels?), but I do not promise to do it soon.

The background reason for not having automatic labelling is that if you are writing the document-as-code (as in LaTeX) you have to write everything yourself; the rest of pro and contra can be debated.

Personally, I like having user-defined labels, as they are easier to remember than numbers. For example, eq:clt is meaningful, while (21) isn’t. Of course, it’s a matter of taste.

What could be particularly user-friendly and (perhaps) not so difficult to implement, would be to have a dialogue where previews of all numbered equations are shown and the user can pick the equation in a visual manner, without needing to know either number or label. This could be similar to the dialogue to insert a bibliography reference, using the functionality from preview-ref.

Similarly to @pireddag, I can’t promise to implement anything anytime soon, though :slight_smile:

1 Like