# How do I get the chapter number and title on separate lines in TOC?

This seems like the opposite problem that most people come across. I used Writer's chapter numbering system and generated a table of contents from my headings. For each chapter heading, I have something like the following:

Chapter I

Introduction

I used shift+enter to create line breaks between "Chapter I" and "Introduction" so that it would be treated as one entry in the table of contents, even though it spans multiple lines. However, I actually need it to show up on two lines, single-spaced, in the table of contents. Like so:

Chapter I
Introduction .......... 1

Is there a way to make this happen?

edit retag close merge delete

Sort by » oldest newest most voted

There is no way to do that with Writer. Ideally, we could insert a line break in the text box between E# and E when customising TOC settings in the Entries tab. Unfortunately, control chars are filtered when pasting.

I found a workaround if you feel a little brave and are not afraid of tweaking XML

• Once your document is in its final shape, save it and make a copy as a flat XML file (.fodt extension)

• Open the .fodt file with a text editor (not LO Writer) and find the TOC

• Where you would like a line-break, paste there

<text:line-break/>

• Save the patched file

• Open it with LO Writer to check the result and save it as .odt under a different name than the original document.

Note that whenever you update the TOC, the TOC is recomputed by Writer and your patches are lost. You must re-insert then by hand. This is why it is important, for safety sake, never to overwrite the original document.

I tried to insert the magic XML element in the TOC template, but it is wiped out when the TOC is generated (it is likely that the template is filtered first to eliminate inconsistencies and unmanageable constructs).

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!

more

Worked like a charm once I figured out where the lines in the TOC were. This is a 100 page thesis, so it's a very long, very messy looking text file to me. Thanks!

( 2018-06-18 00:42:52 +0100 )edit

It's possible, even easy, but far from "elegant" :)

Edit your TOC, go to the "structure" tab and, between E# and E start adding spaces until you see, on the preview, that the text went to the second line.

more