4

@DavidCarlisle argued in his answer that there is no need to use very long labels and it is actually a misuse! In my dissertation I find myself using very long labels all over the place. For the same reason I normally use long and descriptive file names, I tend to use long labels that are informative.

The only drawback of this approach that I could think of, so far, was the following. When referring to a label the \ref{very-long-label} macro pollutes the code and makes it harder to read. Otherwise, this usage makes it easier to find the labels you need while writing.

I learned the second drawback yesterday, when I got to know the showkeys and showlables packages. These packages become useless when long labels are used (see Tweak showlabels/showkeys - wrap the label).

One last piece of information. I use emacs+AUCTeX, so I can always get a nice list of labels that are defined in the document, and this list handles long labels fine.

So what is the best practice here? What is considered a good choice of labels?

Dror
  • 22,613
  • Shouldn't something like \let\lbl543{very-long-label} work for you? (Personally, I don't mind long label names, I just put them on a separate line if the length really bothers me.) – einpoklum Dec 06 '13 at 08:43
  • I don't see the advantage of this suggestion. In the code itself you'll end with cryptic fragments like \ref{\lbl314} so you could use this as the label in the first place. – Dror Dec 06 '13 at 08:48
  • 3
    the label is just an internal identifier for cross referencing so the only important thing really is that it is memorable to you. I suggest that the reason that you need showkeys is because your labels are too long to memorise and so you need to look them up. The label is internally used to generate a command name, and write to the aux file so there are some constraints on the characters used (and space only really works by accident) there was a time that long csnames would be a concern with using up TeX memory but that isn't an issue now (but probably affects my mental model of labels) – David Carlisle Dec 06 '13 at 09:29
  • Are you saying you memorize dozens (or maybe even hundreds) of labels (e.g., when writing a long document)? – Dror Dec 06 '13 at 10:12
  • I do also use quite long labels. But for me using emacs+AUCTeX+RefTeX and C-c ) is enough because the list contains enough information to find the correct label pretty fast. I have no need for showkeys or showlabels. – Christoph Dec 06 '13 at 10:31
  • @Christoph: I didn't have the need for that as well. I was trying to test these packages, to see whether then can be helpful or not, and ran into the issue of long label names. – Dror Dec 06 '13 at 10:46
  • @Dror "Memorize" is maybe not the right word. "Association" maybe? If I label a chapter on recurrence relations "recurrence" and a section on generating functions "generating", I don't need much memory to know what label I need to \ref to that section or that chaper. Equations (and theorems) are harder, but I try to find a single word that I can associate with it. A 4-word phrase would probably leave me wondering exactly how I phrased it. I expect this is what David means. – Dan Dec 06 '13 at 23:02
  • What I do is basically convert the title or relevant piece of text into a long label name with hyphens instead of space, e.g. {sec:preliminary-results} and that's enough for me to clearly tell labels apart. – einpoklum Dec 17 '13 at 10:03

0 Answers0