14

I'm writing a moderately long text using LaTeX, and it's great to be able to organize chapters, sections, appendices, and everything else almost automatically. One thing has been bothering me though. This text has a lot of equations (multi or single-lined), and I can't find a convenient way to handle the labels.

Since the text is still being written, I can't tell whether I'll need to reference a given equation later on, so I'm just labeling all of then. What I'd like though, is for latex to only number the equations that are cited somewhere in the text. I'm using the align environment (since most equations are multi-line). After researching a bit, I've found the following options:

  1. Use the align* environment instead, and manually \tag the equations. This is not very convenient, since the tagging is done manually as well as the citing. Also, I'm constantly going back and adding equations, which would force me to change every tag that comes after the added equation in that section (not as bad as I thought at first).

  2. Keep using align and \label, but \notag each line, and then remove the \notag once I realize I want to cite that equation. This is the best I could find, but it is still cumbersome. Emacs automatically adds the labels, but not the notags.

Is this really it? LaTeX always manages to surprise me in how there's a package for everything. Isn't there one that hides the labels unless it's been called by an \eqref?

4
  • 1
    "Also, I'm constantly going back and adding equations, which would force me to change every single tag that comes after the added equation." No it wouldn't. It would only mean this if you are just labelling equations with a number, which is a really bad idea, and only partly for the reason that they need renumbering if you add anything.
    – Seamus
    Sep 16, 2010 at 16:10
  • @Seamus: Correct, I'm editing the question.
    – Malabarba
    Sep 16, 2010 at 16:26
  • If the \notag macro (and the split environment) really aren't enough, then manually labelling-and-tagging the equations you do refer to seems like the best option to me. But then, I'm also patient enough to 'manually' \label any equation to which I refer. Sep 16, 2010 at 17:33
  • I just found out about the split environment. Seems promising.
    – Malabarba
    Sep 17, 2010 at 18:21

1 Answer 1

19

The mathtools package has a feature only to show the equation number for equations that are actually referenced, which seems to be what you are asking for.

However let me advise you against this, as a matter of style. Just because you don't refer to one of your equations, doesn't mean that your readers won't. It's extremely annoying as a user of a mathematical document to have to discuss with your colleagues "the 3rd unnumbered equation on page 42", or whatever, and there is really no harm in having a number for every equation in the document.

12
  • 1
    Thanks, I agree with your point. The problem is that most equations are heavy, and having tons of numbers (from the labels) together with tons of symbols (from the equations) quickly adds up to a mess. I'm still trying to figure out the best commitment between the two extremes.
    – Malabarba
    Sep 16, 2010 at 16:56
  • 5
    Numbering ALL equations is an excellent practice. It's often known as Fisher's rule and was publicised in an amusing column in Physics Today "What's Wrong with These Equations" by N. David Mermin (see cvpr.org/doc/mermin.pdf). Sep 16, 2010 at 22:55
  • 3
    Thanks for the great essay! I disagree with all its rules. To number all equations makes your text an awful mess, and hyperref makes his second point moot. Sep 17, 2010 at 5:59
  • 3
    @Stephen: That's a pretty good column, and I agree with all of it respect to science papers. But I think the Fisher rule starts to break down when you deal with long texts containing long strings of equations. If you label everything, at some point you'll be making life a little easier for a few people who might make use of that, but the whole essay will be more messy for everyone else who reads it.
    – Malabarba
    Sep 17, 2010 at 18:20
  • 1
    @Stephen: That’s a great column, and I agree with Mermins’s other points in it, but not Fisher’s rule. It goes directly against his other fundamental rule, “math is prose”: if you’re numbering all your equations in case they might be referred to, why not number everything else you say for the same reason? (Indeed, I find consistent but inconspicuous line numbering both more useful and less invasive than Fisher’s rule.) Dec 5, 2010 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .