I think setting the table width to a hard value is necessary for that workaround to
work. Setting table width to 50% means 50% of the table's context, which is a table
cell of variable width. Too many variables. 8^)
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "Ron Catterall" <[email protected]>
To: <[email protected]>
Sent: Saturday, May 08, 2010 8:36 AM
Subject: [docbook-apps] centered table problem
Hi all (especially Bob)
I have a problem centering a table on a page of FO-->PDF output using
XEP 4.18 (Saxon 6.5.5 and latest Docbook 5 NS style sheet)
With no customization this table gives the expected result - see
attached file not_centered.jpg
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE article>
<article xml:id="ARTICLE" xmlns="http://docbook.org/ns/docbook"
version="5.0" xml:lang="EN">
<info><title>Title of article</title></info>
<sect1 xml:id="SECT1" xmlns="http://docbook.org/ns/docbook"
version="5.0" xml:lang="EN">
<info><title>SECT1 TITLE</title></info>
<sect2 xml:id="SECT2" xmlns="http://docbook.org/ns/docbook"
version="5.0" xml:lang="EN">
<info><title>SECT2 TITLE</title></info>
<?dbfo-need height="5.5in" ?>
<table frame="all" xml:id="ID" colsep="1" rowsep="1">
<info><title>TITLE OF TABLE</title></info>
<?dbfo table-width="50.0%" ?>
<tgroup align="center" cols="4" colsep="1" rowsep="1">
<colspec colname="cl" colwidth="0.5*"/>
<colspec colname="c2" colwidth="1.0*"/>
<colspec colname="c3" colwidth="1.5*"/>
<colspec colname="c4" colwidth="2.0*"/>
<spanspec align="center" nameend="c4" namest="c1"
spanname="hspan"/>
<thead><row valign="middle"><entry spanname="hspan"
align="center">HEAD</entry></row></thead>
<tfoot><row valign="middle"><entry spanname="hspan"
align="center">FOOT</entry></row></tfoot>
<tbody>
<row valign="middle">
<entry align="center">1</entry><entry
align="center">a</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">2</entry><entry
align="center">b</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">3</entry><entry
align="center">c</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">4</entry><entry
align="center">d</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">5</entry><entry
align="center">e</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">6</entry><entry
align="center">f</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
</article>
Customizing using the recipe from Stayton p.474 and XEP4.18 the table is
off center and its width drastically reduced - see attached file
centered.jpg
<xsl:template name="table.layout">
<xsl:param name="table.content"/>
<fo:table width="100%">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-column/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body start-indent="0pt">
<fo:table-row>
<fo:table-cell/>
<fo:table-cell>
<fo:table>
<fo:table-body start-indent="0pt">
<fo:table-row><fo:table-cell><fo:block>
<xsl:copy-of select="$table.content"/>
</fo:block></fo:table-cell></fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-cell>
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
If I set the colwidths to 0.5cm instead of 0.5* etc the table is
centered correctly. It appears that the proportional widths from FO and
CALS are interfering with each other.
Does anyone know a way around this problem?
Ron
--
Ron Catterall Ph.D. D.Sc.
[email protected]
http://catterall.net
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE article>
<article xml:id="ARTICLE" xmlns="http://docbook.org/ns/docbook" version="5.0"
xml:lang="EN">
<info><title>Title of article</title></info>
<sect1 xml:id="SECT1" xmlns="http://docbook.org/ns/docbook" version="5.0"
xml:lang="EN">
<info><title>SECT1 TITLE</title></info>
<sect2 xml:id="SECT2" xmlns="http://docbook.org/ns/docbook" version="5.0"
xml:lang="EN">
<info><title>SECT2 TITLE</title></info>
<?dbfo-need height="5.5in" ?>
<table frame="all" xml:id="ID" colsep="1" rowsep="1">
<info><title>TITLE OF TABLE</title></info>
<?dbfo table-width="50.0%" ?>
<tgroup align="center" cols="4" colsep="1" rowsep="1">
<colspec colname="cl" colwidth="0.5*"/>
<colspec colname="c2" colwidth="1.0*"/>
<colspec colname="c3" colwidth="1.5*"/>
<colspec colname="c4" colwidth="2.0*"/>
<spanspec align="center" nameend="c4" namest="c1"
spanname="hspan"/>
<thead><row valign="middle"><entry spanname="hspan"
align="center">HEAD</entry></row></thead>
<tfoot><row valign="middle"><entry spanname="hspan"
align="center">FOOT</entry></row></tfoot>
<tbody>
<row valign="middle">
<entry align="center">1</entry><entry
align="center">a</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">2</entry><entry
align="center">b</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">3</entry><entry
align="center">c</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">4</entry><entry
align="center">d</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">5</entry><entry
align="center">e</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
<row valign="middle">
<entry align="center">6</entry><entry
align="center">f</entry><entry align="center">0</entry>
<entry align="center">0</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
</article>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]