Ask Your Question
0

How do I create a table of contents without changing the formatting of my text?

asked 2020-08-15 11:45:22 +0200

T.C. gravatar image

I have a document which has grown large enough to require a table of contents. When I try to add a table of contents using the menu command Insert / Table of Contents and Index, I find that the entries in the table of contents will be generated from the parts of my document designated with the "Heading 1" style. However, when I apply that style to the lines I want in my table of contents, it changes their formatting. I don't want to change the formatting, thank you; the formatting is fine as it is. I can't figure out how to designate text for inclusion in the table of contents without changing its formatting.

From my novice perspective, it seems that Libre Office Writer is using the Heading 1 style for two potentially incompatible things: The style signals to the table of contents what to include as entries; and it also applies a pre-defined set of formatting options. If you want one without the other, then you're out of luck. I suppose this wouldn't be a problem if it were easy to customize Heading 1, but Writer doesn't seem to support that.

In any case, I suppose there is a workaround I haven't discovered yet. Any advice?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-08-15 14:54:17 +0200

ajlittoz gravatar image

Yes, you understood that Heading 1 serves two purposes: flags paragraphs as level-1 data for the TOC and applies typographic attributes to the paragraph.

But, you're wrong both purposes can be controlled separately.

Formatting

Heading 1 is not "locked". You can modify to your taste. You can make it identical to your custom "A1" style.

Open the style sidepane with F11 or Styles>Manage Styles. Right-click on Heading 1 and Modify. Customise anyway you like. If it is in use, you wouldn't be able to change its outline level.

TOC level

Sometimes you need to have different formatting applied to level-n paragraphs (e.g. the chapter headings at level-1 and appendix headings at same level-1). As one style can only describe one formatting, it is obvious you need some trick to attach two styles to the same level.

Open one of your user styles for modification and go to Outline & Numbering tab. Define the Outline level for your user style with the drop down menu. You can even give it a different numbering style than the "main series" (but you cannot attach your user style to the "chapter numbering" counter).

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!

edit flag offensive delete link more

Comments

Thank you for the reply, but isn't my workaround strictly superior to this one? I can create A1 immediately by using Styles / New Style from Selection (or shift-F11), whereas modifying Heading 1 requires me to research all the ways Heading 1 differs from my desired formatting, and I'm not sure that's practically feasible (there are 14 pages of options!). What advantage is there to modifying Heading 1 over creating a custom style to represent my TOC entries?

I found your advice under TOC level to be useful. I now understand that the table of contents doesn't automatically include Heading 1 per se – it automatically includes all styles configured to outline level 1. To get a style to appear in the table of contents, you can either tell the TOC to explicitly include that style, as I did with "Assign Styles", or you can designate your style ...(plus)

T.C. gravatar imageT.C. ( 2020-08-15 16:26:16 +0200 )edit

The Additional styles in the Index/Table tab (not in the Styles tab which controls the formatting of the TOC itself) is used to add "extra" paragraphs in the TOC. Here, read "extra" as paragraphs not really part of the document outline. Notably, these styled paragraphs cannot be numbered (unless of course you force that in the style definition). Consider you enter comments or notes in the TOC.

ajlittoz gravatar imageajlittoz ( 2020-08-16 11:06:47 +0200 )edit
0

answered 2020-08-15 11:51:39 +0200

T.C. gravatar image

Oh, I think I found a workaround. The table of contents doesn't absolutely have to use Heading 1; you can designate alternative styles by using the "Assign Styles" button (see https://help.libreoffice.org/6.2/en-U...).

I was able to create a new style, "A1", from one of my desired TOC entries. Now, when I apply the style to the other entries, it doesn't change their formatting. Then, using the "Assign Styles" button, I can tell the table of contents to use A1 rather than Heading 1. Good enough.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-08-15 11:45:22 +0200

Seen: 154 times

Last updated: Aug 15 '20