Login  Register

Re: fopub - Horizontal align table content

Posted by Andrew Carver on Sep 24, 2019; 8:26pm
URL: https://discuss.asciidoctor.org/fopub-Horizontal-align-table-content-tp7161p7162.html

The problem seems to be located in FOP. I come to that by quick-and-dirty process of elimination.

I know that the standard DocBook XSL stylesheets are not doing it. Here's a typical row they produce from the DocBook <informaltable> your AsciiDoc generates:

        <fo:table-row>
            <fo:table-cell padding-start="2pt" padding-end="2pt" padding-top="2pt"
                padding-bottom="2pt" border-bottom-width="0.5pt" border-bottom-style="solid"
                border-bottom-color="black" border-end-width="0.5pt" border-end-style="solid"
                border-end-color="black" display-align="before" text-align="center">
                <fo:block>
                    <fo:block space-before.optimum="0.08em" space-before.minimum="0em"
                        space-before.maximum="1.2em"
                        axf:font-variant="common-ligatures oldstyle-nums" text-indent="1.8em">Cell
                        in column 1, row 1</fo:block>
                </fo:block>
            </fo:table-cell>
            <fo:table-cell padding-start="2pt" padding-end="2pt" padding-top="2pt"
                padding-bottom="2pt" border-bottom-width="0.5pt" border-bottom-style="solid"
                border-bottom-color="black" border-end-width="0.5pt" border-end-style="solid"
                border-end-color="black" display-align="before" text-align="center">
                <fo:block>
                    <fo:block space-before.optimum="0.08em" space-before.minimum="0em"
                        space-before.maximum="1.2em"
                        axf:font-variant="common-ligatures oldstyle-nums" text-indent="1.8em">Cell
                        in column 2, row 1</fo:block>
                </fo:block>
            </fo:table-cell>
            <fo:table-cell padding-start="2pt" padding-end="2pt" padding-top="2pt"
                padding-bottom="2pt" border-bottom-width="0.5pt" border-bottom-style="solid"
                border-bottom-color="black" display-align="before" text-align="center">
                <fo:block>
                    <fo:block space-before.optimum="0.08em" space-before.minimum="0em"
                        space-before.maximum="1.2em"
                        axf:font-variant="common-ligatures oldstyle-nums" text-indent="1.8em">Cell
                        in column 3, row 1</fo:block>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
 
(You'll notice that each fo:table-cell has text-align="center".)

Nor can I see anything in fopub's customization of the stylesheets that would make this happen. Here are the only parameter-setttings it has (in fo-pdf.xsl) that affects tables:

  <!--
    Tables
  -->

  <xsl:attribute-set name="table.cell.padding">
    <xsl:attribute name="padding-left">4pt</xsl:attribute>
    <xsl:attribute name="padding-right">4pt</xsl:attribute>
    <xsl:attribute name="padding-top">2pt</xsl:attribute>
    <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
  </xsl:attribute-set>

  <xsl:param name="table.frame.border.thickness">0.3pt</xsl:param>
  <xsl:param name="table.cell.border.thickness">0.15pt</xsl:param>
  <xsl:param name="table.cell.border.color">#5c5c4f</xsl:param>
  <xsl:param name="table.frame.border.color">#5c5c4f</xsl:param>
  <xsl:param name="table.cell.border.right.color">white</xsl:param>
  <xsl:param name="table.cell.border.left.color">white</xsl:param>
  <xsl:param name="table.frame.border.right.color">white</xsl:param>
  <xsl:param name="table.frame.border.left.color">white</xsl:param>

  <xsl:attribute-set name="table.cell.padding">
    <xsl:attribute name="padding-left">4pt</xsl:attribute>
    <xsl:attribute name="padding-right">4pt</xsl:attribute>
    <xsl:attribute name="padding-top">2pt</xsl:attribute>
    <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
  </xsl:attribute-set>

Also:: after generating the FO (not using fopub but using the standard stylesheets as regards tables), I ran that thru Antenna House XSL Formatter 6.6 (Lite version), and the contents of the formatted table's cells were horizontally centered.

So, that leaves FOP as the culprit (seems to me).

Cheers,
Andy