Re: [NTG-context] Grid-keeping table

2007-03-29 Thread luigi scarso
On 3/27/07, Johannes Kuester [EMAIL PROTECTED] wrote:
 Dear all,

 I'm trying to typeset a rather simple list or table where each line
 should keep the overall grid of my page design.
 For this I tried tabulate, table, and TABLE, but all failed.

 What I need is the following:
 4 columns, each with a fixed width.
 One of the columns may contain a paragraph (i.e. more than one line), like:

Axxx    first entry with  zzz
more text
Bxxx    next entryzzz

some ideas
%%
\newdimen\CellWidth \CellWidth=0.2\textwidth %% or whatever is good
\newdimen\CellHeightOne \CellHeightOne=\lineheight %% synch with grid
\newdimen\TestDim

\long\def\CellContent#1{%
\setbox100=\vbox{\hsize=\CellWidth%
#1}
\dp100=0pt%
\TestDim=\CellHeightOne
\doloop{%30
\ifdim\ht100\TestDim%
\setbox100=\vbox to \TestDim{\hsize=\CellWidth \recurselevel #1}\exitloop\fi
\TestDim=\dimexpr(\CellHeightOne+\TestDim)\relax}
\dp100=0pt%
\ruledvbox{\box100}%ruled for test
}


\setupcolors[state=start]
\setuplayout[grid=yes]
\setupTABLE[width=\CellWidth,offset=0pt,strut=no]
\showgrid
\starttext
\ \blank
\bTABLE
\bTR
\bTD\CellContent{Axxx}\eTD
\bTD\CellContent{} \eTD
\bTD\CellContent{first entry with  \\
  more text}\eTD
\bTD\CellContent{zzz} \eTD
\eTR
\bTR
\bTD\CellContent{Bxxx} \eTD
\bTD\CellContent{fff}\eTD
\bTD\CellContent{next entry} \eTD
\bTD\CellContent{zzz}\eTD
\eTR
\bTR
\bTD\CellContent{Axxx}\eTD
\bTD\CellContent{foo \\ boo \\ coo \\ doo} \eTD
\bTD\CellContent{\input ward }\eTD
\bTD\CellContent{zzz} \eTD
\eTR
\eTABLE
\stoptext

1) there are extra spaces  between rows that i don't manage
2) i think to avoid \CellContent every \bTD\..\eTD (re-reading core-ntb)

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


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Johannes Kuester
Dear Luigi, dear Rolf,

thank you for your help.

Below is a (hopefully) better example of what I try to do and where it
fails.

The last line in tabulate (starting with 22C6) loses the grid, and I
can't see why.

Unfortunately the solutions you suggested did not work for me.
I do want to avoid to specify cell heights, I just want to arrange
paragraph boxes, all (horizontally) top-aligned with each entry in my table.

TABLE with \synchronizegrid would do the trick (a non-framed table would
have grid-keeping rows). Still it seems to fail in my specific setting
(two-column, I could not trace down what the problem really is).
And the need to specify the number of rows is a problem in my case, as I
would need to add a parameter to my macro etc.

Johannes


%%

\setuplayout[grid=yes]

\showgrid
\showstruts

\starttext

\input tufte

\starttabulate[|p(.1\textwidth)|p(.1\textwidth)|p(.5\textwidth)|p(.2\textwidth)|]%
\NC 002B
\NC $+$
\NC plus; Addition
\NC
  \NR
\NC 00D7
\NC $\times$
\NC kartesisches Produkt (von Mengen);\hfill\break
Kreuzprodukt (Vektorprodukt);\hfill\break
mal; Produkt (bei Zahlwerten)
\NC
  \NR
\NC 2217
\NC $*$
\NC (Stern, Asterisk); Konvolution; Faltung; Produkt
\NC
  \NR
\NC 22C6
\NC $\star$
\NC (Stern); Zeichen fuer spezielle Produkte
\NC
  \NR
\stoptabulate

\blank

\input tufte

\stoptext

%%


-- 
Johannes Kuester
typoma

mailto:[EMAIL PROTECTED]
http://www.typoma.com
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Hans Hagen
luigi scarso wrote:
 One way to reach this, is to set the row height of every single table
 line to the default interline space of ConTeXt.
 The table rows now sync with the grid (same height), but behind the
 table you are again out of sync. You can use \syncronizegrid to fix this.
 
when spacing is suboptimal boxed stuff (\bTABLE, \starttable, \framed) 
should be surrounded by

\startlinecorrection
\stoplinecorrection

(also better in non grid mode)

unless it's a float

for your own macros, use \snaptogrid\vbox{...}

 hmm, some problems (see %Pj )
 %
 \setuplayout[grid=yes]
 %P1 %%  all  docs is in grid mode,
 % but the request was only for tables
 \showgrid
 \showstruts

 \starttext

 \input tufte

 \setupTABLE[r][each][height=\the\baselineskip] % default linespacing in 
 ConTeXt
 \setupTABLE[c][1,2,4][width=.2\textwidth]
 \setupTABLE[c][3][width=.4\textwidth]
 \setupTABLE[frame=on]

 \blank

 \bTABLE
 \bTR
   \bTD Axxx \eTD
   \bTD  \eTD
   \bTD [row=2] first entry with\\ more text \eTD
 %P2 %%% you must enter row=2manually
 % maybe can be calculate by a macro
   \bTD zzz \eTD
 \eTR
 %
 \bTR
   \bTD \eTD
   \bTD \eTD
 % \bTD \eTD % [row=2]
   \bTD \eTD
 \eTR
 %
 \bTR
   \bTD Bxxx \eTD
   \bTD  \eTD
   \bTD next entry \eTD
   \bTD zzz \ruledvbox to 3cm{ jkjfd kjhsdkfjhsd }\eTD
 %P3 %% ugly cell -- some try-and-errors to find k such as row=k
 % is good
 \eTR
 \eTABLE

 \synchronizegrid
 \blank

 \input tufte

 \stoptext
 %%%

 One strategy could be consider both the ways showed.
 Also I found an interestring document at
 http://www.datapat.de/101.pdf

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


-- 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

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


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread luigi scarso
On 3/28/07, Johannes Kuester [EMAIL PROTECTED] wrote:
 Dear Luigi, dear Rolf,

 thank you for your help.

 Below is a (hopefully) better example of what I try to do and where it
 fails.
ok, i will give it a try this night.

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


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Peter Rolf
Hi Johannes,

Johannes Kuester wrote:
 Dear Luigi, dear Rolf,
 
 thank you for your help.
 
 Below is a (hopefully) better example of what I try to do and where it
 fails.
 
 The last line in tabulate (starting with 22C6) loses the grid, and I
 can't see why.

as I see it, the problem is caused by the table cells, that use more
than one row. In the following row the outer struts are shifted down
(inner ones are normal, as they sync with the last rows struts), so that
the total height of the row is finally greater than \strutheight.

In your example are two places, where this occurs:
The two inner struts in front of '(Stern, Asterisk);..' are
not on the same horizontal line as the outer strut on the right side.
Same for the both outer struts (left,right) of the '22C6' line and the
inner one in front of '(Stern); Zeichen für...'.

But I donno how to fix this.

Best, Peter

 Unfortunately the solutions you suggested did not work for me.
 I do want to avoid to specify cell heights, I just want to arrange
 paragraph boxes, all (horizontally) top-aligned with each entry in my table.
 
 TABLE with \synchronizegrid would do the trick (a non-framed table would
 have grid-keeping rows). Still it seems to fail in my specific setting
 (two-column, I could not trace down what the problem really is).
 And the need to specify the number of rows is a problem in my case, as I
 would need to add a parameter to my macro etc.
 
 Johannes
 
 
 %%
 
 \setuplayout[grid=yes]
 
 \showgrid
 \showstruts
 
 \starttext
 
 \input tufte
 
 \starttabulate[|p(.1\textwidth)|p(.1\textwidth)|p(.5\textwidth)|p(.2\textwidth)|]%
 \NC 002B
 \NC $+$
 \NC plus; Addition
 \NC
   \NR
 \NC 00D7
 \NC $\times$
 \NC kartesisches Produkt (von Mengen);\hfill\break
 Kreuzprodukt (Vektorprodukt);\hfill\break
 mal; Produkt (bei Zahlwerten)
 \NC
   \NR
 \NC 2217
 \NC $*$
 \NC (Stern, Asterisk); Konvolution; Faltung; Produkt
 \NC
   \NR
 \NC 22C6
 \NC $\star$
 \NC (Stern); Zeichen fuer spezielle Produkte
 \NC
   \NR
 \stoptabulate
 
 \blank
 
 \input tufte
 
 \stoptext
 
 %%
 
 

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


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Johannes Kuester
It seems linetable would do just what I need (at least I get rid of the
strut / unwanted vertical spacing problem, so I do get a grid-keeping
table), but:

Is there a way to use linetable in two-column mode?
(i.e. the consecutive lines of my table should be set just like normal
text would in two-column mode).

Currently linetable just streches over the whole textwidth, as it adds
white space between columns.

Johannes


%%

In my previous example below, using

  \setuplinetable[n=4]

  \setuplinetable[c][1]   [width=6mm]
  \setuplinetable[c][2]   [width=5mm]
  \setuplinetable[c][3]   [width=51mm]
  \setuplinetable[c][4]   [width=1mm]

and then startlinetable / stoplinetable instead of start/stoptabulate
works fine for the vertical spacing problem.

 %%

 \setuplayout[grid=yes]

 \showgrid
 \showstruts

 \starttext

 \input tufte

 \starttabulate[|p(.1\textwidth)|p(.1\textwidth)|p(.5\textwidth)|p(.2\textwidth)|]%
 \NC 002B
 \NC $+$
 \NC plus; Addition
 \NC
   \NR
 \NC 00D7
 \NC $\times$
 \NC kartesisches Produkt (von Mengen);\hfill\break
 Kreuzprodukt (Vektorprodukt);\hfill\break
 mal; Produkt (bei Zahlwerten)
 \NC
   \NR
 \NC 2217
 \NC $*$
 \NC (Stern, Asterisk); Konvolution; Faltung; Produkt
 \NC
   \NR
 \NC 22C6
 \NC $\star$
 \NC (Stern); Zeichen fuer spezielle Produkte
 \NC
   \NR
 \stoptabulate

 \blank

 \input tufte

 \stoptext

 %%

-- 
Johannes Kuester
typoma

mailto:[EMAIL PROTECTED]
http://www.typoma.com
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Wolfgang Schuster

2007/3/28, Johannes Kuester [EMAIL PROTECTED]:


It seems linetable would do just what I need (at least I get rid of the
strut / unwanted vertical spacing problem, so I do get a grid-keeping
table), but:

Is there a way to use linetable in two-column mode?
(i.e. the consecutive lines of my table should be set just like normal
text would in two-column mode).

Currently linetable just streches over the whole textwidth, as it adds
white space between columns.

Johannes


%%

In my previous example below, using

  \setuplinetable[n=4]

  \setuplinetable[c][1]   [width=6mm]
  \setuplinetable[c][2]   [width=5mm]
  \setuplinetable[c][3]   [width=51mm]
  \setuplinetable[c][4]   [width=1mm]

and then startlinetable / stoplinetable instead of start/stoptabulate
works fine for the vertical spacing problem.

 %%

 \setuplayout[grid=yes]

 \showgrid
 \showstruts

 \starttext

 \input tufte


\starttabulate[|p(.1\textwidth)|p(.1\textwidth)|p(.5\textwidth)|p(.2\textwidth)|]%
 \NC 002B
 \NC $+$
 \NC plus; Addition
 \NC
   \NR
 \NC 00D7
 \NC $\times$
 \NC kartesisches Produkt (von Mengen);\hfill\break
 Kreuzprodukt (Vektorprodukt);\hfill\break
 mal; Produkt (bei Zahlwerten)
 \NC
   \NR
 \NC 2217
 \NC $*$
 \NC (Stern, Asterisk); Konvolution; Faltung; Produkt
 \NC
   \NR
 \NC 22C6
 \NC $\star$
 \NC (Stern); Zeichen fuer spezielle Produkte
 \NC
   \NR
 \stoptabulate

 \blank

 \input tufte

 \stoptext

 %%

--
Johannes Kuester
typoma



Hi Johannes,

a short example to play for you. The important things are the stretch and
the lines key in \setuplinetable. You should also look at the end of
core-ltb,
it contains a few interresting examples.

\setuplinetable[stretch=yes,lines=fit]

\starttext

\startcolumns

\startlinetable
\dorecurse{80}{\NC Text \NC Text \NC\NR}
\stoplinetable

\stopcolumns

\stoptext

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


Re: [NTG-context] Grid-keeping table

2007-03-28 Thread Johannes Kuester
Wolfgang Schuster wrote:
 
 2007/3/28, Johannes Kuester [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:
 
 It seems linetable would do just what I need (at least I get rid of the
 strut / unwanted vertical spacing problem, so I do get a grid-keeping
 table), but:
 
 Is there a way to use linetable in two-column mode?
 (i.e. the consecutive lines of my table should be set just like normal
 text would in two-column mode).

 Hi Johannes,
 
 a short example to play for you. The important things are the stretch and
 the lines key in \setuplinetable. You should also look at the end of
 core-ltb,
 it contains a few interresting examples.
 
 \setuplinetable[stretch=yes,lines=fit]
 
 \starttext
 
 \startcolumns
 
 \startlinetable
 \dorecurse{80}{\NC Text \NC Text \NC\NR}
 \stoplinetable
 
 \stopcolumns
 
 \stoptext
 
 Wolfgang
 

Hi Wolfgang,

I already looked at the examples in core-ltb, and on the wiki.
Still linetable does not work in my specific case (with my layout
options etc.), but I can't trace down why it does not.

But linetable seems to have problems in general, when used in columns.
When I try your example with more input lines (thus running over more
than one page), say

%%
\setuplayout[grid=yes]
\showgrid

\setuplinetable[stretch=yes,lines=fit]

\starttext

\startcolumns

\startlinetable
\dorecurse{180}{\NC Text \NC Text \NC\NR}
\stoplinetable

\stopcolumns

\stoptext
%%

I get a correct left column (on page 1 and 2),
but the right column is three lines too long.

Setting the number of lines:
  \setuplinetable[lines=41]
would help for one-line cell entries
(then each column has the correct number of lines on the page),
but in my case with multi-line entries, each such entry is counted as
one line, thus resulting in a too long column.

So, linetable does not do the job.

Back to tabulate, I presume, but tabulate has the strut problem.

Johannes

-- 
Johannes Kuester
typoma

mailto:[EMAIL PROTECTED]
http://www.typoma.com
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Grid-keeping table

2007-03-27 Thread luigi scarso
On 3/27/07, Johannes Kuester [EMAIL PROTECTED] wrote:
 Dear all,

 I'm trying to typeset a rather simple list or table where each line
 should keep the overall grid of my page design.
 For this I tried tabulate, table, and TABLE, but all failed.

 What I need is the following:
 4 columns, each with a fixed width.
 One of the columns may contain a paragraph (i.e. more than one line), like:

Axxx    first entry with  zzz
more text
Bxxx    next entryzzz

 The line starting with B does not keep the grid -- at least in most
 cases; I couldn't trace down when and why this fails.

 (The specific environment is not important (whether tabulate, table,
 TABLE, or some other solution), as all entries are supplied by a macro
 which I could adapt easily).
If I understand well (but a your example should be better)
you can try to put something like this
%
\CellWidth=0.2\textwidth %% or whatever is good
\CellHeightOne=3em  %% or whatever is good
\CellHeightTwo=2\CellHeightOne
\CellHeightThree=3\CellHeightOne
\CellHeightFour=4\CellHeightOne
%%%
\setbox100=\vbox{\hsize=\CellWidth%
%put your material here}
Now \box100 has the natural height of you material
\ifdim\ht100\CellHeightOne
\setbox100=\vbox to \CellHeightOne{\hsize=\CellWidth%
%put your material here}\else
\ifdim\ht100\CellHeightTwo
\setbox100=\vbox to \CellHeightTwo{\hsize=\CellWidth%
%put your material here}\else
\ifdim\ht100\CellHeightThree
\setbox100=\vbox to \CellHeightThree{\hsize=\CellWidth%
%put your material here}\else
\ifdim\ht100\CellHeightFour
\setbox100=\vbox to \CellHeightFour{\hsize=\CellWidth%
%put your material here}\fi\fi\fi\fi
%%%
%%Now use your macro \SetCellContent to set cell content with \box100
as argument
\setCellContent{\box100}

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


Re: [NTG-context] Grid-keeping table

2007-03-27 Thread Peter Rolf
Hi Johannes,

Johannes Kuester wrote:
 Dear all,
 
 I'm trying to typeset a rather simple list or table where each line
 should keep the overall grid of my page design.
 For this I tried tabulate, table, and TABLE, but all failed.


One way to reach this, is to set the row height of every single table
line to the default interline space of ConTeXt.
The table rows now sync with the grid (same height), but behind the
table you are again out of sync. You can use \syncronizegrid to fix this.

HTH, Peter


P.S. Can anyone with grid experience add some stuff to the Wiki?
I had to grep the base to find a grid syncronizing macro.

 What I need is the following:
 4 columns, each with a fixed width.
 One of the columns may contain a paragraph (i.e. more than one line), like:
 
Axxx    first entry with  zzz
more text
Bxxx    next entryzzz
 
 The line starting with B does not keep the grid -- at least in most
 cases; I couldn't trace down when and why this fails.
 
 (The specific environment is not important (whether tabulate, table,
 TABLE, or some other solution), as all entries are supplied by a macro
 which I could adapt easily).
 
 
 Johannes
 
\setuplayout[grid=yes]

\showgrid
\showstruts

\starttext

\input tufte

\setupTABLE[r][each][height=\the\baselineskip] % default linespacing in ConTeXt
\setupTABLE[c][1,2,4][width=.2\textwidth]
\setupTABLE[c][3][width=.4\textwidth]
\setupTABLE[frame=on]

\blank

\bTABLE
\bTR
  \bTD Axxx \eTD
  \bTD  \eTD
  \bTD [row=2] first entry with\\ more text \eTD
  \bTD zzz \eTD
\eTR
%
\bTR
  \bTD \eTD
  \bTD \eTD
% \bTD \eTD % [row=2]
  \bTD \eTD
\eTR
%
\bTR
  \bTD Bxxx \eTD
  \bTD  \eTD
  \bTD next entry \eTD
  \bTD zzz \eTD
\eTR
\eTABLE  

\synchronizegrid
\blank

\input tufte

\stoptext
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Grid-keeping table

2007-03-27 Thread luigi scarso
 One way to reach this, is to set the row height of every single table
 line to the default interline space of ConTeXt.
 The table rows now sync with the grid (same height), but behind the
 table you are again out of sync. You can use \syncronizegrid to fix this.
hmm, some problems (see %Pj )
%
\setuplayout[grid=yes]
%P1 %%  all  docs is in grid mode,
% but the request was only for tables
\showgrid
\showstruts

\starttext

\input tufte

\setupTABLE[r][each][height=\the\baselineskip] % default linespacing in ConTeXt
\setupTABLE[c][1,2,4][width=.2\textwidth]
\setupTABLE[c][3][width=.4\textwidth]
\setupTABLE[frame=on]

\blank

\bTABLE
\bTR
  \bTD Axxx \eTD
  \bTD  \eTD
  \bTD [row=2] first entry with\\ more text \eTD
%P2 %%% you must enter row=2manually
% maybe can be calculate by a macro
  \bTD zzz \eTD
\eTR
%
\bTR
  \bTD \eTD
  \bTD \eTD
% \bTD \eTD % [row=2]
  \bTD \eTD
\eTR
%
\bTR
  \bTD Bxxx \eTD
  \bTD  \eTD
  \bTD next entry \eTD
  \bTD zzz \ruledvbox to 3cm{ jkjfd kjhsdkfjhsd }\eTD
%P3 %% ugly cell -- some try-and-errors to find k such as row=k
% is good
\eTR
\eTABLE

\synchronizegrid
\blank

\input tufte

\stoptext
%%%

One strategy could be consider both the ways showed.
Also I found an interestring document at
http://www.datapat.de/101.pdf

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