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] centered table problem


Bob

Centering a proportional width table in an outer 3x3 empty table works 
OK (but it is an ugly solution)
Now I would like to center the "Table 1.  TITLE"  heading above the table.
Can you help me with this please?  I guess it needs doing in a 
customization layer.

my centered table in a table attached.

Ron


Bob Stayton wrote:
> 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
> bobs@sagehill.net
> 
> 
> ----- Original Message ----- From: "Ron Catterall" <ron@catterall.net>
> To: <docbook-apps@lists.oasis-open.org>
> 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.
>> ron@catterall.net
>> 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>
>>
> 
> 
> 

-- 
Ron Catterall Ph.D. D.Sc.
ron@catterall.net
http://catterall.net
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sect1>
<sect1 xml:id="A" xmlns="http://docbook.org/ns/docbook"; version="5.0" xml:lang="EN">
  <info><title>SECTION 1 TITLE</title></info>
<sect2 xml:id="B" xmlns="http://docbook.org/ns/docbook"; version="5.0" xml:lang="EN">
  <info><title>SECTION 2 TITLE</title></info>

<!-- 
This is the only way to get a centered table with proportional colwidths
e.g. colwidth="1.5*"
The table is embedded in the central cell of an outer, otherwise empty, 3x3 table
The 3x3 structure is need to get the frame to work on the inner table
 -->

  <?dbfo-need height="5.5in" ?>
<table frame="none" xml:id="ID">
  <info><title>TABLE TITLE</title></info>
  <?dbfo table-width="100.0%" ?>
  <tgroup align="center" cols="3">
    <colspec colname="c1" colnum="1"  colwidth="1.0*" colsep="1" rowsep="0"/>
    <colspec colname="c2" colnum="2"  colwidth="1.5*"  colsep="0" rowsep="0"/>
    <colspec colname="c3" colnum="3"  colwidth="1.0*" colsep="0" rowsep="0"/>
    <spanspec align="center" nameend="c3" namest="c1" spanname="hspan"/>
    <tbody valign="middle">
      <row valign="middle">
        <entry rowsep="0" colsep="0"> </entry>
        <entry rowsep="1" colsep="0"> </entry>
        <entry rowsep="0" colsep="0"> </entry>
      </row>
      <row valign="middle">
        <entry></entry>
        <entrytbl align="center" cols="4" rowsep="1" colsep="1">
          <colspec colname="c1" colnum="1"  colwidth="1.0*"/>
          <colspec colname="c2" colnum="2"  colwidth="1.2*"/>
          <colspec colname="c3" colnum="3"  colwidth="1.4*"/>
          <colspec colname="c4" colnum="4"  colwidth="1.6*"/>
          <spanspec align="center" nameend="c4" namest="c1" spanname="hspan"/>
          <thead>
            <row valign="middle">
              <entry align="center">A</entry>
              <entry align="center">B</entry>
              <entry align="center">C</entry>
              <entry align="center">D</entry>
            </row>
          </thead>
          <tbody>
            <row valign="middle">
              <entry>1</entry><entry>2</entry><entry>3</entry>
              <entry>4</entry>
            </row>
            <row valign="middle">
              <entry>5</entry><entry>6</entry><entry>7</entry>
              <entry>8</entry>
            </row>
            <row valign="middle">
              <entry>9</entry><entry>10</entry><entry>11</entry>
              <entry>12</entry>
            </row>
            <row valign="middle">
              <entry>13</entry><entry>14</entry><entry>15</entry>
              <entry>16</entry>
            </row>
            <row valign="middle">
              <entry>17</entry><entry>18</entry><entry>19</entry>
              <entry>20</entry>
            </row>
            <row valign="middle" rowsep="1">
              <entry>21</entry><entry>22</entry><entry>23</entry>
              <entry>24</entry>
            </row>
          </tbody>
        </entrytbl>
        <entry></entry>
      </row>
      <row valign="middle">
        <entry rowsep="0" colsep="0"></entry>
        <entry rowsep="1" colsep="0"></entry>
        <entry rowsep="0" colsep="0"></entry>
      </row>
    </tbody>
  </tgroup>
</table>

</sect2>
</sect1>

S/MIME Cryptographic Signature



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