Uwe Stöhr wrote:

 > 1. The new hyperref stuff in 1.6 is very slick. Is there any way to
 > make a "cross reference" to a section or subsection, without adding a
 > label? So the user might say "As defined in s. 10.91" without having
 > to go to section 10.91 and adding a label?

How should that be possible? The strength of LaTeX is that everything is referenced relatively and not absolutely. You section names, section numbers, page numbers, etc. will change from revision to revision of your document. Therefore you add a label that is referenced instead of a number. Since LyX 1.6.2 referencing is very easy: insert a label, then right click on it and copy it as reference. Finally insert at the position you like.

The problem here is that we want to avoid the work of moving to another part of the document, inserting a label, and then move back to continue writing. I believe other word processors offer this.

Not having to move makes it much easier to use cross references. It is not much of a problem when referring to a nearby figure, but it is a chore when section you want to reference is 60 pages away.

I do not want to take away the ability to make a label, because it will still have some uses. But lots of labels could be automatic:

Writer wants to reference something
1. The writer bring up a list of all things that can be referenced.
2. The writer select an item, perhaps using that
   "right-click->copy as reference" way that already works for the
   manually inserted labels. At this point, LyX insert an ordinary
   label in the section/chapter/figure/...  (So no file format change
   needed, just automation of a sometimes tedious task.)
3. The writer pastes the label as usual.

No fileformat change, no new internal data structure hopefully means no new strange bugs. And if it gets coded quickly, it could go into 1.6.3 or 1.6.4.

Also, the list for picking referencable items already exists in LyX, it is the TOC. :-) All it needs is a context menu.

And obviously, no pre-generated labels for everything that _might_ get
referenced. No ugly latex here. An auto-label gets created only when the writer asks for it. Duplicate labels can be avoided when LyX finds there is a label already at the exact position where the auto-label gets created. Duplication can happen when the user has put a label in the same section but at a different position. But this is valid - a page break could occur between the two labels, and the expert writer may want to refer to either position.


> You could indeed imagine a context menu item in the TOC "Insert reference to section", that will > insert a label and a reference at once. Or one can think of a second tab in the cross-reference
 > dialog showing all sections too.

We've had this discussion several times the last years. Auto-labeling is not useful.

I do not agree. It certainly saves work, the question is only if it can be done without disrupting other work instead.

When I write a document, why should the list of labels be polluted with labels I don't reference? This way writing a book would be horror. But

There is no need to have unreferenced labels. My way of doing it don't pollute the label dialog. I see the problem with a book that has several hundreds of sections. Automatically creating a label from the TOC makes cross referencing easier, without messing up the label dialog.

Also, all referable items (sections etc.) could have context menu "copy as reference", that also does this auto-creation of a label. That way, referencing nearby items becomes easier too.


when the automatic labels don't appear in the list of referable labels, then they are useless, because their only purpose is to reference them.

After you have a label created automatically, it will show up in the
list because it is a label - just like the manually created ones.

Furthermore keep in mind that we need to output clean LaTeX. When you give your document to the publisher and have hundreds of unnecessary labels you'll get troubles or they even reject your manuscript.

Understood. I would not want to create unnecessary labels. Only an easier way to create them than "move move move, insert label, copy as ref, move move move, insert cross ref."

All this moving around can be avoided, and the insertion too. Because label insertion can be an automatic part of selecting what to reference.

How would you name the labels? I name labels so that I later know what they are for and can easily reference them in e.g. other child documents. Currently when inserting a label, LyX proposes a name which is in most of the cases not usable.

That is indeed a problem, but the trivial solution is that LyX can still ask (in the cases where a new label need to be created.) We still avoid moving around the document(s) which is the worst part of todays cross referencing. That, and moving back again. More than "a few" page-ups means searching - manual or using the search&replace dialog. :-(

So, when the item picked from the TOC already has a label, just use that. When there is none, have LyX make a default label name as usual, but ask because the automatic name is not necessarily good.

Helge Hafting

Reply via email to