Use Bookmarks to Create TOC (Table of Content)

LibreOffice version 25.2.5.2

I’m looking for a way to create hidden text in my document that appears in the TOC. I use these as plot points. It doesn’t make any difference to me whether I use headings, index entries or bookmarks, however I need to have the plot point to be able to be hidden in the document. It must show up in the TOC, it must be hyperlinked in the TOC, finally, ideally, it needs to be assigned a style (indented and coloured) that can be reflected in the TOC (I use this for major plot points, sub plot points, important details of plot and so forth.)

I have been using Word to create my stories. In Word, I use the field {tc “Text Here” \l5 \n} where “Text Here” is what appears in the TOC, yet remains visible within my story until I hide fields. “l5” is the level of heading, in this example, 5, and “\n” starts a new line.

When the Word doc is opened in LibreOffice, these are converted to bookmarks with the following attributes that appear in the Navigator->Bookmarks menu, or more directly in the “Insert->Bookmark” menu.

  1. The Name of the bookmark is “_toc#########”

  2. The text associated with a hyperlink (and appears in the TOC) is the text from word, in this example “text here” (although after subsequent openings, this changed to the text of paragraph after the bookmark, yet the text from the bookmark remained, but I have no idea where it’s pulling it from.)

  3. The bookmark is marked as “hidden.”

  4. There are no conditions set.

This works great, however I’ve not found a way to “unhide” the bookmarks so I can format them to show in to TOC with a preferred format and level indent.

Also, when creating bookmarks in LibreOffice, there appears no way to “hide” the bookmark. I’ve seen OfficeLibre references to a context menu were you select the text then “hide” but this does not happen in my document (the doc is saved as an .odt file). The context menu does not show a “hide” option.

I’ve tried formatting headings with a style and the “hidden” attribute turned on, but then the heading doesn’t appear in the TOC.

I’ve ensured that “field shadings”, “field names” and hidden paragraphs is turned off (ie, not hidden). I’ve tried toggling the format marks on/off… no difference. I’ve tried converting the document to epub (both with OfficeLibre and Calibre), but it becomes corrupted.

I’m relatively certain that LibreOffice can do this and I hope someone can help me because I’d like to switch to LibreOffice. I’ve spent months (really, months) trying to figure this out. I’ve been using word processors since AES days (70s), but this truly has me puzzled.

Thanks for any help.

Sincerely,
Seaghan

Before suggesting a solution, here are a few remarks:

  • due to “compatibility” with very bad habits of Word users and the workaround implemented in Word to fix the bad habits instead of educating users, a hidden paragraph is never collected in the TOC (and this really annoys me when I want to add location-based data to the TOC)
  • styles for the “source” paragraph and its entry in the TOC are different
    This means you have a different look for the paragraph and its corresponding entry independent from each other. It calls for an introspection about the role of your hidden paragraphs among the document outline, i.e. at which level you want it to appear. And this better be consistent with the rest of the document/outline. Style for the outline paragraphs are usually Heading n while style for the TOC entries are Contents n.
  • you don’t create TOC entries with bookmarks but with paragraphs specifically tagged
  • any suggested solution will be valid only in .odt format

You seem to cpme from Word. Are you already familiar with character styles? They don’t exist in Word. I’m thinking of “hiding” your ‘plot points’ with a character style set for 2 pt font size (the absolute minimum) and colour equal to background. You then unhide your ‘plot points’ by modifying this character style.

Give more details about your ‘plot points’, notably at which level you want them. Are they more important than chapters? Or are they really minor points and they happen “below” all headings?

Hello and thank you for your reply. The formatting of the plot points is minor compared with getting them to display and hide.
I agree that it’s frustrating that hidden headings (in LibreOffice) are also hidden in the TOC. That would be an “okay” solution. Not great because it takes up another line.
I’ll refrain from talking about formatting for the time being since I don’t appear able to edit the bookmarks. I realise this is not what bookmarks are intended for, but it does work, provided I can access the “hidden” attribute. I’m puzzled that OfficeLibre shows this attribute, but I can’t access it.

Changing the Character Style is something that I already considered, however, regardless of size, it takes up horizontal space, and having been a professional typographer, am not prepared to “tweak” every paragraph for this. This is not a practical solution. Furthermore, changing the colour/size every time I want to review the plot is just counterproductive.

Regarding the importance of plot points, it’s impossible to state their importance since chapter headings can allude to the plot and therefore, don’t require a separate TOC entry to point it out.

For example…
Heading: Sally Learns to Ride (here you know what’s happening, it doesn’t require further explanation.
However, within that chapter may be…)
Saddles the Horse
Has Trouble Getting into the Saddle
Horse takes off at a Gallop with Sally holding on for Dear Life
Sally Reigns in the Horse.

You now know everything that’s happening in that paragraph. I can find a description of the saddle, how she gets it under control, any detail that I need later in the book when I need to review it.

OT, but;

Horses have reins to guide them; kings and queens reign over their people.

Anyway, you ned a line (a paragraph) to enter your data. This paragraph can be almost ignored by the layout engine by configuring its style: no spacing above and below, minimum font size = 2pt.

Provided your data is rather short (taking at most one line at 2pt), your plot point cost you vertically only 2 pt. This is hardly noticeable.

I don’t follow the objection. Entering the plot point always consumes horizontal space. It becomes a problem only when you insert your plot point inside another paragraph which will indeed disturb the paragraph. Plot points must be separate paragraphs.

Your plot points have a different semantic value (significance) than your narrative. Consequently, they should have their own paragraph style to denote this difference in significance and relevance. This is not a big issue: you already assign a different style to your headings.

I don’t think so. You can keep an “ordinary” configuration for the character style up until the final issuance of the ready-to-print document. Of course, pagination may be impacted but this is not really a big deal if you have only seldom, exceptional, absolutely necessary manual page breaks. Page breaks should be part of the Text Flow properties of paragraph styles. Thus, you have no “surprise” with your layout.

Your example shows that your ‘plot points’ are kind of sub-chapter headings you don’t want to appear in the narrative.

Just create them as ordinary sub-headings. If they come under a chapter (assuming Heading 1 style), style them Heading 2. Under a sub-heading (assuming Heading 2), give them Heading 3 style. You can also “unify” them at a single level so that they look the same in the TOC.

All you have to do is apply your “hiding” character style over the heading. As I mentioned above, this character style can be completely “neutral” (doing nothing) during the writing stage and changed to “hiding” before press.

Formatting the entries in the TOC is simply a matter of configuring Contents 2, Contents 3 or the “unified” level Contents n.