Changes

Jump to navigation Jump to search
2,466 bytes removed ,  08:16, 6 April 2011
Tabulate doesn’t support columnspan
\stoptabulate
</texcode>
 
=Column Spans=
 
Tabulate has no support for column spans but you could add this
function yourself.
The code to do this depends on the tabulate setting and you have
to know what content what column setting you need.
 
==Single row columns==
 
To span columns in cells with <code>l</code>, <code>r</code> or <code>c</code>
you could use <code>\span\omit\span\omit\span\omit</code> for each cell.
You could prevent these values you could them in a macro and use it with
<code>\use{2}</code> or <code>\TWO</code> in the tabulate environment.
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\def\tabulateuse#1%
{\dorecurse{\numexpr2*#1-1\relax}{\span\omit}}
 
\appendtoks
\let\use\tabulateuse
\defineTABLEshorthands
\to \everytabulate
 
\starttext
 
\starttabulate[|l|Br|l|l|]
\NC a \NC b \NC c \NC d \NR
\NC 1 \NC 2 \TWO \NC 4 \NR
\stoptabulate
 
\stoptext
</texcode>
|
|<context>
\def\tabulateuse#1%
{\dorecurse{\numexpr2*#1-1\relax}{\span\omit}}
 
\appendtoks
\let\use\tabulateuse
\defineTABLEshorthands
\to \everytabulate
 
\starttext
 
\starttabulate[|l|Br|l|l|]
\NC a \NC b \NC c \NC d \NR
\NC 1 \NC 2 \TWO \NC 4 \NR
\stoptabulate
 
\stoptext
</context>
|}
 
== Paragraph columns ==
 
For spanned columns in cells with paragraphs you need a different
implementation.
 
To use this macro you have to take care about a few things:
 
* You have to set a width for each cell
 
* The format for the spanned column is fixed and you have to change it in the macro
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\def\tabulateuse#1%
{\dorecurse{\numexpr2*#1-1\relax}{\span\omit}\raggedright\ignorespaces}
 
\appendtoks
\let\use\tabulateuse
\defineTABLEshorthands
\to \everytabulate
 
\starttext
 
\starttabulate[|p(2cm)|p(3cm)|p(4cm)|]
\NC \dorecurse{10}{text } \NC \dorecurse{4}{Lorem Ipsum } \NC
\dorecurse{18}{text } \NC\NR
\NC \TWO Short text spanning two tabulate paragraphs. \NC
\dorecurse{17}{text } \NC\NR
\stoptabulate
 
\stoptext
</texcode>
|
|<context>
\def\tabulateuse#1%
{\dorecurse{\numexpr2*#1-1\relax}{\span\omit}\raggedright\ignorespaces}
 
\appendtoks
\let\use\tabulateuse
\defineTABLEshorthands
\to \everytabulate
 
\starttext
\switchtobodyfont[8pt]
 
\starttabulate[|p(2cm)|p(3cm)|p(4cm)|]
\NC \dorecurse{10}{text } \NC \dorecurse{4}{Lorem Ipsum } \NC
\dorecurse{18}{text } \NC\NR
\NC \TWO Short text spanning two tabulate paragraphs. \NC
\dorecurse{17}{text } \NC\NR
\stoptabulate
 
\stoptext
</context>
|}
=See also=
gardener
110

edits

Navigation menu