ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* creating environments
@ 2007-01-29 12:21 Wolfgang Schuster
  2007-01-29 15:15 ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-01-29 12:21 UTC (permalink / raw)
  To: ntg-context

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.


Wolfgang

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

* Re: creating environments
  2007-01-29 12:21 creating environments Wolfgang Schuster
@ 2007-01-29 15:15 ` Aditya Mahajan
  2007-01-30 13:01   ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2007-01-29 15:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Aditya

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

* Re: creating environments
  2007-01-29 15:15 ` Aditya Mahajan
@ 2007-01-30 13:01   ` Wolfgang Schuster
  2007-01-30 15:05     ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-01-30 13:01 UTC (permalink / raw)
  To: ntg-context

On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
Aditya Mahajan <adityam@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 used tried the first way with saving the content into a buffer and
using the buffer content. This did no longer work when you try to write:

\placefloat
{\startFOO
 ...
 \stopFOO}

or

\starcombination[...]
{\startFOO
 ...
 \stopFOO}
{}
...
\stopcombination


Wolfgang

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

* Re: creating environments
  2007-01-30 13:01   ` Wolfgang Schuster
@ 2007-01-30 15:05     ` Aditya Mahajan
  2007-01-31 10:15       ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2007-01-30 15:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 30 Jan 2007, Wolfgang Schuster wrote:

> On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
> Aditya Mahajan <adityam@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

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

* Re: creating environments
  2007-01-30 15:05     ` Aditya Mahajan
@ 2007-01-31 10:15       ` Wolfgang Schuster
  2007-01-31 10:59         ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-01-31 10:15 UTC (permalink / raw)
  To: ntg-context

On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
Aditya Mahajan <adityam@umich.edu> wrote:

> On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
> 
> > On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
> > Aditya Mahajan <adityam@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

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

* Re: creating environments
  2007-01-31 10:15       ` Wolfgang Schuster
@ 2007-01-31 10:59         ` Hans Hagen
  2007-01-31 16:24           ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2007-01-31 10:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:
> On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
> Aditya Mahajan <adityam@umich.edu> wrote:
>
>   
>> On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
>>
>>     
>>> On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
>>> Aditya Mahajan <adityam@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.
>   
no, there is \setbuffer but in general (at least not in context mkii) 
buffers are to be defined at the outer level
> It's not a real problem but I wanted to know if it is possible to
> define a environment in the way I wanted.
>   


-- 

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

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

* Re: creating environments
  2007-01-31 10:59         ` Hans Hagen
@ 2007-01-31 16:24           ` Wolfgang Schuster
  2007-02-05 13:01             ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-01-31 16:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2848 bytes --]

2007/1/31, Hans Hagen <pragma@wxs.nl>:
>
> Wolfgang Schuster wrote:
> > On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
> > Aditya Mahajan <adityam@umich.edu> wrote:
> >
> >
> >> On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
> >>
> >>
> >>> On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
> >>> Aditya Mahajan <adityam@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.
> >
> no, there is \setbuffer but in general (at least not in context mkii)
> buffers are to be defined at the outer level
> > It's not a real problem but I wanted to know if it is possible to
> > define a environment in the way I wanted.
> >


Hi Hans,

I looked into core-buf but this was not what I was looking for.

What I want is a command like this:

\def\defineFOO[#1]%
  {\expandafter\def\csname start#1\endcsname##1\csname stop#1\endcsname%
     {\startFOO##1\stopFOO}}

and after I wrote

\defineFOO[MYFOO]

I can use the next command

\startMYFOO...\stopMYFOO

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 4434 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: creating environments
  2007-01-31 16:24           ` Wolfgang Schuster
@ 2007-02-05 13:01             ` Wolfgang Schuster
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Schuster @ 2007-02-05 13:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3250 bytes --]

2007/1/31, Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
>
>
> 2007/1/31, Hans Hagen <pragma@wxs.nl>:
> >
> > Wolfgang Schuster wrote:
> > > On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
> > > Aditya Mahajan < adityam@umich.edu> wrote:
> > >
> > >
> > >> On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
> > >>
> > >>
> > >>> On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
> > >>> Aditya Mahajan < adityam@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.
> > >
> > no, there is \setbuffer but in general (at least not in context mkii)
> > buffers are to be defined at the outer level
> > > It's not a real problem but I wanted to know if it is possible to
> > > define a environment in the way I wanted.
> > >
>
>
> Hi Hans,
>
> I looked into core-buf but this was not what I was looking for.
>
> What I want is a command like this:
>
> \def\defineFOO[#1]%
>   {\expandafter\def\csname start#1\endcsname##1\csname stop#1\endcsname%
>      {\startFOO##1\stopFOO}}
>
> and after I wrote
>
> \defineFOO[MYFOO]
>
> I can use the next command
>
> \startMYFOO...\stopMYFOO
>
> Wolfgang
>

Hi all,

I found now a solution for my problem.

Thanks for all messages.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 5237 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

end of thread, other threads:[~2007-02-05 13:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-29 12:21 creating environments Wolfgang Schuster
2007-01-29 15:15 ` Aditya Mahajan
2007-01-30 13:01   ` Wolfgang Schuster
2007-01-30 15:05     ` Aditya Mahajan
2007-01-31 10:15       ` Wolfgang Schuster
2007-01-31 10:59         ` Hans Hagen
2007-01-31 16:24           ` Wolfgang Schuster
2007-02-05 13:01             ` Wolfgang Schuster

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