Hi,
If you want to position the title at a constant distance from the left
margin, regardless of the width of the chapter number, then you can use an
fo:list-block. I called it 'side-by-side' formatting, and an example for
section titles is described here:
http://www.sagehill.net/docbookxsl/SideBySide.html
The trick is to use mode="label.markup" to generate just the chapter number
and mode="title.markup" to generate just the title, putting each in a
separate part of the fo:list-item.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "Johannes Katelaan" <[email protected]>
To: <[email protected]>
Sent: Wednesday, November 11, 2009 6:23 AM
Subject: Re: [docbook-apps] space between chapter number and chapter text?
OK - I found a solution myself. I don't know if this is the best way to do
it, but it works fine for me.
In case somebody is interested in my solution, here it is:
Change the customization layer for the chapter and section titles as
follows:
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="de">
<l:context name="title-numbered">
<l:template name="chapter" text="%n|%t"/>
<l:template name="sect1" text="%n|%t"/>
<l:template name="sect2" text="%n|%t"/>
</l:context>
</l:l10n>
</l:i18n>
This adds a pipe character as a separator between the chapter or section
number and the text.
Copy the template "component.title" to the customization layer stylesheet
and modify the end of this template as follows:
<xsl:otherwise>
<!-- not in a section: do nothing special -->
<!-- original code: -->
<!--
<xsl:copy-of select="$title"/>
-->
<!-- modified code: -->
<fo:inline>
<xsl:copy-of select="substring-before($title,'|')"/>
</fo:inline>
<fo:inline space-start="15mm">
<xsl:copy-of select="substring-after($title,'|')"/>
</fo:inline>
</xsl:otherwise>
Copy the template "section.heading" to the customization layer stylesheet
and modify as follows:
<xsl:choose>
<xsl:when test="$level=1">
<fo:block
xsl:use-attribute-sets="section.title.level1.properties">
<!-- original code: -->
<!--
<xsl:copy-of select="$title"/>
-->
<!-- modified code: -->
<fo:inline>
<xsl:copy-of
select="substring-before($title,'|')"/>
</fo:inline>
<fo:inline space-start="11.5mm">
<xsl:copy-of
select="substring-after($title,'|')"/>
</fo:inline>
</fo:block>
</xsl:when>
<xsl:when test="$level=2">
<fo:block
xsl:use-attribute-sets="section.title.level2.properties">
<!-- original code: -->
<!--
<xsl:copy-of select="$title"/>
-->
<!-- modified code: -->
<fo:inline>
<xsl:copy-of
select="substring-before($title,'|')"/>
</fo:inline>
<fo:inline space-start="10mm">
<xsl:copy-of
select="substring-after($title,'|')"/>
</fo:inline>
</fo:block>
</xsl:when>
Yes, the space between the number and the text is hard-coded and this will
break, if the font sizes for chapter and section titles are changed.
A better solution would be to position the title text relative to the left
border of the page. But I don't know how to do this.
Johannes
Am 11.11.2009 um 10:16 schrieb Johannes Katelaan:
Hi!
In my customization layer I changed the chapter titles as follows:
<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="de">
<l:context name="title-numbered">
<l:template name="chapter" text="%n %t"/>
</l:context>
</l:l10n>
</l:i18n>
I did this to get rid of the word "Kapitel" in the German chapter title.
This work fine. So I get chapter titles in the form "number and text" now.
My question: Is it possible to change the amount of space between the
number and the text? I tried to insert additional space characters between
the %n and the %t, but this had no effect at all.
In my final layout I intend to have something like this:
1 title chapter one
1.1 title section level one
1.1.1 title section level two
with all the texts starting at the same distance from the left border of
the paper.
Is this possible?
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]