[Solved] Deliberately different Headings, ToC entries

Writing a book, Automating Document Production - Discuss your special needs here

[Solved] Deliberately different Headings, ToC entries

Postby Akram » Fri Mar 25, 2016 4:29 am

I have a client who would like to have a Toc generated from 'Heading 1' chapter headings. That part is simple. The complication is that they want to have more characters in the ToC entry than are in the heading itself. For example:

Heading: Chapter 9
Toc entry: Chapter 9, Message from my father ......................... 57

I can think of inelegant ways to do this:
  1. put the characters ', Message from my father' into the heading, then manually change the character colour to white so that they are invisible and minimise the character size so they do not force an extra line break.
  2. keep a separate list of the extra characters, and manually insert them into each entry after I do the final update of the page numbers
  3. manually create an entire ToC and add page numbers by hand.
For obvious reasons, I would prefer a solution more elegant, robust and adaptable than all of these. I call on the ingenuity of this forum to offer a better alternative.
Last edited by Akram on Fri Mar 25, 2016 7:46 am, edited 1 time in total.
OpenOffice 4.1.3 and LibreOffice 5.3.3.2 on Windows XP, LibreOffice 5.3.3.2 on Windows 10, Portable LibreOffice 5.3.3.2 on MicroSD card
Akram
 
Posts: 20
Joined: Sat May 10, 2014 10:43 am

Re: Deliberately different Headings, Table of Contents entri

Postby acknak » Fri Mar 25, 2016 6:48 am

I think you've covered the options.

One straightforward approach would be to format the extra characters with "hidden" formatting. Writer normally ignores formatting in the heading, so things like superscripts are lost when they should be kept, but it honors "hidden" formatting, which you'd like to be ignored in this case.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Deliberately different Headings, Table of Contents entri

Postby Akram » Fri Mar 25, 2016 7:44 am

Thanks. You gave me the idea of formatting the hidden parts of the headings as conditional text, linked to a control variable I can set on the ToC page. This is not perfect, but it at least allows me to switch all the full headings on at once, update the ToC (with full headings), then hide the conditional text of all headings at once and create a pdf. I just need to keep an eye out for any pagination glitches triggered by unlucky line breaks.

I'd been hoping for a single conditional variable, based on page number, which would show text if the page number was that of the ToC, but hide it elsewhere. It seems the page number variable is not accessible to the conditional logic, though.

On balance, I consider this problem solved.
OpenOffice 4.1.3 and LibreOffice 5.3.3.2 on Windows XP, LibreOffice 5.3.3.2 on Windows 10, Portable LibreOffice 5.3.3.2 on MicroSD card
Akram
 
Posts: 20
Joined: Sat May 10, 2014 10:43 am

Re: [Solved] Deliberately different Headings, ToC entries

Postby acknak » Fri Mar 25, 2016 2:48 pm

Clever! Generate the ToC with the extras on, then turn them off.

That should be fine as long as none of the longer headings span more than one line. Otherwise, turning off the longer headings may invalidate the page numbers in the ToC.

PS: perhaps a simpler way to do this is to apply a custom character style to the extra text in the headings. You can turn them on/off by changing the "hidden" property. Saves some mucking about with the conditional text.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Deliberately different Headings, ToC entries

Postby Akram » Fri Mar 25, 2016 2:57 pm

Yes, indeed, that is a further refinement made manageable by having the text permanently present in the headings. I shall do that. Thanks.
OpenOffice 4.1.3 and LibreOffice 5.3.3.2 on Windows XP, LibreOffice 5.3.3.2 on Windows 10, Portable LibreOffice 5.3.3.2 on MicroSD card
Akram
 
Posts: 20
Joined: Sat May 10, 2014 10:43 am


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 1 guest