Ask Your Question
0

Tabs of heading in table of contents TOC

asked 2019-03-15 14:54:15 +0200

maguggi gravatar image

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

§1_____________Text

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 6.1.5.2) 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: https://ask.libreoffice.org/de/questi...

Furthermore, this question might be somehow comparable with bug 30732, reported on bugzilla: https://bugs.documentfoundation.org/s...

Are there any hints or workaorunds to overcome this problem?

Thanks maguggi

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2019-03-15 16:43:43 +0200

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.

edit flag offensive delete link more

Comments

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.

Thanks

maguggi gravatar imagemaguggi ( 2019-03-15 16:55:38 +0200 )edit
0

answered 2019-03-18 15:37:36 +0200

ajlittoz gravatar image

updated 2019-04-04 12:51:00 +0200

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 @Mike Kaganski, 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 ...
(more)
edit flag offensive delete link more

Comments

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.

Maguggi

maguggi gravatar imagemaguggi ( 2019-04-03 15:39:39 +0200 )edit

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 ...(more)

ajlittoz gravatar imageajlittoz ( 2019-04-03 16:08:26 +0200 )edit

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.

maguggi gravatar imagemaguggi ( 2019-04-03 16:40:39 +0200 )edit

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).

ajlittoz gravatar imageajlittoz ( 2019-04-03 17:09:46 +0200 )edit

Thank you. You can download the document at

http://www.patgundv.ch/downloads/PatG...

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.

Maguggi

maguggi gravatar imagemaguggi ( 2019-04-04 08:09:56 +0200 )edit

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!

ajlittoz gravatar imageajlittoz ( 2019-04-04 10:42:12 +0200 )edit

Grüezi ;-)

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"...

maguggi gravatar imagemaguggi ( 2019-04-04 11:31:42 +0200 )edit

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 <space> <number> by a tab in the TOC.

ajlittoz gravatar imageajlittoz ( 2019-04-04 11:41:11 +0200 )edit

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.

ajlittoz gravatar imageajlittoz ( 2019-04-04 12:53:19 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-15 14:54:15 +0200

Seen: 145 times

Last updated: Apr 04