ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem with \stoptabulate
@ 2023-03-20 23:34 Bruce Horrocks via ntg-context
  2023-03-21  5:23 ` jbf via ntg-context
  2023-03-21  8:35 ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 5+ messages in thread
From: Bruce Horrocks via ntg-context @ 2023-03-20 23:34 UTC (permalink / raw)
  To: ntg-context mailing list; +Cc: Bruce Horrocks

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with \stoptabulate
  2023-03-20 23:34 Problem with \stoptabulate Bruce Horrocks via ntg-context
@ 2023-03-21  5:23 ` jbf via ntg-context
  2023-03-21 11:06   ` Bruce Horrocks via ntg-context
  2023-03-21  8:35 ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 5+ messages in thread
From: jbf via ntg-context @ 2023-03-21  5:23 UTC (permalink / raw)
  To: Bruce Horrocks via ntg-context; +Cc: jbf

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
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with \stoptabulate
  2023-03-20 23:34 Problem with \stoptabulate Bruce Horrocks via ntg-context
  2023-03-21  5:23 ` jbf via ntg-context
@ 2023-03-21  8:35 ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2023-03-21  8:35 UTC (permalink / raw)
  To: Bruce Horrocks via ntg-context; +Cc: Hans Hagen

On 3/21/2023 12:34 AM, 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?
\definetabulate[MyExample][|r|c|l|p|]

\def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR}

\startMyExample
   \MyExampleItem{before}{after}{change before into after}
   \MyExampleItem{straw}{gold}{Rumpelstiltskin}
\stopMyExample


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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with \stoptabulate
  2023-03-21  5:23 ` jbf via ntg-context
@ 2023-03-21 11:06   ` Bruce Horrocks via ntg-context
  2023-03-21 11:32     ` Bruce Horrocks via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Horrocks via ntg-context @ 2023-03-21 11:06 UTC (permalink / raw)
  To: ntg-context mailing list; +Cc: Bruce Horrocks


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@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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problem with \stoptabulate
  2023-03-21 11:06   ` Bruce Horrocks via ntg-context
@ 2023-03-21 11:32     ` Bruce Horrocks via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Horrocks via ntg-context @ 2023-03-21 11:32 UTC (permalink / raw)
  To: ntg-context mailing list; +Cc: Bruce Horrocks

Sorry everyone, ignore me, it doesn't work.

(Got my test files mixed up - aargh!)

> On 21 Mar 2023, at 11:06, Bruce Horrocks via ntg-context <ntg-context@ntg.nl> wrote:
> 
> 
> 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@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
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
> ___________________________________________________________________________________


—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-21 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 23:34 Problem with \stoptabulate Bruce Horrocks via ntg-context
2023-03-21  5:23 ` jbf via ntg-context
2023-03-21 11:06   ` Bruce Horrocks via ntg-context
2023-03-21 11:32     ` Bruce Horrocks via ntg-context
2023-03-21  8:35 ` Hans Hagen via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).