On 10/04/2016 05:05 PM, racoon wrote: > On 04.10.2016 20:02, Richard Heck wrote: >> On 10/04/2016 12:40 PM, racoon wrote: >>> Where the label is just inserted in an extra default paragraph. Apart >>> from looking a bit odd, it seems to work and not to create extra >>> spacing or so. So is this the "saver" way to insert section labels in >>> LyX? >> >> You can also just put the label at the beginning of the text. If there's >> no such text (if the first thing is a \subsection), then you can put it >> on a blank line by itself. LaTeX will ignore the otherwise empty line. > > I just noticed that LyX in a sense supports neither my (in an extra > line) nor your (at the beginning of the text). This is because LyX > does not add the "sec:" to the label and also automatically inserts > the beginning of the text rather than the heading.
I do get the "sec:" on a blank line, and even at the beginning of the first paragraph. But you are right that the auto-fill mechanism gives you the text from the paragraph, or no text. It would be pretty easy to change that, I think. Have a look at Text::getPossibleLabel. You'll see there's some fancy footwork to get the "sec:" part to work. If you did that before filling the "text" variable, then...well...maybe there'd be other problems, but it would solve this problem, I think. Richard