Contents | Start | End | Previous: KB0435: How can I remove line breaks at the end of paragraphs? | Next: KB0437: Should I use Epub or Mobi files for Kindle?


KB0436: How can I combine headings when exporting ODT?

In an advanced table of contents, Jutoh has the ability to combine consecutive headings - the main heading, and a secondary heading. So if you have chapter headings that look like this:

CHAPTER ONE

BEGINNINGS

you can create a table of contents with entries like this:

CHAPTER ONE: BEGINNINGS

However, when exporting to ODT and using the special table of contents feature that replaces the Jutoh TOC with an ODT automatic TOC, only the main headings will be added to the TOC entries. There is no native ODT or LibreOffice facility to combine headings. So either you have to do without combined headings, or you have to switch off the special TOC feature in your configuration and use the Jutoh-generated TOC - without any page numbers, which isn't great for print.

Here's a workaround, which does mean fiddling with the LibreOffice file each time you import from the ODT file, but may be better than nothing.

The idea is to create a hidden paragraph using a style called (say) "Hidden" after each chapter title that contains Heading A: Heading B. These paragraphs won't show in the final document (printout/PDF) but they can still be used to generate a TOC, by editing the TOC to find "Hidden" paragraphs instead of actual headings.

So the procedure for applying this solution to a Jutoh project would be something like this:

  1. Create a paragraph style called "Hidden". There is no 'hidden' attribute in Jutoh so you would need to set this in LibreOffice after importing the ODT file.

  2. In all your configurations except OpenDocument, type "Hidden" into the option Paragraphs to exclude, so these paragraphs go away in most formats.

  3. Add paragraphs containing the combined heading after each subheading in your chapters, and apply "Hidden" to them.

  4. Also add a blank "Normal" (or other) paragraph after this, because of an apparent bug in LibreOffice that removes paragraph spacing from after the subheading when the text is hidden. For finer control, you could apply a special paragraph style to this blank paragraph for extra spacing that is only used for ODT.

    The hidden paragraph must be added after the subheading, because otherwise Jutoh will get confused for other formats if the first paragraph is removed during the compile (bookmarks also get deleted).

    If your headings are automatically numbered or contain fields, you can use a cross-reference to the real heading in your hidden headings, so it gets updated automatically.

  5. Compile your ODT file and open it in LibreOffice.

  6. Edit the "Hidden" style and in Font Effects, check Hidden.

  7. Right-click over the table of contents and click Edit Index, then click Assign Styles.

  8. By "Heading 1", click the first column to remove it from the index. By "Hidden", click the second column to add it to the index.

  9. Click OK and OK again, and you will see the correctly formatted TOC.

  10. To see the hidden text within LibreOffice, use Tools | Options and under LibreOffice Writer / Formatting Aids, check Hidden characters.

So the steps you will need to take every time you compile the ODT file in Jutoh and open it in LibreOffice are 5 - 8.


Contents | Start | End | Previous: KB0435: How can I remove line breaks at the end of paragraphs? | Next: KB0437: Should I use Epub or Mobi files for Kindle?