[NTG-context] help on def & buffer

Hans Hagen pragma at wxs.nl
Wed Mar 30 10:11:43 CEST 2016


On 3/30/2016 9:27 AM, Erik Margraf wrote:
> Dear List,
>
> please help me with my problem here ....
>
> I - probably naively - tried the following:
> ------------------------
>
> \starttext
>
>
> \def\Buffer#1#2
>
> {
>
> \startbuffer[#1]
>
> \input #2
>
> \stopbuffer
>
> }
>
> \Buffer{bla}{knuth}
>
>
> \stoptext
>
> -------------------------
>
>
> Context gives me the following error on this:
>
>
> tex error > tex error on line 9 in file
> C:/Users/emargraf/Documents/buffer.tex: ! Undefined control sequence
>
>
>
> \Buffer ...startbuffer [#1] \input #2 \stopbuffer
>
> l.9 \Buffer{bla}{knuth}

\startbuffer .. \stopbuffer is parsed special

so use:

\def\Buffer#1#2
   {\setbuffer[#1]{\input #2\relax}}

\Buffer{bla}{knuth}

but i'm not sure what you gain here as it will still input tufte each time

Hans

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


More information about the ntg-context mailing list