ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Is it possible to use \starttabulate inside a macro?
@ 2002-02-10 11:24 Daniel Pittman
  2002-02-11  8:56 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Pittman @ 2002-02-10 11:24 UTC (permalink / raw)


I am trying to build a set of macros on top of ConTeXt that will typeset
recipes. As part of this I want to be able to break up the instructions
into a set of steps, placed in a tabulate environment.

I have been trying to write the appropriate macros to do this, but,
through my lack of familiarity with TeX programming, I don't seem to be
able to get it to work.

I have, currently:

\def\step{
\ifFirstStep
  \FirstStepfalse
  \starttabulate[|p(.4\hsize)|p|]
\else
  \NC \NR
\fi
}

The intention is that each recipe has a title, some arbitrary amount
(possibly no) leading material, then a series of steps, such that:

\recipe(title)
... stuff about the recipe ...
\step
... first step ...
\step
... second step ....
\end

When I try to run the TeX file, however, I get the following output:

Runaway argument?
\FirstStepfalse \else \NC \NR \fi Then, add this here stuff to the mi\ETC.
! Forbidden control sequence found while scanning use of \doprocesscontent.
<inserted text> 
                \par 
<to be read again> 
                   \endtemplate 
<template> \strut \endtemplate 

\processtabulate ...sa \cr \tabulatecontent \crcr 
                                                  }}\ifnum \nofautotabulate ...

\recipe ...ddle]{#1}\par #2 \NC \NR \stoptabulate 
                                                  \par 
l.69 \end

I couldn't seem to get this to work, no matter what. So, is it possible
to use the tabulate environment in this fashion?

Also, it didn't seem to be possible to use buffers within a macro at
all; they didn't pick up any content no matter what I put in them.

This failed:

\setupbuffer[test]
\hidebuffers[test]

\def\test{\begintest This is a test \endtest}

\test

\getbuffer[test]

        Daniel

-- 
A wonderful discovery, psychoanalysis.  
Makes quite simple people feel they're complex.
        -- S. N. Behrman


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

* Re: Is it possible to use \starttabulate inside a macro?
  2002-02-10 11:24 Is it possible to use \starttabulate inside a macro? Daniel Pittman
@ 2002-02-11  8:56 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2002-02-11  8:56 UTC (permalink / raw)
  Cc: ntg-context

At 10:24 PM 2/10/2002 +1100, Daniel Pittman wrote:
I have, currently:

>\def\step{
>\ifFirstStep
>   \FirstStepfalse
>   \starttabulate[|p(.4\hsize)|p|]
>\else
>   \NC \NR
>\fi
>}
>
>The intention is that each recipe has a title, some arbitrary amount
>(possibly no) leading material, then a series of steps, such that:
>
>\recipe(title)
>... stuff about the recipe ...
>\step
>... first step ...
>\step
>... second step ....
>\end
>
>
>When I try to run the TeX file, however, I get the following output:

that kind of trickery will probably interfere with table lookahead (baked 
into tex), so i would opt for:

\definetabulate
   [recipe]
   [|l|l|l|]

\setuptabulate
   [recipe]
   [inner=\setquicktabulate\step,before=]

\startrecipe
\step first step  \\ next \\ more  \\
\step second step \\ bla  \\ again \\
\step last step   \\ next \\ oeps  \\
\stoprecipe

\definehead[recipe][subsubsubject]
\setuphead[recipe][after=,style=bold]

\def\StartRecipe#1%
   {\recipe{#1}\startrecipe}

\StartRecipe{whatever}
\step first step  \\ next \\ more  \\
\step second step \\ bla  \\ again \\
\step last step   \\ next \\ oeps  \\
\stoprecipe

 > Also, it didn't seem to be possible to use buffers within a macro at

right, limitation by design

>all; they didn't pick up any content no matter what I put in them.
>
>This failed:
>
>\setupbuffer[test]
>\hidebuffers[test]
>
>\def\test{\begintest This is a test \endtest}
>
>\test
>
>\getbuffer[test]

In your case you could store teh text into a macro -)

You can however fill a buffer in the following way:

\def\test{\setbuffer[test]This is a test\endbuffer}

\test

\getbuffer[test]

There is also \definebuffer as well as the undocumented \dostartbuffer

\def\GrabCrap{\dostartbuffer[crap][GrabCrap][NoMoreCrap]}

\GrabCrap
believe it or not
but this works
\NoMoreCrap

\getbuffer[crap]
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


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

end of thread, other threads:[~2002-02-11  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-10 11:24 Is it possible to use \starttabulate inside a macro? Daniel Pittman
2002-02-11  8:56 ` Hans Hagen

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).