Re: alignment in tables

Subject: Re: alignment in tables
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 May 1999 11:43:50 -0400
At 99/05/18 16:09 +0200, Pieter Rijken wrote:
>I cannot get the alignment of text in tables right.
>The table I want to format consists of 3 columns.
>Text in the first and third column is left aligned,
>while the contents of the second column should be
>right-aligned.
>
>An example table in SGML looks like:
>...
>I'm trying to display this as:
>
>first row         second row  third row
>\-------/  \---------------/  \-------/
>column 1       column 2        column 3
>
>I try to achieve this with the following DSSSL script
>...
>But this does not work. All columns are left-aligned! I only seem to get
>the alignment correct when the 'display-alignment' characteristic for
>'make-table' is specified. Unfortunately, this then applies for all three
>columns! :-(
>Also, the characteristic 'row-cell-alignment' does not do anything!?
>
>What are these alignments for, and why does only the alignment
>specified for the entire table seems to work?

Because "display-alignment:" is documented to be the alignments of the
*areas* themselves, not the *content* of the areas.  An important
distinction that is a common misunderstanding.

The text in a table belongs inside an area whose area needs to have the
quadding set to what you desire.  Fortunately, quadding is an inherited
characteristic so you have the opportunity to set it anywhere before you
use it.

>BTW, I'm using the TeX backend.

Same with the RTF backend ... you may find there are no problems in this
area at all with the TeX backend if you use the example below (actually, I
would be interested to hear your results, please, since I'm not using the
TeX backend).

I hope the example below helps.

......... Ken


T:\dsssl>type test.sgm
<!DOCTYPE table [
<!ELEMENT table - O (row+)>
<!ATTLIST table columns NUMBER #REQUIRED>
<!ELEMENT row - O (cell+)>
<!ELEMENT cell - O (#PCDATA)>
]>
<table columns="3">
  <row>
    <cell>first column</cell>
    <cell>second column</cell>
    <cell>third column</cell>
  </row>
</table>

T:\dsssl>type test.dsl
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(root
    (make simple-page-sequence
        page-width:     8.5in
        page-height:    11in
        left-margin:    .5in
        right-margin:   .5in
        header-margin:  .5in
        footer-margin:  .5in
        top-margin:     1in
        bottom-margin:  1in
        (process-children)))

(element table
    (make table
          table-border: #t
          cell-after-column-border: #t
           (make table-column
                 quadding: 'start)
           (make table-column
                 quadding: 'end)
           (make table-column
                 quadding: 'start)
           (process-children)))

(element row
    (process-children))

(element cell
    (make table-cell
        (make paragraph
          (process-children))))

;end of file
T:\dsssl>jade -c p:\jade\jadecurr\catalog -t rtf -o test.rtf test.sgm

T:\dsssl>




--
G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/d/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999  (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline,  XSL/DSSSL shareware,
         stylesheet resource library, conference training schedule,
         commercial stylesheet training materials, on-line XSL CBT.


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread