[NTG-context] Problem with \stoptabulate
Bruce Horrocks
ntg at scorecrow.com
Tue Mar 21 12:06:30 CET 2023
Thanks Julian - I tried a startstop environment originally but it didn't work.
The answer turns out to be trivial - just needed to use \long\def for \stoptabulate so the following appears to work:
\def\startMyExample{\starttabulate[|r|c|l|p|]}
\long\def\stopMyExample{\stoptabulate} %% long def required here
\def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR}
\starttext
Here are some examples...
\startMyExample
\MyExampleItem{before}{after}{change before into after}
\MyExampleItem{straw}{gold}{Rumpelstiltskin}
\stoptabulate
\stoptext
> On 21 Mar 2023, at 05:23, jbf via ntg-context <ntg-context at ntg.nl> wrote:
>
> Not sure if this helps, Bruce, but there is \definestartstop
>
> Julian
>
> On 21/3/23 10:34, Bruce Horrocks via ntg-context wrote:
>> I have a technical manual style document that requires a lot of examples to be included.
>>
>> They can easily be typeset with a table so I thought I would save myself some typing by defining macros for the various bits of a tabulate table. Thus I have:
>>
>> \def\startMyExample{\starttabulate[|r|c|l|p|]}
>> \def\stopMyExample{\stoptabulate}
>> \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR}
>>
>> \starttext
>> Here are some examples...
>>
>> \startMyExample
>> \MyExampleItem{before}{after}{change before into after}
>> \MyExampleItem{straw}{gold}{Rumpelstiltskin}
>> \stopMyExample
>> %\stoptabulate
>>
>> \stoptext
>>
>> The problem is that \stopMyExample doesn't work - the \stoptabulate isn't recognised and I get an end of file reached error. If use a straight \stoptabulate then it works as expected. That's fine but it would be nice, from an aesthetic point of view, to have start & stop 'paired' commands in the source.
>>
>> Presumably some sort of deep ConTeXt fu is going on - can anyone explain it please?
>>
>> Regards,
>> â
>> Bruce Horrocks
>> Hampshire, UK
â
Bruce Horrocks
Hampshire, UK
More information about the ntg-context
mailing list