Add "composed" chapter headline to header

I found a work around by exident (maybe this is the intented behavior): If you add a line formated with level 2 heading below the level 1-heading you get the header as it should be. Maybe this helps nort only me.

Hello LibreOffice-Community,

as far as I did’nt recieved any answer to mx Germen question yet, I decided to ak here again in English. Here is my question/problem:

After some testing, I managed to insert chapter headings with different levels in the header as it is described in the LibreOffice-Help.

Example: Chapter title according to title page “Kopfnuss”, this is marked as level 1 (style “title”). The chapter title is inserted as intended in the header.

Another chapter has, for example, the title “Experiments or How Little Michel Lost His Shoe”. “Experiments” is separated from the subtitle by a manually set line break. Same way “or” is separated. “Experiments” is level 1 (style “title”), “or” is level 2 (style “heading 2”) and “How Little …” is level 3 (style “subtitle”).

Inserting level 1 into the header is just as little of a problem as any other desired level. However, the chapters that have a simple title like “Kopfnuss” will be shown three times in the header. Changing the “Complete” field in the “chapter numbering settings” makes no difference.

Is there a trick to convince LibreOffice to output the subtitles only if they exist or to prevent the title from being displayed repeatedly in the absence of subtitles? If not, so maybe it would be an interesting feature for writers.

I hope my request is understandable and formulated sufficiently that it becomes clear what my concern is. To summarize again briefly: I do not want the “Kopnuss Kopfnuss Kopfnuss” to be output in the header if I have inserted the three desired levels of the chapter heading “Experiments or How Little Michel Lost the Shoe” there.

Thanks a lot for your input.

To the best of my knowledge, you can’t in the present Writer implementation.

You inserted a field from the More Fields category, Document tab, Chapter type and you selected a level.

When a corresponding heading level does not exist when the page is entered (i.e. the state for the first paragraph set in the page), fields contents falls back to the previous level and so on down to level 1. Consequently, eventhough you selected leval-1, level-2 and level-3, you get the experienced behaviour for “shallow” chapter.

This can be seemingly worse (apparently only) for a page beginning like this:

 1. Level-1 heading
 1.1. Level-2 heading
 1.1.1. Level-3 heading
 Contents of this subchapter

where the header will show “Level-1 heading Level-1 heading Level-1 heading” paradoxically. The status for the first paragraph is level-1. Consequently all the fields fall back to level-1 contents.

There is presently no way to constrain Writer to return a null value in case the requested level does not exist. Consider that the level field means “give me the most recent heading at most level l”.

If you can write a good specification with an objective argument, fill in an enhancement request at https://bugs.documentfoundation.org but remember there is no commercial structure behinf LibreOffice. Developers are volunteers. So don’t expect a quick implementation.

My suggestion would be to split the level parameter into two fields with max and min.: 1 + max would behave the same as presently, while max + max would return null if the level does not exist and min + max would be some intermediate case (return null if current heading level is not between min and max).

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

Thanks a lot for the super quick answer. I already thougt, that there will be no quick solution and that a feature request would be a good idea.
As far as I understand your suggestion, it is not a solution for the problem but rather the basis for the code-change - am I right?

So for the moment my question is answered.

Yes, I tried to elaborate on your idea without causing a disruption with present behaviour (some of us rely on it). With the min-max suggestion, present setting can be covered with max=present level, min=void (or 1). Thus existing documents will not be impacted.

I found a work around by exident (maybe this is the intented behavior):
If you add a line formated with level 2 heading below the level 1-heading you get the header as it should be.
Maybe this helps nort only me.