Next in thread → Next in month →

Re: [docbook-apps] TOC placement in pdf

From
Bob Stayton <>
Date
2023-02-23T17:22:38+00:00
ID
Thread
Re: [docbook-apps] TOC placement in pdf
Actually,
          there's a param for that. If you insert an empty <toc/>
          element in your content, and set this param:

    
process.empty.toc.element=1

    
and set
          generate.toc to blank (to turn off the default toc), then the
          stylesheet will generate a toc where that <toc/> element
          is located. Apparently this param came after the last edition
          of my book so it isn't covered there, but it is included in
          the fo parameter reference doc online.

        

    
Unfortunately,
          the content model of article does not allow a toc element
          after normal content, even though the stylesheet doesn't
          care. So you either have to tolerate a validation error, or
          insert the empty toc element just before processing.

    
Perhaps
          a cleaner customization would be to insert a processing
          instruction instead of an empty toc element so it validates,
          and write some XSL to process that PI using the XSL code
          borrowed and customized from the template that starts with 

        

    
<xsl:template
          match="chapter/toc | appendix/toc | preface/toc |
          article/toc">

    
from
          fo/toc.xsl. Basically you want to call the template named
          'component.toc' but with the right context. I haven't tried
          this, but it should work.

        

    
Bob

    

    
On 2/22/2023 9:15 PM, rohith R wrote:

    

    
      
      
Hmmm,
        
ÂI'll check.

        
I'd prefer to control it via xsl if that's
          possible as it provides max flexibility.

        
Not sure if it's possible ðÂ

      

      

      

        
On Tue, 21 Feb 2023, 6:17 pm
          Dave Pawson, <>
          wrote:

        

        Can you use
          the <toc/> element to place it where you want?

          

          

          HTH

          

          On Tue, 21 Feb 2023 at 06:28, Richard Hamilton <>
          wrote:

          >

          > Hello,

          >

          > The element Iâve used to put things before the toc is
          <dedication>, which allows a lot more elements than you
          might expect, including paragraphs and tables.

          >

          > It is an abuse of the tag, (Iâve used it only for a
          dedication in our books), but in a pinch, it might do what you
          need.

          >

          > Iâm sure others on this list may have some good (probably
          better:) ideas, but Iâm not sure you can do what you want to
          do with any other element, unless you modify the stylesheets.

          >

          > I hope that helps.

          > Dick Hamilton

          > -------

          > XML Press

          > XML for Technical Communicators

          > http://xmlpress.net

          > 

          >

          >

          >

          > > On Feb 20, 2023, at 23:04, rohith R <>
          wrote:

          > >

          > > Hi,

          > >

          > >

          > > I'm using an article style docbook and convert it
          into pdf.

          > >

          > > The TOC is getting generated after the title page. I
          want it before the section but after the front matter. How can
          I accomplish this?

          > >

          > > My article structure (docbook5):

          > > - title page

          > > - other stuff (text and couple of tables)

          > > - multiple sections <section>

          > >

          > > I want the TOC placed after "other stuff" and before
          sections.

          > >

          > > How can I accomplish it?

          > > At the moment they get generated after title page
          when generating pdf.

          > >

          > > Regards,

          > > R

          >

          >

          >
          ---------------------------------------------------------------------

          > To unsubscribe, e-mail: 

          > For additional commands, e-mail: 

          >

          

          

          -- 

          Dave Pawson

          XSLT XSL-FO FAQ.

          Docbook FAQ.

          

---------------------------------------------------------------------

          To unsubscribe, e-mail: 

          For additional commands, e-mail: 
Next in thread → Next in month →