Discussion:
RFI: label prefix not actualized when section heading type is changed
(too old to reply)
Richard Heck
2011-07-16 19:59:01 UTC
Permalink
I'm not sure this is really a good idea. I
worry that there are too many cases where a label would be changed
incorrectly, or not changed.
For example? I also thought about this but no case comes into my mind
where this would fail.
It's perfectly possible to put a sec: label into a subsection heading.
Why? Because you want to reference the section the subsection is in. Now
if you change it to a chapter, what should happen?
I tend e.g. not to put labels into section
headings, but immediately following them, and those would not, and
should not, be affected, since one has no clear way to know with what
they are supposed to go.
But putting them in the current style is more or less standard and you
even have to do this for many styles. Take for example the theorems.
An example: insert a problem in a book (svmono) class. If you want to
reference it, the label has to be inside the problem style. Adding it
below would not have th desired effect: when clicking in the PDF on
the reference, it jumps to a slightly wrong position because the
anchor is not in the problem.
You have to do this for environments, yes, so that you get what is then
the active counter, which it only is inside that environment. But
commands are different, generally speaking.

Speaking of which, I sometimes wonder if LyX shouldn't output:
\section{This is the section title}\label{sec:labelname}
rather than:
\section{\label{sec:labelname}This is the section title}
The label inside a moving argument just makes me worry, which is one
reason I don't put it there.
Moreover, when adding the label below the section heading, you cannot
benefit from LyX's automatic label naming. You get as proposal the
text behind the label, but you want of course the title of the section.
Attached is an example file.
Yes, of course, but I always delete what LyX suggests anyway.
But also when you put the label behind the section heading, I don't
see a reason why its prefix should not be changed when the section is
made a subsection or something else.
It's asking for trouble to start changing things in paragraphs I haven't
changed myself.
Even changing a section to a subsection, you might not always want
the label to change.
The label shout not change, but is prefix. I mean the prefix is used
to have a style for each reference type. So when you have two
different styles for sections and subsection, you of course want to
have the style of the subsection when changing a section into a
subsection. Currently you have to change the prefix manually which is
for larger documents a pain.
I understand. But we're just talking one label, normally, if you switch
a section to something else. All the references to that label should
update automatically when the label itself is changed.

(There is a bug about this somewhere, but I haven't yet figured out
exactly what triggers it. I think maybe the label updating doesn't
always start from the master, but maybe just from the parent?)
What would really solve this is the "auto-label" feature we have
sometimes discussed, and which really ought not be that hard to
implement.
I missed this discussion. What it the idea of this?
This has been batted around from time to time. The idea is to allow
references to, say, sections, without the user having to put a label
there. LyX would automatically insert the label at output, presumably
with an appropriate prefix. OOo and similar programs do this kind of
thing. This could be extended to all kinds of things: Tables, figures,
theorems, etc.

Richard
Jürgen Spitzmüller
2011-07-17 09:43:45 UTC
Permalink
i have some vague feeling that its even
possible to have document which has set master although master is not aware
of it? then this automatic bussiness would spoil references.
Yes. And also with xr.sty, things will become difficult to maintain.

Jürgen
Uwe Stöhr
2011-07-19 01:30:42 UTC
Permalink
Post by Jürgen Spitzmüller
i have some vague feeling that its even
possible to have document which has set master although master is not aware
of it? then this automatic bussiness would spoil references.
Yes. And also with xr.sty, things will become difficult to maintain.
OK. So nothing we can do here - I'll close the bug report.

thanks and regards
Uwe

Pavel Sanda
2011-07-17 09:39:08 UTC
Permalink
I'm not sure this is really a good idea. I
worry that there are too many cases where a label would be changed
incorrectly, or not changed.
For example? I also thought about this but no case comes into my mind where
this would fail.
think about master-child business. now label change needs to go through all
related files and mark them changed. i have some vague feeling that its even
possible to have document which has set master although master is not aware of it?
then this automatic bussiness would spoil references.

so it would be better to have "auto-label" check box in label dialog
for interested users only.

pavel
Marcus Kriele
2011-07-17 15:38:44 UTC
Permalink
I seem to remember that I had recently changed a label in a document
with several children and the references in other children have
automatically been updated correctly.

However, even if updating across children works at all times, there
would be pitfalls in co-authored docuements. For instance, you may
co-author a book where each chapter is a child. If the co-author
changes a label on his/her machine, his/her references in other child
documentsget updated but not yours. So if you include the updated
chapter from your co-author, references in your version would get
orphaned. This is a real problem as you would usually work concurrently
on different chapters.I believe that this is a serious argument against
automated updating of labels.

In addition, my 10 year+ experience with Microsoft Word indicates that
auto labels do not work well. I don't think I ever wrote a word
document with auto labels where all the references worked out of the
box. In fact, this problem caused me to use LyX or LaTeX whenever
possible, even when I was working in a "Word-only" environment.

Regards, Marcus
Loading...