In my document, I have several instances of a tabulate environment, all of which look like this:
\startplacetable[location=force,number=no]
\starttabulate[|l|r|rw(2cm)|]
\HL \NC {\bf Process} \NC {\bf\em T} \NC {\bf\em C} \NC \NR \HL
% --- varying content here, example line: ---
\NC A \NC 200ms \NC 20ms \NC \NR
% -------------------------------------------
\HL
\stoptabulate
\stopplacetable
So I try to create a custom start-stop environment:
\definestartstop[ProcessTable][
before={%
\startplacetable[location=force,number=no]
\starttabulate[|l|r|rw(2cm)|]
\HL \NC {\bf Process} \NC {\bf\em T} \NC {\bf\em C} \NC \NR \HL
},%
after={%
\HL
\stoptabulate
\stopplacetable
}%
]
This, when used in a document, never finishes, e.g.:
\starttext
\startProcessTable
\NC A \NC 200ms \NC 20ms \NC \NR
\stopProcessTable
\stoptext
last two lines of ConTeXt output:
close source > level 2, order 3, name '/.../test.tex'
close source > level 1, order 3, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
When trying to use it together with the original code:
\starttext
\startProcessTable
\NC A \NC 200ms \NC 20ms \NC \NR
\stopProcessTable
\startplacetable[location=force,number=no]
\starttabulate[|l|r|rw(2cm)|]
\HL \NC {\bf Process} \NC {\bf\em T} \NC {\bf\em C} \NC \NR \HL
\stoptabulate
\stopplacetable
\stoptext
I get this output which hints to something being seriously wrong:
tex error > tex error on line 34 in file /.../test.tex: ! Missing } inserted
<inserted text>
}
<to be read again>
\endtemplate
<template> \endtemplate
\tabl_tabulate_column_normal ...\unskip \aligntab
\ifconditional \c_tabl_tab...
\tabl_tabulate_insert_body ...\dotagconstruct \NC
A \NC 200ms \NC 20ms \NC \...
\tabl_tabulate_insert_content ...late_insert_body
\tabl_tabulate_insert_foot...
...
l.34 \stoptabulate
24 %]
25
26 \starttext
27 \startProcessTable
28 \NC A \NC 200ms \NC 20ms \NC \NR
29 \stopProcessTable
30
31 \startplacetable[location=force,number=no]
32 \starttabulate[|l|r|rw(2cm)|]
33 \HL \NC {\bf Process} \NC {\bf\em T} \NC {\bf\em C} \NC \NR \HL
34 >> \stoptabulate
35 \stopplacetable
36 \stoptext
While trying to solve this, I discovered that there is \definetabulate
, so I tried to use that instead:
\definetabulate[ProcessTable][|l|r|rw(2cm)|]
\setuptabulate[ProcessTable][
before={%
\startplacetable[location=force,number=no]
},
inner={%
\HL \NC {\bf Process} \NC {\bf\em T} \NC {\bf\em C} \NC \NR \HL
},
after={%
\stopplacetable
}%
]
This compiles, but does not render the table (i.e. the text from both header and body is rendered, but without lines and alignment). I assume that I am using the inner
parameter wrong, but I found no documentation or example on it. When I remove the inner
parameter, the table renders, but without the header.
How can I properly setup such an environment?