Writer dynamic cross-reference, similar to chapter name

I’m editing a journal and would like to include in the page header the month and year of the current entries on the page. Each time there’s a new month, this is stated in the text. The paragraphs go like this:

Monday, 1 November 1736 - I did that
Friday, 5 - …
Tuesday, 15 - …
Wednesday, 3 December 1736 - …

The journal spans over a lot of years and I’d not want to have 12xNoYears Page styles, just for different headers. Something like Insert a reference to the last text with specific character style would be great. Can something like this be achieved?

Fields are available for this purpose. Page styles define the fixed “geometry” of the page and header/footer can have variable contents with fields.
Standard cross-references won’t do the job because they are computed once only when the page style is “instantiated” and reused for every new page. You need something related to chapter/heading numbering. This then requires a specific styling strategy for your entries with the Heading n family.
Note that the state captured for headers is the one prevalent in the first paragraph of the page; for footer, the state in the last paragraph.

For best advice, mention OS name, LO version and save format. Attach a small sample so that we can have an idea about your styling.
Any suggestion will be based on styles. I assume you’re already fluent in this technique.

Indeed, I’m already using custom Heading styles for the chapters title and I was able to achieve this thing I’m speaking about if the date of an entry in the journal is a separate paragraph, by asigning a specific style to it. However, the date is part of a paragraph that contains more text, not only the date. If LO could see the chapter title also by the character style of a specific text, not only the paragraph style, that would also solve it.

I currently use Ubuntu 22.04 and LO:

Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: ro-RO (en_US.UTF-8); UI: en-US
Calc: threaded

Here’s a sample ODT file. I highlighted the portions of the text that I would like to be seen in the header, and manually inserted them, so you can have an ideea.
Journal_Sample.odt (35.7 KB)

Thank you for trying to help me!

What you are looking for is caller run-in heading or inline heading. Where the beginning of a paragraph (first sentence or a few words) is considered as the heading and highlighted as well as collected for the TOC.

What you show in your sample does not exactly match the definition because you omit some words at start of the paragraph.

If you can somehow change a bit your formatting so that you abide by the definition of run-in heading, you can use extension InLine Headings to “comfortably” create your headings.

I understand you want to echo such headings in the header. However you won’t get your expected result (e.g. like in page 5) because header generation is based on state available in the first paragraph of the page. Thus, in page 5, the header will show “Octombrie”, not “Noiembrie” because this heading is the second paragraph.

EDIT

There is a very nice way to create run-in headings, even “partial” run-in headings of your kind:

  1. select the words to be part of the heading
  2. (optional) apply some character style to give them a distinctive look
  3. Insert>TOC & Index>Index entry
  4. set Index: to TOC and ajust Index level: to the required level
  5. Insert

This will add the sequence of words in the TOC at the correct location. However, this does not seem to add the sequence to the “technical” recorded headings because they don’t appear in the heading-type cross-references. Consequently they can’t be sent to the header with fields.

1 Like

I started from @ajlittoz’s response above and I ended up writing two custom macros that will insert a hidden paragraph with a corresponding heading-style. In the header of the pages, I insert a field referencing the heading level This is not the cleanliest way, but it solves my needs pretty good. Considering that atm there’s no support in Writer for inline headings and that I couldn’t use the extension specified above, I’ll stick to this solution.
I attach the working sample, maybe someone will be helped by it:
Journal_Sample.odt (39.1 KB)