Math & Science ⇒ Numbering macro
Numbering macro
I want to write two macros, \mylabel and \myref which do the following:
\mylabel behaves like \label if the equation is actually referred to in the document (using \myref). If not it behaves like \nonumber.
I did this a long time ago in TeX. It required TeX to be run three times and worked as follows:
Sweep 1: \myref{eq1} outputs to a file the fact that eq1 is referenced.
Sweep 2: \mylabel labels eq1 and any others that are referenced - it knows this from the output of Sweep 1.
Sweep 3: \myref acts like \ref.
I dont know how to do this in LaTeX. Anyone know how?
Thanks
Phil
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Numbering macro
Numbering macro
Following on from your suggestion, I also found this which does the job:
http://www.cs.brown.edu/system/software ... doceqn.pdf
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Numbering macro
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10