LaTeX lets you \label an equation then later \ref it.
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
Math & Science ⇒ Numbering macro
Numbering macro
Last edited by PJH on Sun Apr 10, 2011 10:12 am, edited 1 time in total.
Numbering macro
I think what you pretend has already been implemented in the mathtools package. Check section 3.2 of the manual.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Numbering macro
Thanks
Following on from your suggestion, I also found this which does the job:
http://www.cs.brown.edu/system/software ... doceqn.pdf
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
If that solves the problem, then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting).
Best regards and welcome to the board
Thorsten
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10