Hi Jean-Yves

I don't know if this should be addressed to you, so my apologies if I have
sent my info to the wrong person. If I have, perhaps you will be kind enough
to forward it to the right person :)

I noticed that for PDF output the autogenerated Table of Contents produced a
ragged column of page numbers instead of a neatly right-justified column,
but I wasn't able to see how to correct the formatting.

However, I recently looked at eNovative's (http://docbook.e-novative.de/)
.xsl files after seeing neatly formatted page numbers in a ToC and
discovered one possible solution. It works for me, anyway.

In the file autotoc.xsl (path: $XFC_HOME/xsl/docbook/fo/autotoc.xsl) there
is a section that begins:

<xsl:template name="toc.line">

Part way into the block is a section that looks like this:

        <fo:inline keep-together.within-line="always">
          <xsl:text> </xsl:text>
          <fo:leader leader-pattern="dots"
                     keep-with-next.within-line="always"/>
          <xsl:text> </xsl:text>
          <fo:basic-link internal-destination="{$id}">
            <fo:page-number-citation ref-id="{$id}"/>
          </fo:basic-link>
        </fo:inline>

I discovered that the addition of two lines appears to cure the ragged
positioning of the page numbers in the ToC generated for a PDF:

        <fo:inline keep-together.within-line="always">
          <xsl:text> </xsl:text>
          <fo:leader leader-pattern="dots"
                     leader-pattern-width="3pt"  <-- add this line
                     leader-alignment="reference-area"  <-- and add this
line
                     keep-with-next.within-line="always"/>
          <xsl:text> </xsl:text>
          <fo:basic-link internal-destination="{$id}">
            <fo:page-number-citation ref-id="{$id}"/>
          </fo:basic-link>
        </fo:inline>

The two lines are the only difference in this small section between the
autotoc.xsl file that is used by eNovative and the autotoc.xsl file I
obtained when I downloaded XFC/XXE.

Hope this helps someone,

Best wishes,

Peter

Reply via email to