Creating an outline without the entire paragraph being shown

I have a LibreOffice Writer document with paragraphs in the following format:

Paragraph 1 Title. Paragraph 1 Body.
Paragraph 2 Title. Paragraph 2 Body.

I would like the outline of the document to state only the title (i.e. “Paragraph 1 Title”).

However, when I try creating the outline based on Paragraph Style, the entire paragraph appears in the outline (e.g. “Paragraph 1 Title. Paragraph 1 Body.”).

Is it possible to have an outline using only the titles? The issue is that I must keep the body on the same line as the title, so cannot apply a different Paragraph Style.

Here is a sample file (heading.odt (16.6 KB)) if helpful to understand. Press F5 to see the Navigator which shows the outline. I care about the outline text because it gets exported to PDF.

1 Like

What makes N first characters in a given paragraph its “title”? I.e., how can LibreOffice know it?

How do you start a nested list on the same line as the parent list item? - #23 by mikekaganski might be relevant. Here is a modified sample, using actually different paragraphs for “title” (heading) and the rest, separated by a hidden paragraph mark (LibreOffice 7.5+).

heading1.odt (18.3 KB)

But there are problems in this new not-widely-used compatibility feature:

  1. The hidden state of the mark only shows after you do a print preview;
  2. The Navigator and PDF export still think that the whole resulting block (i.e., the header and the rest) constitute the outline text…

Worth a report.

1 Like

Here’s an idea. Have a special set of character styles called In-line heading 1 … and allow that to be added to the list of styles that you want to include in the TOC (and outlines).
For another workaround, see Apache OpenOffice Community Forum - [Tutorial] "In-line" or "run-in" headings - (View topic). Maybe that can be used as a starting point to implement in-line headings. Those things do pop up in books where the author or publisher wants to save space on a page or feels that a heading doesn’t deserve a line for itself.

In the 25.2 ReleaseNotes, it says “Support was added for inline headings”. However, I can’t find the way to create these inline headings in my document. Maybe the new version only added thd support for importing inline headings from DOCX, not create them.

Draw a frame where you want the inline heading. Enter some text or it will have zero width. Then with it selected, in the sidebar in Frame styles, double-click the style Inline Heading. Apply your preferred Heading n paragraph style.

Note that there can be some unwanted effects

To be honest, I did implement “inline headings” using a method similar to what you described. However, the process involves too many steps. While recording macros can simplify the workflow, I still hope future versions could incorporate features like the “Style Separator” found in DOCX files.
Implementing “inline headings” using the framework method ensures that such headings are recognized and included in the TOC and navigation pane. Additionally, when exporting to PDF, bookmarks corresponding to the headings can be generated. However, when saving from ODT as DOC or DOCX, there are still issues, including incorrect paragraph indentation, text outside frames no longer being hidden, and so on.

Once you have established the font size, there is no reason why couldn’t add different inline heading levels (two seems enough) to AutoText.
.
It seems to be exported back to .docx without frames, so I conclude it has implemented Style separator for docx.
.
TOC works for docx and pdf
InlineHeadingTest.odt (15.2 KB)
InlineHeadingTest.docx (7.4 KB)
InlineHeadingTest.pdf (44.1 KB)

My implementation is based on standard non-inline headings which are made invisible and occupy no space (in fact they use 2pt height which is the absolute minimum). This heading is cross-referenced at start of newt paragraph through fields. Indeed, there are many steps. Do you implement along the same line?

I don’t use a macro to insert my “inline” headings but an AutoText entry. Don’t neglect AutoText. They often provide a more convenient alternative to macros without their difficulties.

Since there is no frame involved, it exports quite well.

I downloaded the “InlineHeading Test.odt” and then saved it in DOCX format, and opened it with Word Online, but there is still an issue with paragraph indentation.

I noticed that to achieve the first-line indent of a paragraph, you specifically set the indentation for the text paragraphs inside the “inline heading” frame. This differs from my previous approach where I simply set the first-line indent value for the paragraph where the “inline heading” frame was located - the result being that when saving as DOCX, the first-line indent for the paragraph containing the “inline heading” frame disappeared.

The outcome of your method is that after saving “InlineHeading Test.odt” as DOCX, the first-line indent of the paragraph containing the “inline heading” frame appears as an indent for the entire paragraph.

When saving “InlineHeading Test.odt” as DOC format, the result looks even worse, matching the results of my previous experiments: the auxiliary text outside the “inline heading” frame was unexpectedly displayed.


I didn’t know what you meant by “incorrect paragraph indentation”, I took a stab in the dark and set the Heading 3 style to a 0.5 cm indent
.
I can test only in Word 2010 which displayed a layout virtually identical to that in Writer except for separator instead of frame. Only Alley was indented, not the paragraph. This might be a bug in Word 2010 or that only occurs in 2010 because according to this site
if your level-three heading is formatted to include a half-inch indent from the left margin, that indent will not be applied to the selected text. Instead, the paragraph attributes of the body text format will be used.
.
I know from experience that Word applies different layouts, functionality, and inclusions depending on what version you use or the recipient uses when a document is created in Word and opened in another version of Word, especially installed version vs online. This appears to be a Microsoft bug/policy.
.
Importing inline headings is a recent development, you can report bugs, How to Report Bugs in LibreOffice - The Document Foundation Wiki

You should report a bug
.
Note that tdf#131728 was for importing docx, not creating inline headings. Without bug reports, there might not be further improvements.

1 Like

To handle inline titles correctly in the TOC, you will need to use an index entry instead of an outline style.

  • Format the entire paragraph as regular text (e.g. Body Style). Otherwise, it will obviously be included in the TOC in its entirety. You may prefer to use a dedicated Character style to format the inline title.

  • Create a dedicated Index Entry instead of an outline paragraph style. From the menu, select

    Insert — Table of Contents and Index — Index Entry

  • In the “Insert Index Entry” dialog that appears, select “Table of Contents” in the “Index” dropdown, then provide the title in the “Entry” field. Assign the correct level using the “Level” spinbox. Then click “Insert”.

Limitations

  • Character formatting within the title will not be propagated in the TOC. This is mainly of concern for technical/scientific documents, where there may be a need to e.g. format a scientific plant name in Italics, or use a sub or superscript (e.g. CO₂).
  • Heading entries indicated through an Index Entry do not make it into the PDF outline upon export.
2 Likes

Thank you everyone for your ideas!

My expectation is that I would need to explicitly identify the title, rather than it being detected automatically. Perhaps like @anon87010807 suggested, by highlighting the title with a specified Character Style.

I’ve tried this (updated example: heading.odt (17.1 KB)) and although it works for a TOC, my need is for it to be exported in the PDF Document Outline. Currently the index entry does not appear there.

Perhaps re-stating my question in its most minimal form: is it possibly in LibreOffice Writer to specify a title for an entry in the PDF Document Outline other than the full paragraph text?

Hi,
have a look at that extension: Inline Headings;

HTH

1 Like

my need is for it to be exported in the PDF Document Outline. Currently the index entry does not appear there.

Thanks for identifying yet another limitation of the approach. I added it to my answer.

is it possibly in LibreOffice Writer to specify a title for an entry in the PDF Document Outline other than the full paragraph text?

Yes, I told you how. Either it is through a paragraph with an outline level header, or it is through the index entry. Unfortunately, LO has its limitations: you bumped into a few.

1 Like