Tabs of heading in table of contents TOC

I got a document, comprising different headings. Some of them are formatted in the following style:


wherein the “_” is a tab and wherein §1 has nothing to do with chapter numbers, i.e. the first part (here §1) is randomly chosen.

With LO Version 5.0, the tab of the heading is taken with into the TOC, therefore, the respective entry in the TOC is similar to the heading as shown above.

Version 5.1 of LO as well as following versions of LO (currently operates different, the tab is replaced by one space and the entry in the TOC reads as follows:

§1 Text

A similar question has bee asked in the German part of the forum, see: Tabs aus Überschriften gehen nicht ins Inhaltsverzeichnis

Furthermore, this question might be somehow comparable with bug 30732, reported on bugzilla:

Are there any hints or workaorunds to overcome this problem?

Thanks maguggi

Showing tabs from headings in the ToC was a bug tdf#89505, present starting from version 4.4, and fixed in 5.0.6 and 5.1.2. What you see is the correct behavior.

Well, thank you for your answer, which is at least for me somehow unsatisfying…

Are there any possibilites to “unfix” this or other workarounds to end up with this wrong behaviour?
Reason is that in my document, I’ve got a lot of articles of law of which some are only one-digit, some are two-digit but all of them have besides its number a catchword which chatchword i’d like to align in the TOC.


There may be a workaround if your “§1” is not random, i.e. if all “§1___Text” paragraphs are numbered sequentially (I mean, “§1” numbers items in a list scattered throughout the document).

You need to define a dedicated paragraph style for this list. For my experiment, I used one derived from Body Text (I named it Insert_into_TOC). In Outline & Numbering tab, I associated it with Numbering 123 numbering styles (but you may need a dedicated one if this style is already used by another list so that you have no interaction between them) and I linked the paragraph to outline level Level 5.

I linked to outline level 5 because I didn’t use it, but you may link with used levels like 1 or 2 if common formatting in the TOC fits your needs both for the outline and the inserted data.

  • Modify the numbering style (found in the so-called list styles) Numbering 123 so that a HT (horizontal tab) is automatically added after the number and position it to the required location.

  • Style all your “§1___Text” with Insert_into_TOC and remove the manual “§1” and ___ tab (they are now provided by the list engine).

Edit your TOC (right-click and Edit index).

  • In the Entries tab, select level 5 (or the one you chose); click in the white space between E# and E and push the Tab stop button. Define the position in the text box below.

Now you have a tab in the TOC entry and you can play with it.

CAUTION: this tab position cannot be defined in the Contents 5 paragraph style dialog, but only here. That’s important for post-definition tuning.

  • Modify Contents 5 to sent indents, spacings, alignment and other attributes.

This is a bit tricky and will likely need several trials before being satisfying.

EDIT 2019-04-04

After reading the referenced document and some experiment, there is no definitive solution. The basic reason, as hinted by @mikekaganski, is that Writer disconnects layouts of headings and TOC entries. Tabs in headings are relative to the Heading n paragraph style and this could cause conflicts with Contents n paragraph style definition in the TOC. As a precaution, tabs and “soft” newlines are removed from the heading and replaced by spaces when entered in the TOC. The situation is even more serious because tab definition in Contents n styles are ineffective. The “real” tabs used to layout the entries are set in Insert>TOC & Index>TOC, Index, Bibliography with the Tab button.

I can only suggest an ugly workaround.

Your TOC is approximately 10 pages long, so manual editing should be relatively light.

  1. Modify the Content n for your special entries as follows in Indents & spacing tab:

    • set the Before text indent to the position where you want “text” to be aligned, e.g. 3cm
    • set First line indent to a negative value to offset PatV 999 to the left, e.g. -2cm; take care that this hanging indent is wide enough to handle the largest PatV 999
  2. Edit your document as usual. When you’re done, create or update the TOC, unchecking Protected against manual changes. Then replace the space between PatV 999 and text by a tab through Edit>Find & Replace:

    • in the Find box, enter (PatV [^ ]+) , i.e. the fixed prefix PatV, a space, the specification for a sequence of non-space characters and a final space; the parenthesis define a capture range,
    • check Match case to avoid false positives
    • in the Replace box, enter $1\t, i.e. text captures and a tab code
    • develop Other options and chack Regular expressions
    • then press Find Next and Replace to change occurrence after occurrence, so that you can check the validity of the hit, or Replace All if you’re confident.

    *Nota: you told me that PatV 999 was followed by a tab in the document body. Consequently, it should be followed by a space only in the TOC and Replace All should only replace there.

    This second step must be redone every time you regenerate the TOC, sorry!

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!

Hi ajlittoz

Thank you for this detailed advice. Unfortunately, my “§1___Text” headings are randomly chosen… So I didn’t try your solution.

As far as I understood, you provide the headings as a list. The TOC recognise the list and replaces E# with the numbering as provided by the list.

To have a randomly chosen numbering, the only way I can imagine is to define each entry in the text with right click, paragraph, outline and numbering, start with… (only have a german version of LO, so English menu entries are a guess) and the specific numbering → could be a workaround if you have e.g.only one or two entries which are random.

Anyway, thank you for your effort in this case.


With numerous random paragraphs as such, right-click and “start with” is indeed not a viable solution. I feel however convinced that your §1 numbers are not really random (anyway I haven’t seen your document). If they are really random, you should not enter them in the TOC because the TOC is supposed to be sorted on chapter numbering (which appears to be the same order in which chapters are written). When data is random, it goes into an index table where it is alphabetically sorted (on §1 in your case) and the page number gives access to the text. Remember that index keys are more versatile than TOC entries: you can choose which part will be the key (either §1 or Text depending on how you guide the reader). You may even have multiple index “keys” per referenced term (or group of words, such as your “Text”).

Wouldn’t an index be the solution?

index table → Stichwortverzeichnis → alphabetical index?

So i would have to define a new “index entry” for each heading.

My document has a TOC at the beginning, which mirrors the structure of the docuemnet, i.e. the arrangement of different (main) headings with a plurality of subheadings (§1___Text) assigned to and an index table at the end of the document for providing a catchword search. A pdf of the document is freely available in the www, but I’m not sure whether i can post the link or not.

If it’s already freely available on the web, posting the link does not add security threat. If you like, I can delete the comment after using the link.

Adding an index entry is easy provided you smartly choose what to index. If you choice is Text, leaving aside (out of indexed words) §1, you only have to select the words in Text and Insert>TOC & Index>Index entry. You do it only once and it survives edits in Text outside first and last characters).

Thank you. You can download the document at

For example, on page 8, you see “Art. 5” as a general heading and subseqently a listing PatV … with some of them having a blue background. The ones with a blue background shall appear in the TOC (see page v).

An aphabetical index table starts on page 172. There is another problem with leading numbers but this is another topic.


Very complex document. I now understand better the problem. I assume you’re trying to convert the document to LO Writer from some other source.

See the edit to my answer for a suggested workaround.


Grüezi :wink:

I built up the document as an LO-writer document from scratch. For reasons of layout, I chose a table with three columns. Perhaps could be made different but since the layout should stay as it is and many hours were already spent into this work, I refrained from starting with a fresh build…

Well, thank you very much for your suggestion(s), which might be a solution if you only have to update once… In my case, I probably have to many refreshs of the TOC…

At least, I had now a deeper insight into several features of LO.

As a sidenote: If you insert a “non-breaking space” e.g. five times, such non-breaking spaces appear in the TOC. Unfortunately, there are no “non-breaking tabs”…

There could be an automated approach with a macro but I never wrote one. Maybe other contributors could propose something to repace the space after PatV by a tab in the TOC.

I have again updated my answer. No need of a macro, you can customise your TOC in a single application of Edit>Find & Replace. For more convenience, store the regular expression in some text file and copy-paste it in the dialog. Hope this will meet your requirement more comfortably. I tested it, it works on my very simple sample.