[NTG-context] creating environments
Wolfgang Schuster
schuster.wolfgang at googlemail.com
Wed Jan 31 11:15:06 CET 2007
On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
Aditya Mahajan <adityam at umich.edu> wrote:
> On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
>
> > On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
> > Aditya Mahajan <adityam at umich.edu> wrote:
> >
> >> On Mon, 29 Jan 2007, Wolfgang Schuster wrote:
> >>
> >>> Hi all,
> >>>
> >>>
> >>> I have a module with a envrionment defined in the following way:
> >>>
> >>> \def\startFOO#1\stopFOO{...#1...}
> >>>
> >>>
> >>> I try currently to write a command \defineFOO[MYFOO] that expands to my
> >>> already created environment.
> >>>
> >>> \startMYFOO#1\stopMYFOO -> \startFOO#1\stopFOO
> >>>
> >>>
> >>> I know it is possible to make this in the following way:
> >>>
> >>> \def\startMYFOO#1\stopMYFOO{\startFOO#1\stopFOO}
> >>>
> >>> but this not what I want.
> >>
> >> Something like this
> >>
> >> \def\defineFOO[#1]%
> >> {\setvalue{\c!start#1}{\startFOO}
> >> \setvalue{\c!stop#1} {\stopFOO}}
> >>
> >
> > Hi Aditya,
> >
> >
> > this can only be used if you define your environment in this way:
> >
> > \def\startFOO{...}
> > \def\stopFoo{...}
> >
> >
> > I defined my environment in this way:
> >
> > \def\startFOO#1\stopFOO{...}
> >
> > This means TeX reads everything from \startFOO till \stopFOO and looks
> > afterwards at the replacement text.
>
> I am not sure how something like that you work.
>
> > I used tried the first way with saving the content into a buffer and
> > using the buffer content.
>
> If you want to write to a buffer and later use it, there are low level
> macros to define your own buffer commands. Have a look at the R module
> to see an example. Depending on your usage, you will have to keep
> track of the buffer numbers on your own.
>
> Aditya
Hi Aditya,
I tried to use a buffer but you cannot make something like this:
\starttext
\placefigure
{}
{\startbuffer{mybuffer}
Floating text from a buffer
\stopbuffer
\getbuffer{mybuffer}}
\stoptext
with content saved in a buffer.
It's not a real problem but I wanted to know if it is possible to
define a environment in the way I wanted.
Wolfgang
More information about the ntg-context
mailing list