Next in thread →
Next in month →
Re: [docbook-apps] Setting book toc.indent.width for sect1
Problem solved. I realized that when I added parts to a book, the
toc.indent.width value was doubled for the section entries - it's
cumulative. I found the right template that affects the
toc.indent.width for chapters, and needed to customize it for books
both with and without parts. Here is my code (with a new variable
"toc.indent.width.sections" expressed in points, which provides left
margin for all section, sect1, etc... titles):
<xsl:template match="d:preface|d:chapter|d:appendix|d:article"
mode="toc">
<xsl:param name="toc-context" select="."/>
...
<xsl:if test="$toc.section.depth > 0
and $toc.max.depth > $depth.from.context
and $nodes">
<!--reset toc width for sections (flush left margin):
13/10/12-->
<xsl:choose>
<!--for book with parts: OK 14/10/12-->
<xsl:when test="parent::d:part">
<fo:block id="toc.{$cid}.{$id}"
margin-left="-{$toc.indent.width}pt+{$toc.indent.width.sections}pt">
<!--<xsl:attribute
name="margin-{$direction.align.start}">
<xsl:call-template name="set.toc.indent"/>
</xsl:attribute>-->
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context"
select="$toc-context"/>
</xsl:apply-templates>
</fo:block>
</xsl:when>
<!--for book with no parts: OK 14/10/12-->
<xsl:otherwise>
<fo:block id="toc.{$cid}.{$id}"
margin-left="{$toc.indent.width.sections}pt">
<!--<xsl:attribute
name="margin-{$direction.align.start}">
<xsl:call-template name="set.toc.indent"/>
</xsl:attribute>-->
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context"
select="$toc-context"/>
</xsl:apply-templates>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
On 13-10-12 6:33 PM, Xmplar wrote:
X-NONE
X-NONE
MicrosoftInternetExplorer4
In a book toc, I need to set the first-level
sections listed under each chapter against the left margin of
the toc.
The screenshot showing the sections listed
under Chapter 2 is what I’m trying to achieve with a
customization of toc.indent.width (I think that’s what I need
anyway).
I used a single toc.indent.width value
(29pt), and in the FO I changed the margin-left for the fo:block
that has a chapter id number, to give it a negative value for
toc.indent.width. The fo code is:
<fo:block id="toc.d0e1.chap2" margin-left="-29pt">
<fo:basic-link
internal-destination="sec2.1">
<fo:list-block
provisional-label-separation="1mm"
provisional-distance-between-starts="10mm" >
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block
Setting the value of -29pt once for each
chapter will set the left margin correctly for all section
entries listed in each chapter.
But how do I apply that margin-left value in
the stylesheets? I tried modifying the relevant code in the template <xsl:template match="d:book|d:setindex" mode="toc">.
The fo:block in that template seems obvious,
but that oddly didn’t apply the left-margin to the FO:
<fo:block id="toc.{$cid}.{$id}"
margin-left=”-29pt”>
<xsl:attribute name="margin-{$direction.align.start}">
<xsl:call-template name="set.toc.indent"/>
</xsl:attribute>
Thanks in advance!
--
Dave Gardiner
Next in thread →
Next in month →