OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Centering chapter titles with fop


Hi,
The FO stylesheet currently has two methods of customizing chapter titles.
The titlepage spec file sets properties, but then so does the attribute-set
named 'component.title.properties' in fo/param.xsl.  That attset is more
convenient, and it overrides the titlepage spec file.  So the answer to your
problem is to set the property in the component.title.properties
attribute-set.

The stylesheet *should* be set up so the attribute-set is empty by default,
and all properties set in the spec file.  In fact, there is a bug report
about this, and I've been meaning to fix it for some time.  Then your
customization of the spec file would work (because the att-set is empty), as
would anyone's customization of the attribute set to override the spec file.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Michèle Garoche" <michele.garoche@easyconnect.fr>
To: "Bob Stayton" <bobs@sagehill.net>
Cc: "docbook-apps" <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, December 13, 2005 2:08 PM
Subject: Re: [docbook-apps] Centering chapter titles with fop



Le 13 déc. 2005 à 21:55, Bob Stayton a écrit :

> Hi,
> It is hard to tell what you have missed if you don't tell us what
> you tried.
> 8^)
Admittingly, I was tired the day I wrote that :-)
> More details please.
So, I repost my answer to Gian's questions from December 7th (a long
one)- Let me know if you want all the documents, I'll post them on my
web site.:

Actually I discover that this is not the same for chapter, preface
and appendix.

This a book with multiple files, double-sided .

There is a customization of titlepage-template, mainly to reduce the
space before and after:

A - For preface:

   <t:titlepage t:element="preface" t:wrapper="fo:block">
     <t:titlepage-content t:side="recto">
       <title
     t:force="1"
     t:named-template="component.title"
     param:node="ancestor-or-self::preface[1]"
     margin-left="{$title.margin.left}"
     font-size="&hsize5;"
     font-family="{$title.fontset}"
     font-weight="bold"
     text-align="center"
     start-indent="0pt"
     space-before.minimum="0em"
     space-before.optimum="0em"
     space-before.maximum="0em"
     space-after="0em"/>

B - For Appendix

   <t:titlepage t:element="appendix" t:wrapper="fo:block">
     <t:titlepage-content t:side="recto">
       <title
     t:named-template="component.title"
     param:node="ancestor-or-self::appendix[1]"
     margin-left="{$title.margin.left}"
     font-size="&hsize4;"
     font-weight="bold"
     text-align="center"
     space-before.minimum="0em"
          space-before.optimum="0em"
          space-before.maximum="0em"
          font-family="{$title.fontset}"/>

(Notice the lack of start-indent="0pt" here, a mistake from my part).
Without it, Appendix is not centered, in both versions of stylesheet,
with it, it is centered in 1.68.1 only.

C - For Chapter

   <t:titlepage t:element="chapter" t:wrapper="fo:block"
                font-family="{$title.fontset}">
     <t:titlepage-content t:side="recto" margin-
left="{$title.margin.left}">
       <title t:named-template="component.title"
     param:node="ancestor-or-self::chapter[1]"
     font-size="&hsize5;"
     font-weight="bold"
     text-align="center"
     start-indent="0pt"
     space-before.minimum="0em"
     space-before.optimum="0em"
     space-before.maximum="0em"
     space-after="0em"/>

There is also a custom layer:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/
fo/docbook.xsl"/>
(Actually this is resolved locally to 1.68.1 or 1.69.1 depending of
which version I install)

<xsl:import href="titlepage-a4.xsl"/>

<!-- Allow to use extensions -->
<xsl:param name="use.extensions" select="'1'"></xsl:param>
<!-- For bookmarks -->
<xsl:param name="fop.extensions" select="1"></xsl:param>

<!-- Ensure the page orientation is portrait -->
<xsl:param name="page.orientation" select="portrait"></xsl:param>

<!-- A4 format -->
<xsl:param name="paper.type" select="'A4'"></xsl:param>
<xsl:param name="page.width" select="'210mm'"></xsl:param>
<xsl:param name="page.height" select="'297mm'"></xsl:param>

<!-- Double-sided -->
<xsl:param name="double.sided" select="1"></xsl:param>

<!-- Margins -->
<xsl:param name="page.margin.top" select="'7.5mm'"></xsl:param>
<xsl:param name="page.margin.bottom" select="'7.5mm'"></xsl:param>
<xsl:param name="region.before.extent" select="'5mm'"></xsl:param>
<xsl:param name="region.after.extent" select="'5mm'"></xsl:param>
<xsl:param name="body.margin.top" select="'10mm'"></xsl:param>
<xsl:param name="body.margin.bottom" select="'10mm'"></xsl:param>
<xsl:param name="page.margin.inner" select="'15mm'"></xsl:param>
<xsl:param name="page.margin.outer" select="'12mm'"></xsl:param>

<!-- No headers on blank pages -->
<xsl:param name="headers.on.blank.pages" select="0"></xsl:param>

<!-- Indentation of the titles for sections -->
<xsl:param name="title.margin.left" select="'-1pc'"/>

<!-- Chapter autolabelling -->
<xsl:param name="chapter.autolabel" select="'I'"/>
<!-- Section autolabelling -->
<xsl:param name="section.autolabel" select="'1'"/>


<!-- Size of body font -->
<xsl:param name="body.font.master">10</xsl:param>
<xsl:param name="body.font.size">
<xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
</xsl:param>

<!-- Prohibites hyphenation -->
<xsl:param name="hyphenate">false</xsl:param>

...
</xsl:stylesheet>



>
> 2.) Next, show us a minimal snippet of the output .fo (not the PDF)
> created from that with 1.68 and 1.69.1 for the chapter.  They
> should be different, because as you say the former works but the
> latter doesn't.
>

I've redone the production of pdf with exactly the same customized
stylesheets for 1.68.1 and 1.69.1, because actually there were
differences in the versions (keep-with-next for 1.68.1 and keep-with-
next-within-columns for 1.69.1 in official template) and also a
difference in start-indent in appendix or chapter.

So, now preface, chapters are centered in 1.68.1 but not appendix
(unless I put start-indent="0pt" as stated above); None are  centered
in 1.69.1.

I - Here are the differences for appendix:

a - Appendix not centered in 1.68.1 (lack of start-indent="0pt)

<fo:flow flow-name="xsl-region-body"
start-indent="4pc"
end-indent="0pt">
<fo:block id="bluefish-appb">
<fo:block>
<fo:block>
<fo:block
margin-left="-1pc"
font-size="20.736pt"
font-weight="bold"
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block
keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
start-indent="0pt"
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Appendix B. Bluefish change
history</fo:block>
</fo:block>
</fo:block>
</fo:block>
</fo:block>

b - Appendix centered in 1.68.1 (with start-indent="0pt")

<fo:flow flow-name="xsl-region-body"
start-indent="4pc"
end-indent="0pt">
<fo:block id="bluefish-appa">
<fo:block>
<fo:block>
<fo:block margin-left="-1pc"
font-size="20.736pt"
font-weight="bold"
text-align="center" (change here)
start-indent="0pt" (change here)
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
start-indent="0pt"
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Appendix A. Credits<fo:block>
</fo:block>
</fo:block>
</fo:block>
</fo:block>

Notice the integration of text-align and start-indent in the first
fo:block.

c - Appendix not centered on 1.69.1 (without start-indent)

<fo:flow flow-name="xsl-region-body"> (change here)
<fo:block id="bluefish-appb">
<fo:block>
<fo:block>
<fo:block
margin-left="-1pc"
font-size="20.736pt"
font-weight="bold"
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block
keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
text-align="left" (change here)
start-indent="-1pc" (change here)
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Appendix B. Bluefish change
history</fo:block></fo:block>
</fo:block>
</fo:block>
</fo:block>

So, basically, two changes: one for the pc thing, and a text-
align="left" introduced in 1.69.1 (I cannot understand where it comes
from).

d - Appendix not centered on 1.69.1 (with start-indent-

<fo:flow flow-name="xsl-region-body"> (change here-
<fo:block id="bluefish-appa">
<fo:block>
<fo:block>
<fo:block margin-left="-1pc"
font-size="20.736pt"
font-weight="bold"
text-align="center"
start-indent="0pt"
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
text-align="left" (change here)
start-indent="-1pc" (change here)
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Appendix A. Credits</fo:block>
</fo:block>
</fo:block>
</fo:block>
</fo:block>

It seems that 1.69.1 overrides whichever change is made to alignement
and start-indent with what is defined for title-margin-left. (i.e. no
distinction between chapter, preface, appendix and section titles).

II - chapter:

a - Chapter centered on 1.68.1


<fo:flow flow-name="xsl-region-body"
start-indent="4pc"
end-indent="0pt">

<fo:block id="debugging-bluefish">
<fo:block font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block margin-left="-1pc">

<fo:block font-size="24.8832pt"
font-weight="bold"
text-align="center"
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
space-after="0em">

<fo:block keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
start-indent="0pt"
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Chapter 4. Debugging
Bluefish</fo:block>

</fo:block>
</fo:block>
</fo:block>
</fo:block>


b - Chapter not centered on 1.69.1


<fo:flow flow-name="xsl-region-body"> (change here)

<fo:block id="debugging-bluefish">
<fo:block font-family="sans-serif,Symbol,ZapfDingbats">
<fo:block margin-left="-1pc">

<fo:block font-size="24.8832pt"
font-weight="bold"
text-align="center"
space-before.minimum="0em"
space-before.optimum="0em"
space-before.maximum="0em"
space-after="0em">

<fo:block keep-with-next.within-column="always"
space-before.optimum="10pt"
space-before.minimum="10pt * 0.8"
space-before.maximum="10pt * 1.2"
hyphenate="false"
text-align="left" (change here)
start-indent="-1pc" (change here)
hyphenation-character="-"
hyphenation-push-character-count="2"
hyphenation-remain-character-count="2">Chapter IV. Debugging
Bluefish</fo:block>

</fo:block>
</fo:block>
</fo:block>
</fo:block>

So, there changes: two related to pc, and the same text-align="left"
introduced. Same observation that above for appendix.


>
> 3.) If they are different, confirm that the template for chapters
> have changed between 1.68 and 1.69.1 for the FO docbook stylesheets.
>
I cannot find anything meaningfull different (at least for me). So
apart from the keep-with-next.within-column or keep-with-next and the
pc thing (margin), I don't see anything changing.


> Once you drill down to this level, it is just a question of
> inquiring why the templates changed between 1.68 and 1.69.1 for
> chapters.
>
The question is more for me, how do I persuade fop to take my desires
into account :-)

>
> Bob Stayton
> Sagehill Enterprises
> DocBook Consulting
> bobs@sagehill.net
>
>
> ----- Original Message -----
> From: "Michèle Garoche" <michele.garoche@easyconnect.fr>
> To: "docbook-apps" <docbook-apps@lists.oasis-open.org>
> Sent: Tuesday, December 06, 2005 2:00 PM
> Subject: [docbook-apps] Centering chapter titles with fop
>
> Hello,
>
> I'm using docbook 4.4, docbook-xsl 1.69.1 and fop 0.25.
>
> I try to get the preface, chapter and appendix titles centered, while
> section titles are left-margined, but cannot. It used to work with
> docbook-xsl 1.68.
>
> Is there something I missed?
>
> Cheers,
> Michèle
> <http://micmacfr.homeunix.org>
>
>
>
>

Amicalement,
Michèle
<http://micmacfr.homeunix.org>








[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]