ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Vertical text alignment in nested natural tables
@ 2007-03-28 13:11 Brian R. Landy
  2007-03-29  8:34 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Brian R. Landy @ 2007-03-28 13:11 UTC (permalink / raw)
  To: ntg-context

Hi,

I am having a problem using nested natural tables, to which I have a  
solution but feel that it my not be the proper approach.  I'm pretty  
much a TeX and ConTeXt novice.

The problem is that the row height it reduced when a table is nested,  
breaking vertical text alignment across cells.  In my example the  
cells "SSSSS" and "Swap" to not align vertically due to the presence  
of the "p".  I have an example of the problem and my fix below.

I'm curious if someone knows a better way to fix this.

Thanks for your help,
Brian



\starttext
Working table:\par
\start
\bTABLE[frame=on,align={middle,lohi}]
\bTR
\bTD SSSSS \eTD
\bTD Swap \eTD
\eTR
\eTABLE
\stop

Nested table changes cell height, breaks text alignment with "lohi":\par
\start
\bTABLE[frame=on,height=0.50in]
\bTR
\bTD
{\start
\bTABLE[frame=on,align={middle,lohi}]
\bTR
\bTD SSSSS \eTD
\bTD Swap \eTD
\eTR
\eTABLE
\stop}
\eTD
\eTR
\eTABLE
\stop

setting height to baselineskip does not help:\par
\start
\bTABLE[frame=on,height=0.50in]
\bTR
\bTD
{\start
\bTABLE[height=\the\baselineskip,frame=on,align={middle,lohi}]
\bTR
\bTD SSSSS \eTD
\bTD Swap \eTD
\eTR
\eTABLE
\stop}
\eTD
\eTR
\eTABLE
\stop

One fix is a strut:\par
\start
\bTABLE[frame=on,height=0.50in]
\bTR
\bTD
{\start
\bTABLE[frame=on,align={middle,lohi}]
\bTR
\bTD \strut{SSSSS} \eTD
\bTD \strut{Swap} \eTD
\eTR
\eTABLE
\stop}
\eTD
\eTR
\eTABLE
\stop
\stoptext

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Vertical text alignment in nested natural tables
  2007-03-28 13:11 Vertical text alignment in nested natural tables Brian R. Landy
@ 2007-03-29  8:34 ` Wolfgang Schuster
  2007-03-30  3:16   ` Brian R. Landy
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2007-03-29  8:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2547 bytes --]

2007/3/28, Brian R. Landy <landy@alumni.caltech.edu>:
>
> Hi,
>
> I am having a problem using nested natural tables, to which I have a
> solution but feel that it my not be the proper approach.  I'm pretty
> much a TeX and ConTeXt novice.
>
> The problem is that the row height it reduced when a table is nested,
> breaking vertical text alignment across cells.  In my example the
> cells "SSSSS" and "Swap" to not align vertically due to the presence
> of the "p".  I have an example of the problem and my fix below.
>
> I'm curious if someone knows a better way to fix this.
>
> Thanks for your help,
> Brian


Hi Brian,

I will show a few solution to your problem for the following table.
We will start with a simple table that contains the error.

\starttext

\bTABLE
  \bTR
    \bTD
      {\bTABLE
      \bTR
        \bTD SSSS \eTD
        \bTD Swap \eTD
      \bTR
    \eTABLE}
    \bTD
  \eTR
\eTABLE

\stoptext


Your own solution with adding a strut to the inner table can be done
in a better way by adding the strut to the setup of the beginning of the
table.

\starttext

\bTABLE
  \bTR
    \bTD
      {\bTABLE[left=\strut]
        \bTR
          \bTD SSSS \eTD
          \bTD Swap \eTD
        \bTR
      \eTABLE}
    \bTD
  \eTR
\eTABLE

\stoptext



Another mothod is to use the same method, that is used for the
outer table. I took a look into the source and found the following method,
that works also.

\starttext

\bTABLE
  \bTR
    \bTD
      {\bTABLE[strut=yes,autostrut=no]
         \bTR
           \bTD SSSS \eTD
           \bTD Swap \eTD
         \bTR
       \eTABLE}
    \bTD
  \eTR
\eTABLE

\stoptext


After that a was interested why we need to set the values in the
last example again, because they are already set in core-ntb.
The solution is, the values in nested tables are removed and replaced
by new ones. This behaviour can be changed and is shown in my last
example.

\starttext

\setfalse\resetTABLEmode

\bTABLE
  \bTR
    \bTD
      {\bTABLE
         \bTR
           \bTD SSSS \eTD
           \bTD Swap \eTD
         \bTR
       \eTABLE}
    \bTD
  \eTR
\eTABLE

\stoptext


Another example that shows the effect of \resetTABLEmode is:

\starttext

%\settrue\resetTABLEmode % default setting

\setupTABLE[frame=off]

\bTABLE
  \bTR
    \bTD
      {\bTABLE\bTR\bTD Text \eTD\eTR\eTABLE}
    \eTD
    \bTD
      Text
    \eTD
  \eTR
\eTABLE

\setfalse\resetTABLEmode

\bTABLE
  \bTR
    \bTD
      {\bTABLE\bTR\bTD Text \eTD\eTR\eTABLE}
    \eTD
    \bTD
      Text
    \eTD
  \eTR
\eTABLE

\stoptext


Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 4490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Vertical text alignment in nested natural tables
  2007-03-29  8:34 ` Wolfgang Schuster
@ 2007-03-30  3:16   ` Brian R. Landy
  2007-04-04 16:32     ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Brian R. Landy @ 2007-03-30  3:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3506 bytes --]

I had played around with strut=yes, but had not realized I also  
needed to set autostrut=no.  That approach ended up working best; my  
initial solution broke aligncharacter, and I like the table  
environment to reset.  It is a bit odd that it resets to something  
different than the default.

As an aside, what books are good for learning TeX programming for  
ConTeXt?  Anything besides the TeXBook (and I saw TeX by Topic  
mentioned on the list the other day).


Thanks again,
Brian


On Mar 29, 2007, at 4:34 AM, Wolfgang Schuster wrote:

>
>
> 2007/3/28, Brian R. Landy <landy@alumni.caltech.edu>:
> Hi,
>
> I am having a problem using nested natural tables, to which I have a
> solution but feel that it my not be the proper approach.  I'm pretty
> much a TeX and ConTeXt novice.
>
> The problem is that the row height it reduced when a table is nested,
> breaking vertical text alignment across cells.  In my example the
> cells "SSSSS" and "Swap" to not align vertically due to the presence
> of the "p".  I have an example of the problem and my fix below.
>
> I'm curious if someone knows a better way to fix this.
>
> Thanks for your help,
> Brian
>
>
> Hi Brian,
>
> I will show a few solution to your problem for the following table.
> We will start with a simple table that contains the error.
>
> \starttext
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE
>       \bTR
>         \bTD SSSS \eTD
>         \bTD Swap \eTD
>       \bTR
>     \eTABLE}
>     \bTD
>   \eTR
> \eTABLE
>
> \stoptext
>
>
> Your own solution with adding a strut to the inner table can be done
> in a better way by adding the strut to the setup of the beginning  
> of the table.
>
> \starttext
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE[left=\strut]
>         \bTR
>           \bTD SSSS \eTD
>           \bTD Swap \eTD
>         \bTR
>       \eTABLE}
>     \bTD
>   \eTR
> \eTABLE
>
> \stoptext
>
>
>
>
>
> Another mothod is to use the same method, that is used for the
> outer table. I took a look into the source and found the following  
> method,
> that works also.
>
> \starttext
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE[strut=yes,autostrut=no]
>          \bTR
>            \bTD SSSS \eTD
>            \bTD Swap \eTD
>          \bTR
>        \eTABLE}
>     \bTD
>   \eTR
> \eTABLE
>
> \stoptext
>
>
> After that a was interested why we need to set the values in the
> last example again, because they are already set in core-ntb.
> The solution is, the values in nested tables are removed and replaced
> by new ones. This behaviour can be changed and is shown in my last
> example.
>
> \starttext
>
> \setfalse\resetTABLEmode
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE
>          \bTR
>            \bTD SSSS \eTD
>            \bTD Swap \eTD
>          \bTR
>        \eTABLE}
>     \bTD
>   \eTR
> \eTABLE
>
> \stoptext
>
>
> Another example that shows the effect of \resetTABLEmode is:
>
> \starttext
>
> %\settrue\resetTABLEmode % default setting
>
> \setupTABLE[frame=off]
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE\bTR\bTD Text \eTD\eTR\eTABLE}
>     \eTD
>     \bTD
>       Text
>     \eTD
>   \eTR
> \eTABLE
>
> \setfalse\resetTABLEmode
>
> \bTABLE
>   \bTR
>     \bTD
>       {\bTABLE\bTR\bTD Text \eTD\eTR\eTABLE}
>     \eTD
>     \bTD
>       Text
>     \eTD
>   \eTR
> \eTABLE
>
> \stoptext
>
>
> Wolfgang
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> <sanitizer.log>


[-- Attachment #1.2: Type: text/html, Size: 5052 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Vertical text alignment in nested natural tables
  2007-03-30  3:16   ` Brian R. Landy
@ 2007-04-04 16:32     ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2007-04-04 16:32 UTC (permalink / raw)
  To: ntg-context

On Thu, 29 Mar 2007 23:16:43 -0400
"Brian R. Landy" <landy@alumni.caltech.edu> wrote:

> I had played around with strut=yes, but had not realized I also  
> needed to set autostrut=no.  That approach ended up working best; my  
> initial solution broke aligncharacter, and I like the table  
> environment to reset.  It is a bit odd that it resets to something  
> different than the default.
> 
> As an aside, what books are good for learning TeX programming for  
> ConTeXt?  Anything besides the TeXBook (and I saw TeX by Topic  
> mentioned on the list the other day).
> 
> 
> Thanks again,
> Brian

Hi Brian,

the best method to control nested tables is by integrating a setup
command for nested tables.

\unprotect

\def\setupresetTABLE
  {\dodoubleargument\getparameters[\@@tbl\@@tbl\@@tbl]}

\def\resetallTABLEparameters% moet genest wel werken
  {\ifnum\TBLlevel>\plusone % in ieder geval
     \ifconditional\resetTABLEmode
       \presetlocalframed   % breedte hoogte diepte offset
         [\@@tbl\@@tbl]%    % achtergrond, achtergrondraster,
achtergrondkleur \copyparameters
         [\@@tbl\@@tbl][\@@tbl\@@tbl\@@tbl]
         [\c!frameoffset,\c!backgroundoffset,\c!framecolor,\c!color,
          \c!strut,\c!autostrut,\c!aligncharacter,\c!alignmentcharacter,
          \c!style,\c!option,\c!maxwidth,\c!textwidth,\c!left,\c!right]
     \else
       \setupTABLE
         [\c!width=\v!fit,
          \c!height=\v!fit]%
     \fi
  \fi}

\setupresetTABLE
  [\c!frameoffset=.5\linewidth,
   \c!backgroundoffset=\v!frame,
   \c!framecolor=\s!black,
   \c!color=,
   \c!style=,
   \c!strut=\v!yes,
   \c!autostrut=\v!no,
   \c!aligncharacter=\v!no,
   \c!alignmentcharacter={,},
   \c!option=,
   \c!maxwidth=8em,
   \c!textwidth=\hsize,
   \c!left=,
   \c!right=]

\protect

\starttext

\bTABLE
  \bTR
    \bTD
      {\bTABLE
         \bTR
           \bTD SSSS \eTD
           \bTD Swap \eTD
         \eTR
       \eTABLE}
    \eTD
  \eTR
\eTABLE

\stoptext

Wolfgang

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-04 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-28 13:11 Vertical text alignment in nested natural tables Brian R. Landy
2007-03-29  8:34 ` Wolfgang Schuster
2007-03-30  3:16   ` Brian R. Landy
2007-04-04 16:32     ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).