Changes

Jump to navigation Jump to search
1,110 bytes removed ,  22:59, 13 June 2012
Make all examples smaller.
</texcode>
Be aware of the brackets surrounding the bTABLE ... eTABLE part!Here is a more elaborate example:
<texcodecontext source=yes>This is our red-coloured table.
\setupTABLE[row][odd][background=color,backgroundcolor=red, width=.2\textwidth]
\bTABLE[split=yes]% allow splitting over page boundaries \bTR \bTD[nr=3] 1 \eTD \bTD[nc=2] 2/3 \eTD \bTD[nr=3] 4 \eTD \eTR \bTR \bTD 2 \eTD \bTD 3 \eTD \eTR \bTR \bTD 2 \eTD \bTD 3 \eTD \eTR \bTR \bTD[nc=3] 1/2/3 \eTD \bTD 4 \eTD \eTR \bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD \eTR
\eTABLE
</texcodecontextYou get automatic page breaking with the option <tt>[split=yes]</tt>. The sample looks like this:
<context>
\setupTABLE[row][odd][background=color,backgroundcolor=red, width=.2\textwidth]
\bTABLE[split=yes]
\bTR \bTD[nr=3] 1 \eTD \bTD[nc=2] 2/3 \eTD \bTD[nr=3] 4 \eTD \eTR
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR
\bTR \bTD 2 \eTD \bTD 3 \eTD \eTR
\bTR \bTD[nc=3] 1/2/3 \eTD \bTD 4 \eTD \eTR
\bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD \eTR
\eTABLE
</context>
= Multipage TABLEs =
<context>
\setuppapersize[A5]
 
% Iterate over all the lines of text captured with \obeylines active
% command to call is first argument, is not called for empty lines
* quoted strings may contain commas themselves (which means writing a custom version of \processcommalist instead).
See also {{howtocmd|processseparatedlist}} HH: there is:  <texcode>\processseparatedlist[list][separator]\command</texcode> What about separating the values using tabs?.
= Designing complex TABLEs =
<context>
\setuppapersize[A5]\setupTABLE[r][each][height=1cm0.5cm]
\setupTABLE[c][each][width=1cm]
\bTABLE
<context>
\setuppapersize[A5]\setupTABLE[r][each][height=1cm0.5cm]
\setupTABLE[c][each][width=1cm]
\setupTABLE[r][1][height=0cm,frame=off]
</td><td>
<context>
\setuppapersize[A5]
\setupTABLE[c][each][align={middle,lohi},frame=off]
\setupTABLE[r][2,3,4,5,6][height=10.0cm5cm]
\setupTABLE[r][2,4][topframe=on]
\setupTABLE[c][1,2,3][rightframe=on]
<context>
\setuppapersize[A5]
\setupTABLE[c][each][align={middle,lohi},frame=off]
\setupTABLE[r][2,3,4,5,6][height=10.0cm5cm]
\setupTABLE[r][1,3][bottomframe=on]
\setupTABLE[c][1,2,3][rightframe=on]
<context>
\setuppapersize[A5]
\setupTABLE[c][each][align={middle,lohi},frame=off]
\setupTABLE[r][2,3,4,5,6][height=10.0cm5cm]
\setupTABLE[r][2,4][topframe=on]
\setupTABLE[c][1,2,3][rightframe=on]
== Make a cell bold ==
Drawing bold lines around a cell is done using the<context source="yes" text="produces"tt>\bTABLE\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2/3 \eTD \eTR\bTR \bTD 2 \eTD \bTD 2 \eTD \bTD 3 \eTD \eTR\bTR \bTD 2 \eTD \bTD[rulethickness=2pt''dim''] 2 \eTD \bTD 3 \eTD \eTR\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 4 \eTD \eTR\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2 \eTD \eTR\eTABLE</contexttt>key on a cell. The thicker rules will From mail december 2009 Hans Hagen en Willi Egger: The problem which I was seeking to solve is shown in offset the above example. The text alignment of inside the emphasized cell both downwards and sideways, so careshould be taken that the cell's increased rulethickness is not optimal. Hans pointed out the possible solutionoffset by anequal decrease in offset.
<context source="yes" text="produces">
\setupTABLE[row][each][rulethickness=.25pt,offset=\dimexpr1mm+2pt1.75pt]
\bTABLE
\bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 2/3 \eTD \eTR
</context>
As soon as you want to emphasize a cell A more realistic example: an invoice with a thicker frame, one has to adjust the offset. Basically the general offset will be enlarged by the amount of the rule thickness of the emphasized cell. In the cell with the thicker rule the offset is then diminished by the rule thicknessthick rules.
 I place here a more realistic example. Consider you want to create an invoice with several columns. There are no vertical lines. The top frame of the table should have a thicker rule than the dividing rules between the invoice lines. The bottom frame of the list of invoice lines should have also a thicker rule like the top frame: <context source="yes" text="produces">\setuppapersize[A5]
{\bfa Invoice}
\switchtobodyfont[6pt]
</td><td>
<context>
\setuppapersize[A5]
\bTABLE
\setupTABLE[column][1][align=right]
</td></tr></table>
You'll note that the final line, because it has no <code>. </code> in the number, gets aligned under the right-hand side of the numbers. In most circumstances you would want such a number aligned with the left-hand set of digits. To so do, issue the following command in your preamble:
<texcode>
<context>
\setuppapersize[A5]
\chardef\characteralignmentmode=2
\bTABLE
Here is an example using the "n" option:
<texcodecontext source=yes>\bTABLE[width=3em]\bTR\bTD d1 \eTD\bTDsetuppapersize[n=2A5] d2 \eTD\bTD[n=5] d5 \eTD\bTD[n=7] d7 \eTD\eTR\bTR\bTD f1 \eTD\bTD[n=4] f4 \eTD\bTD[n=5] f5 \eTD\bTD[n=7] f7 \eTD\eTR\eTABLE</texcode> It looks like: <context>
\bTABLE[width=3em]
\bTR\bTD d1 \eTD\bTD[n=2] d2 \eTD\bTD[n=5] d5 \eTD\bTD[n=7] d7 \eTD\eTR
Here is an example using the "m" option:
<texcodecontext source=yes>\bTABLE[width=3em]\bTR\bTD d1 \eTD\bTDsetuppapersize[m=2A5] d2 \eTD\bTD[m=5] d5 \eTD\bTD[m=7] d7 \eTD\eTR\bTR\bTD f1 \eTD\bTD[m=4] f4 \eTD\bTD[m=5] f5 \eTD\bTD[m=7] f7 \eTD\eTR\eTABLE</texcode> It looks like: <context>
\bTABLE[width=3em]
\bTR\bTD d1 \eTD\bTD[m=2] d2 \eTD\bTD[m=5] d5 \eTD\bTD[m=7] d7 \eTD\eTR
\setupTABLE[background=color,backgroundcolor=yellow]
\setupframed[framecolor=darkgreen]
 
\defineparagraphs[ThreeCols]
 
\startThreeCols
First
\StartTable
\bTABLE \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \eTABLE
\StopTable
 
\nextThreeCols
Second
\setupTABLE[column][last] [rightframe=off]
\framed[strut=no,corner=round,offset=.5\linewidth,,rulethickness=1mm]\bgroup
\bTABLE \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \eTABLE
\egroup
 
\nextThreeCols
Third
\setupTABLE[column][first][leftframe=off]
\setupTABLE[column][last] [rightframe=off]
\framed[strut=no,corner=round, radius=1.4mm,offset=-1mm,,rulethickness=.1mm]\bgroup \framed[strut=no,corner=round, radius=1.5mm,offset=0mm,,rulethickness=1mm,framecolor=white]\bgroup \bTABLE \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \bTR \bTD test \eTD \bTD test \eTD \eTR \eTABLE \egroup
\egroup
 
\stopThreeCols
\stoptext
<context source="yes">
\setuppapersize[A5]
\starttext
\setupcolors[state=start]
* <tt>loffset</tt>, <tt>roffset</tt>, <tt>toffset</tt>, <tt>boffset</tt> can be used in addition to <tt>offset</tt> to specify cell content offsets in each direction separately, see also {{cmd|framed}}
=TABLEs with old table syntax=
From the mailing list in March 2009, by Wolfgang Schuster and Hans Hagen:
[[Category:Tables]]
[[Category:XML]]
tt>\bTD

Navigation menu