Ask Your Question
0

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

asked 2018-06-17 03:35:37 +0100

joshisanonymous gravatar image

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-06-17 08:21:04 +0100

ajlittoz gravatar image

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!

edit flag offensive delete link more

Comments

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!

joshisanonymous gravatar imagejoshisanonymous ( 2018-06-18 00:42:52 +0100 )edit
0

answered 2018-06-17 13:43:36 +0100

RGB-es gravatar image

updated 2018-06-17 13:44:23 +0100

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.

image description

edit flag offensive delete link more

Comments

This sounds like by far the easiest solution, but unfortunately it won't work in my case because I'm not using E#. (This is because I needed to use another workaround to get chapters with Roman numerals but subheadings with all Arabic numerals.)

joshisanonymous gravatar imagejoshisanonymous ( 2018-06-18 00:33:58 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-06-17 03:35:37 +0100

Seen: 69 times

Last updated: Jun 17 '18