Vincent van Ravesteijn wrote:

Yes, I've thought about this.

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.

OK, let's move this to devel, then.

Here's the problem that occurred to me: What if there's already a label there? Do we do that check first? If so, how? The label doesn't have to be in the section environment itself.

Why ? Can't we find out the part of the text, where there might be a label?

In LaTeX, you might do it this way:
\section{title of section}\label{sec:label}
but of course LyX never outputs anything like that. And, in principle, the label could come anywhere in the section, so long as nothing has issued a \refstepcounter sort of command. That said, in practice, people will put the label in the section command, or else will put it in the first line of actual text.

Another solution would be a kind of "implicit" label, that doesn't actually surface in LyX at all. Every section-type entity, and maybe other things, too---figures, tables, etc---could have an "implicit" label which would get generated with the LaTeX but not actually appear in LyX. Maybe the way to do this wouldn't be so different: We could just have an invisible inset that was there, but not drawn. I'm not sure.

Same as before, if I'd rename a section and there is an invisible label I will easily forget whether the label should still refer to this section, or if I delete a section, I want to be reminded to move the label to its new place. The same with copy-pasting, moving, etc.

Yes, I know, there are lots of problems any way you try to do this. And I think you're right that the "invisible inset" approach won't work. So we're back to the other idea: EVERY section, figure, etc, always has a label associated with it, but this label won't be an inset; it'll somehow just be there. Then explicit labels become a rarity, and you just don't mess with them anymore.

This is how equation labels work now, isn't it? The label doesn't exist as separate from the equation, at least not in the UI. You can't select it by itself, etc.

rh

Reply via email to