You are right in that we may have cross-references between children documents. I still think that my proposal of automatically renaming labels is a good idea. What you say is actually not a problem is a little of care is taken by LyX when inserting cros-references.

Imagine we are working in document A and want to insert a reference to a label "LabelInA" in the same document. Then LyX would introduce the reference as usual, i.e. \ref{LabelInA}. Now we want to insert a reference to a label "LabelInB" in same document B. LyX would detect that the label is in another document (easy, since we have to choose that document in the cross-references dialog) and introduce the reference as, e.g., \ref{DocumentB:LabelInB}. Now, when we include document A in a third document and compile, LyX would rename all labels of document A (and of all documents, including the master) by adding a prefix "DocumentA:" and would update the references (in the same document A) to those lables accordingly (in our example would change \ref{LabelInA} to \ref{DocumentA:LabelInA}). Note that the \ref{DocumentB:LabelInB} would not be modified, and that would not be necessary, since the labels in document B would also be renamed by adding prefix "DocumentB:" to them.

I actually thing that, with independence of doing what I say or not, differentiating whether a reference points to a label in the same document or in another document is wise to facilitate debugging, in case this is necessary.

Cheers,
Nicolás


rgheck wrote:
Humberto Castejon wrote:
Hi!

I have just realized that when importing child documents, the labels of the different documents may overlap. That is, the same label may have been used, e.g., in two child documents. Does LyX take this into account and add any kind of prefix to the labels of the children documents? If not, I think this would be a nice feature, rather than having to modify manually the overlapping labels.

No, you don't really want LyX to do that. It should be possible to reference labels in one child from the other children---which it is, as things are. If you start modifying the labels themselves, then you would have also to modify the references to those labels. But then how do you know which one you meant to reference?

rh



Reply via email to