I am trying to format the Table of Contents for my paper with hyperlinks but each time I try the TOC imports content from within the paper into the TOC

Can someone please help me? I am writing my dissertation and am trying to format my Table of Contents with hyperlinks. Each time that I attempt to hyperlink the TOC I get large quantities of content from within the body of the paper in the TOC. This is aggravating! If anyone can provide some guidance I would greatly appreciate it!

By default, LibreOffice Writer uses Heading Styles when automatically generating a table of contents and sets the text of the headings up as hyperlinks.

Can you please describe the steps you are using when trying to set up your table of contents and hyperlinks so we can discover the problem and come up with a solution?

I wonder if this is a bug in LibreOffice?

I go to the TOC, right click and select Edit Index. I then go to Entries tab, place my cursor in front of the LS block and click Hyperlink. I then go to the block after LE and click and click Hyperlink again. Next I go to Styles and under Levels I select Title (Contents Heading) and under Paragraph Styles I select APA Level 1 and click OK. This creates the hyperlinks but it also brings content from the draft into the TOC. I am so confused as to why it is doing this.

So this is what it looks like throughout the TOC

The image shows what is happening, but doesn’t give any hint as to how your document is laid out. Would it be possible to pare a copy of the document down to a few pages which demonstrate the problem? And attach the document here.

No, by default, Writer uses outline levels of paragraphs to build ToCs. Also by default, only Heading N styles have pre-set outline levels. But it is easy to set outline levels for other paragraphs manually, too; and some imported files / copy-pasted content may have a mess of outline levels…

TOC Format.odt (68.7 KB)
This is an exerpt of the document with the full TOC. I appreciate any help!

Your sample file is unusable because you only show the TOC and none of the faulty paragraphs lurking into the TOC.
Your document is also plagued with direct formatting which sheds doubt on your understanding of Writer mechanisms.
In addition a comment associated with the TOC title contains a link to a M$ Word site. Instructions there will surely not apply to Writer.
The fact you are using Default Paragraph Style betrays an incorrect use of styles, direct formatting routine and probably some editing with Word (which is confirmed by the existence of a Converted1 page style).
As an example of bad styling, you vertically space your text with empty paragraphs after the list of figures. It happens these paragraphs are styled DIS Chapter which are supposed to go into TOC. Luckily, Writer suppresses empty paragraphs in the TOC (a compatibility feature for bad Word routine?). You probably made the same mistake on your spurious paragraphs collected in the TOC.

The only mistake which can be corrected presently is the overspecification of hyperlink in your TOC structure. LS and LE are already present by default. There is no need to nest extra ones. And the hyperlinks already work. You must only Ctrl-click, not simply click.

This was the template I was provided by my school. I think it got severely corrupted due to multiple changes during the onslaught of re-submissions.

Just to mention it: You know the usual headings are working as links to the chapters available via Ctrl+mouse click ?
.
So you wish to achieve something else?

The most serious problem with this dummy document (a template in LO parlance is a technically different type of document with extra “interesting” properties preventing erasure and corruption when used to instantiate a new document) is it has been designed by somebody completely ignorant in modern document processing principles (personal opinion, you are free to disagree).

You can safely discard the “template” and write your document based on built-in styles, notably the outline family Heading n. This will avoid the ugly harmful tweaking on TOC collection which completely discards the standard engine (such a trick is normally used to include additional styles in the TOC, not to replace completely them). Then the look of the document can be made compliant with the “template” by customising built-in styles.

And, please, please, don’t use Default Paragraph Style. Contrary to Word, this is not the style for your discourse. It is a technical style, ultimate ancestor of all others. Its role is to configure default attributes shared with other styles (unless overridden). Modifying it can have unexpected effects if you are not aware of this inheritance fact. Style for text is Body Text.

Your sample’s ToC is set up to consider specific paragraph styles. If you apply those styles to parts of your text, those paragraphs will appear in the ToC. Your template expects that you use the pre-defined styles correctly, according to its author’s intentions.

Not addressing the hyperlinks question as such. However, I suspect that the cause of ToC “overflow” is not directly connected to your hyperlinking attempts.

Likely cause

  • You have used a heading style for chapter headings.
  • That heading style was - by accident - propagated to the next paragraph.
  • Instead of changing the next paragraph style to Text Body (the “correct” action), you just applied formatting manually (the “intuitive” action).

This kind of accident can easily occur. The Heading x paragraph styles have a “next style” setting of Text body by default, but this setting is applied only when you create a new paragraph (i.e. the cursor is at the very end of the heading paragraph). If you have characters (even a space, which is normally invisible) after the cursor when you press enter, you split the paragraph instead. In this case, the new paragraph will also have the heading style.

It may also happen when you copy text from other sources, and there are linefeeds in place of paragraph breaks. In your case it is more likely that you had a trailing space in your heading, and that this space “followed” to your body text below the heading. (I see that all the “wrong” entries have a leading space, while the proper ToC entries do not.)

Suggested solution

  • Choose an offending line in the ToC, and ctrl+click it to jump to the corresponding position in your document.
    Or you can scroll to the indicated page and select the paragraph there.
  • Press ctrl+0 (zero) to apply the Text body style.
  • Go back to the ToC and refresh it, and see whether the offending entry goes away.

If you find that this works as intended, repeat for all offending entries. Note that the “corrected” paragraphs may then have other formatting which may need additional work:

  • Shortcut key ctrl+M or menu selection Format - Remove direct formatting will “clean” your selection.
  • Slow and deliberate progress recommended.
  • Ctrl+Z (undo) is your friend.

Note that if you are in MacOS, you may need to use Cmd in some (maybe all) cases where Ctrl is specified above.

Recommended practices

  • Enable View - Formatting Marks while editing.
    This makes the text harder to read on screen, but the normally invisible characters are rendered with a symbol. This makes it easier to avoid the accident mentioned above.
  • Apply all formatting by way of styles
    This adds a “level of abstraction”, so you may feel it less intuitive. You will quickly get used to it, and it is much less labor to work on large documents when you do.
1 Like

I see that the page style in use is named “Converted1”. This suggests to me that the original template was created in a different application (most likely Microsoft Word). This may have brought other “format residue” which messes up document structure in certain situations.

I also see that the DIS chapter and APA level 1 paragraph styles, which the ToC uses for L1 and L2 entries, respectively, are both defined as “level 0” (body text) in the outline structure of the document, and point to themselves for “next style”. This suggests to me that the one who made the template still has something to learn.
Cf. also the comment from @mikekaganski:

1 Like

… sigh …

There is more.

The template is undoubtedly made with the intention to facilitate the building of an APA compliant document. Some good effort has been made. Alas, structurally it is a mess, and “Microsoft Word logic” seems to play a role.

My previous advice to apply Text Body style to body text will yield undesired outcome.

Etc. etc.

I do not accept any blame, but I am truly sorry.

@keme1 your conclusions meet mine. It’ll be faster, safer and easier to write the dissertation from scratch and configure the “standard” built-in styles to look like the “template”.

1 Like

So, @SoulFighter73, would you care to share the template (as shared with you from school, before you added any content) with us, or a download link if it is freely available (not behind a login)?

Please enclose any instructions you received about the use of the template. There may be clues there to help us to help you, so your dissertation comes out as the recipient expects, visually and structurally.

Also, I am curious about the details myself. There are certainly elements I have missed, possibly important ones. If I can learn something and help you, it is a win-win situation. Perhaps even win-win-win. :wink:

1 Like