Re: [NTG-context] buffers inside startMPpage

2016-10-14 Thread Jan Willem Flamma
Thank you Wolfgang.

This suits my needs just fine.

Kind regards,
Jan Willem Flamma

> On 14 okt. 2016, at 10:34, Wolfgang Schuster  
> wrote:
> 
>> Jan Willem Flamma  14. Oktober 2016 um 10:12
>> Dear list members,
>> 
>> I create all my MetaFun drawings in a separate environment file where each 
>> individual drawing sits inside a start/stopbuffer. This allows me to easily 
>> use those drawings in all my documents using \processMPbuffer[name]. Works 
>> just fine.
>> 
>> However, I also wish to have all the drawing available in a pdf file (each 
>> drawing on a separate page). This allows me to split the pdf and use the 
>> drawing elsewhere (e.g. in a Powerpoint) or include page(s) from the pdf in 
>> another document.
>> 
>> The below MWE represent my MetaFun drawings file.
>> The idea is that by uncommenting the \enablemode[makepdf] I can create the 
>> pdf file with drawings. It seems however that startMPpage does not accept 
>> buffers (I also tried processbuffer and processMPbuffer).
>> 
>> Is it possible to somehow make this work?
> You can use
> 
> \startTEXpage
> \processMPbuffer[…]
> \stopTEXpage
> 
> but loading a buffer in MPpage doesn’t work because the content of the 
> environment
> is just passed to MetaPost and buffers can’t be loaded inside MetaPost code 
> unless
> Hans adds a function for this, e.g.
> 
> \startMPcode
> buffer("mybuffer")
> \stopMPcode
> 
> Wolfgang
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] buffers inside startMPpage

2016-10-14 Thread Wolfgang Schuster

Jan Willem Flamma 
14. Oktober 2016 um 10:12
Dear list members,

I create all my MetaFun drawings in a separate environment file where 
each individual drawing sits inside a start/stopbuffer. This allows me 
to easily use those drawings in all my documents using 
\processMPbuffer[name]. Works just fine.


However, I also wish to have all the drawing available in a pdf file 
(each drawing on a separate page). This allows me to split the pdf and 
use the drawing elsewhere (e.g. in a Powerpoint) or include page(s) 
from the pdf in another document.


The below MWE represent my MetaFun drawings file.
The idea is that by uncommenting the \enablemode[makepdf] I can create 
the pdf file with drawings. It seems however that startMPpage does not 
accept buffers (I also tried processbuffer and processMPbuffer).


Is it possible to somehow make this work?

You can use

\startTEXpage
\processMPbuffer[…]
\stopTEXpage

but loading a buffer in MPpage doesn’t work because the content of the 
environment
is just passed to MetaPost and buffers can’t be loaded inside MetaPost 
code unless

Hans adds a function for this, e.g.

\startMPcode
buffer("mybuffer")
\stopMPcode

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] buffers inside startMPpage

2016-10-14 Thread Jan Willem Flamma
Dear list members,

I create all my MetaFun drawings in a separate environment file where each 
individual drawing sits inside a start/stopbuffer. This allows me to easily use 
those drawings in all my documents using \processMPbuffer[name]. Works just 
fine.

However, I also wish to have all the drawing available in a pdf file (each 
drawing on a separate page). This allows me to split the pdf and use the 
drawing elsewhere (e.g. in a Powerpoint) or include page(s) from the pdf in 
another document.

The below MWE represent my MetaFun drawings file.
The idea is that by uncommenting the \enablemode[makepdf] I can create the pdf 
file with drawings. It seems however that startMPpage does not accept buffers 
(I also tried processbuffer and processMPbuffer).

Is it possible to somehow make this work?

Thanks and regards,
Jan Willem Flamma


%\enablemode[makepdf]

\startbuffer[fig1]
  draw fullcircle scaled 2cm withcolor red ;
\stopbuffer

\startbuffer[fig2]
  draw unitsquare scaled 2cm withcolor red ;
\stopbuffer


\startmode[makepdf]
  \starttext
\startMPpage
  \getbuffer[fig1]
\stopMPpage

\startMPpage
  \getbuffer[fig2]
\stopMPpage
  \stoptext
\stopmode



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] buffers writing CR only instead of proper newlines (LF)

2015-05-02 Thread Mojca Miklavec
Hi,

The gnuplot module recently stopped working because the buffers now
seem to write out the CR (0x0d) instead of the LF character for
newlines.

Here's a minimal example as shamelessly stolen from the module:

\long\def\startXheader
  {\def\stopXheader{\ifx\savebuffer\undefined \else \savebuffer[x-header]\fi}%
   \dostartbuffer[x-header][startXheader][stopXheader]}
\def\resetXheader
  {\immediate\openout\scratchwrite=\jobname-x-header.tmp
   \immediate\closeout\scratchwrite}
\resetXheader

\starttext
\startXheader
hello
bachotex
\stopXheader
\stoptext

The problem is that I end up with a file with what vim shows as
hello^Mbachotex (^M = character 0x0d / CR).

This works properly in TL 2014.

Any hints greatly appreciated.

Thank you very much,
Mojca
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] buffers (append)

2013-01-15 Thread Sietse Brouwer
Hi Alan,

  In addition to \startbuffer \stopbuffer
  it would be nice to have \startappendbuffer \stopappendbuffer.
 
  I see that the lua function buffer.append() exists but I have not
  worked-out how to add this functionality cleanly as conTeXt macros.

Here you go!

% We want to join appended pieces with a newline
% but '\n' is a bit rotten to pass inside \ctxlua
% so we simply prepare the appending function inside \startluacode, instead
\startluacode
userdata = userdata or { }
function userdata.addTempToBuffer(buffername)
buffers.append(
buffername,
'\n' .. buffers.getcontent('APPENDTEMP')
)
end
\stopluacode

\def\startappendbuffer[#1]%
  {% 1: create a \stopappendbuffer that appends APPENDTEMP to the buffer #1
   \def\stopappendbuffer%
  {\ctxlua{userdata.addTempToBuffer('#1')}}
   % 2: write the buffer to APPENDTEMP instead of overwriting buffer #1
   % then addTempToBuffer will take care of the appending.
   \dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}


%%% --- And here is an example --- %%%
%%% --- With my respects to Dorothy L. Sayers --- %%%


\setuplayout[backspace=6cm, leftmargin=5cm, width=11cm]
\showframe

\starttext

\startbuffer[x]
\inmargin{Harriet Vane}
Here then at home, by no more storms distrest,
Folding laborious hands we sit, wings furled;
Here in close perfume lies the rose-leaf curled,
Here the sun stands and knows not east nor west,
Here no tide runs; we have come, last and best,
From the wide zone through dizzying circles hurled,
To that still centre where the spinning world
Sleeps on its axis, to the heart of rest.
\stopbuffer

\startlines
\getbuffer[x]
\stoplines

--

\startappendbuffer[x]

\inmargin{Lord Peter Wimsey}
Lay on thy whips, O Love, that we upright,
Poised on the perilous point, in no lax bed
May sleep, as tension at the verberant core
Of music sleeps; for, if thou spare to smite,
Staggering, we stoop, stooping, fall dumb and dead,
And, dying so, sleep our sweet sleep no more.
\stopappendbuffer

\startlines
\getbuffer[x]
\stoplines

--

\typebuffer[x]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] buffers (append)

2013-01-14 Thread Alan BRASLAU
Hello,

In addition to \startbuffer \stopbuffer
it would be nice to have \startappendbuffer \stopappendbuffer.

I see that the lua function buffer.append() exists but I have not
worked-out how to add this functionality cleanly as conTeXt macros.
I imagine that this might be quite trivial for our TeX programming
experts... (for once, a [useful?] suggestion that in the end will not
entail many hours of work? :)

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] buffers (append)

2013-01-14 Thread Wolfgang Schuster

Am 14.01.2013 um 09:00 schrieb Alan BRASLAU alan.bras...@cea.fr:

 Hello,
 
 In addition to \startbuffer \stopbuffer
 it would be nice to have \startappendbuffer \stopappendbuffer.
 
 I see that the lua function buffer.append() exists but I have not
 worked-out how to add this functionality cleanly as conTeXt macros.
 I imagine that this might be quite trivial for our TeX programming
 experts... (for once, a [useful?] suggestion that in the end will not
 entail many hours of work? :)


\startbuffer[a]
Line 1
\stopbuffer

\startbuffer[b]
Line 2
\stopbuffer

\starttext

\startlines
\getbuffer[a,b]
\stoplines

\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] buffers (append)

2013-01-14 Thread Alan BRASLAU
On Mon, 14 Jan 2013 09:34:08 +0100
Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

 
 Am 14.01.2013 um 09:00 schrieb Alan BRASLAU alan.bras...@cea.fr:
 
  Hello,
  
  In addition to \startbuffer \stopbuffer
  it would be nice to have \startappendbuffer \stopappendbuffer.
  
  I see that the lua function buffer.append() exists but I have not
  worked-out how to add this functionality cleanly as conTeXt macros.
  I imagine that this might be quite trivial for our TeX programming
  experts... (for once, a [useful?] suggestion that in the end will
  not entail many hours of work? :)
 
 
 \startbuffer[a]
 Line 1
 \stopbuffer
 
 \startbuffer[b]
 Line 2
 \stopbuffer
 
 \starttext
 
 \startlines
 \getbuffer[a,b]
 \stoplines
 
 \stoptext
 
 Wolfgang

Thank you Wolfgang, this is useful.

However, it would still be helpful to be able to generically add to a
buffer without having to rename a new one. Shouldn't be very difficult
but I did not find that anything like this already exists. I often
think this way when I teach, adding steps to an example while repeating
the previous steps.

\startbuffer[a]
Line 1
\stopbuffer

\getbuffer[a]

\startaddtobuffer[a]
Line 2
\stopaddtobuffer

\getbuffer[a]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Buffers vs. \def

2012-04-18 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

a question - I'm just curious:

What is advantage (or maybe intension) of using buffers over \def?

Compare:


\def\BufA{This is buffer A.}

\startbuffer[BufB]
  This is buffer B.
\stopbuffer

\starttext
  \BufA
  \getbuffer[BufB]

  \ifx\BufC\undefined No buffer C.\else\BufC\fi
\stoptext


Both ways give the required effect.

Moreover, when using \def, I can also test its existence (maybe it's also 
possible with buffers, but I don't know how).

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

t-Buf.mkiv
Description: Binary data


t-Buf.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Buffers vs. \def

2012-04-18 Thread Hans Hagen

On 18-4-2012 11:48, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

Hello,

a question - I'm just curious:

What is advantage (or maybe intension) of using buffers over \def?


better test with

\startlines
test
test
\stoplines

also, bufferes can be flushed verbatim, as tex, as ... while macros are 
sort of frozen.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers vs. \def

2012-04-18 Thread Wolfgang Schuster

Am 18.04.2012 um 11:48 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

 Hello,
 
 a question - I'm just curious:
 
 What is advantage (or maybe intension) of using buffers over \def?
 
 Compare:
 
 
 \def\BufA{This is buffer A.}
 
 \startbuffer[BufB]
  This is buffer B.
 \stopbuffer
 
 \starttext
  \BufA
  \getbuffer[BufB]
 
  \ifx\BufC\undefined No buffer C.\else\BufC\fi

\ifdefined\BufC … \else … \fi

Sometimes \setvariables is a better method to store texts in a document.

 \stoptext
 
 
 Both ways give the required effect.
 
 Moreover, when using \def, I can also test its existence (maybe it's also 
 possible with buffers, but I don't know how).

You can use \doifelsebuffer{buffer name}{…}{…}.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Buffers can’t be loaded as figure

2011-02-18 Thread Hans Hagen

On 17-2-2011 6:22, Wolfgang Schuster wrote:

Hi Hans,

buffers in \externalfigure are broken.

\startbuffer[foo]
FOO
\stopbuffer
\starttext
\externalfigure[foo][type=buffer]
\stoptext

Wolfgang



ok, fixed

btw, 'type' is obsolete, but 'method' stayed, so method=buffer

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Buffers can’t be loaded as figure

2011-02-17 Thread Wolfgang Schuster
Hi Hans,

buffers in \externalfigure are broken.

\startbuffer[foo]
FOO
\stopbuffer
\starttext
\externalfigure[foo][type=buffer]
\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] buffers and expansion order

2010-12-13 Thread Yury G. Kudryashov
Hi!

Why the following doesn't work?

\def\mybuf{\startbuffer[a]b\stopbuffer}
\mybuf

Actually, I need slightly more advanced command, but this is the minimal 
example.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] buffers and expansion order

2010-12-13 Thread Wolfgang Schuster

Am 13.12.2010 um 12:04 schrieb Yury G. Kudryashov:

 Hi!
 
 Why the following doesn't work?
 
 \def\mybuf{\startbuffer[a]b\stopbuffer}

\def\mybuf{\setbuffer[a]b\endbuffer}

Wolfgang


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-06-02 Thread Wolfgang Schuster
On Sat, May 31, 2008 at 12:51 PM, Hans Hagen [EMAIL PROTECTED] wrote:
 Wolfgang Schuster wrote:
 Hi Hans,

 I got yesterday a bug report for my letter module if the \startletter
 command takes no arguments.

 The following example show the problem without the module.

 \def\startletter
   {\dosingleempty\dostartletter}

 \def\dostartletter[#1]%
   {\dostartbuffer[letter][startletter][stopletter]}

 either use \definebuffer, or do

Did not work in my case.

 \def\startletter
   {\bgroup\obeylines\dosingleempty\dostartletter}

 \def\dostartletter[#1]%
   {\egroup\dostartbuffer[letter][startletter][stopletter]}

This has the unwanted side effect I expected to allow the argument
only on the same line as the \startletter command or is otherwise
shown in the output.

I will now include a modified version from the \flushbufferline macro
with my package in will look for the first person with a problem.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-06-02 Thread Hans Hagen
Wolfgang Schuster wrote:

 I will now include a modified version from the \flushbufferline macro
 with my package in will look for the first person with a problem.

keep in mind that such low level macros are not part of the official 
interface and their name and/or the way of calling them may change

Hans

-
   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
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-06-02 Thread Wolfgang Schuster
On Mon, Jun 2, 2008 at 10:05 AM, Hans Hagen [EMAIL PROTECTED] wrote:
 Wolfgang Schuster wrote:

 I will now include a modified version from the \flushbufferline macro
 with my package in will look for the first person with a problem.

 keep in mind that such low level macros are not part of the official
 interface and their name and/or the way of calling them may change

I keep a eye on this but I won't force users a put \relax after \startletter
only because they use MkII.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Buffers and commands with optional arguments

2008-05-31 Thread Wolfgang Schuster
Hi Hans,

I got yesterday a bug report for my letter module if the \startletter
command takes no arguments.

The following example show the problem without the module.

\def\startletter
  {\dosingleempty\dostartletter}

\def\dostartletter[#1]%
  {\dostartbuffer[letter][startletter][stopletter]}

\starttext

% This did work

\startletter
Text
\stopletter

\getbuffer[letter]

% But this did create a error message from TeX

\startletter

Text

\stopletter

\getbuffer[letter]

\stopletter

One solution for the second text can be solved when I add
a \relax after the \startletter command but I wanted a better
solution.

Because TeX mentions \flushbufferline in error message I tried
to modify the macro and came to the following solution.

%\def\flushbufferline#1%
\long\def\flushbufferline#1%
  {\iftmpblockstarted
 \ifsegmentatebuffer
   \ifemptybufferline
 \immediate\write\tmpblocks{\string\stopbufferparagraph }%
 \immediate\write\tmpblocks{\string\startbufferparagraph}%
   \else
 \immediate\write\tmpblocks{#1}%
   \fi
 \else
   \immediate\write\tmpblocks{#1}%
 \fi
   \else
 \doifsomething{#1}
   {\tmpblockstartedtrue
%\immediate\write\tmpblocks{\string#1}}%
\immediate\write\tmpblocks{#1}}%
   \fi}

The macro has to be defined as long and the \string
in the \write command has to be removed. I made a
few short tests and saw no negative sideeffects from
my changes.

Another problem could arise with a few commands
in the letter environment if no empty line is written
after \startletter.

The following result also in a error message.

\startletter
\dorecurse{2}{\input knuth\par}
\stopbuffer

With another modification of \flushbufferline also this
example could work, my final patch was now:

\long\def\flushbufferline#1%
  {\iftmpblockstarted
 \ifsegmentatebuffer
   \ifemptybufferline
 \immediate\write\tmpblocks{\string\stopbufferparagraph }%
 \immediate\write\tmpblocks{\string\startbufferparagraph}%
   \else
 \immediate\write\tmpblocks{#1}%
   \fi
 \else
   \immediate\write\tmpblocks{#1}%
 \fi
   \else
 \convertargument#1\to\ascii
 %\doifsomething{#1}
 \doifsomething\ascii
   {\tmpblockstartedtrue
%\immediate\write\tmpblocks{\string#1}}%
%\immediate\write\tmpblocks{#1}}%
\immediate\write\tmpblocks{\ascii}}%
   \fi}

Could my seond or at least my first patched version
of the \flushbufferline macro integrated into core-buf.mkii
because I won't force users of my letter module to put a \relax
after \startletter only because they use MkII.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-05-31 Thread Hans Hagen
Wolfgang Schuster wrote:

  \doifsomething{#1}
{\tmpblockstartedtrue
 %\immediate\write\tmpblocks{\string#1}}%
 \immediate\write\tmpblocks{#1}}%

i have no problem with the \long but changing the \string ... it's there 
for a reason so i need to look into it

  \convertargument#1\to\ascii
  %\doifsomething{#1}
  \doifsomething\ascii
{\tmpblockstartedtrue
 %\immediate\write\tmpblocks{\string#1}}%
 %\immediate\write\tmpblocks{#1}}%
 \immediate\write\tmpblocks{\ascii}}%

this may introduce spaces after \cs and therefore renders buffers 
useless for verbatim usage

 because I won't force users of my letter module to put a \relax
 after \startletter only because they use MkII.

did you try

\definebuffer[letter]



Hans

-
   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
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-05-31 Thread Hans Hagen
Wolfgang Schuster wrote:
 Hi Hans,
 
 I got yesterday a bug report for my letter module if the \startletter
 command takes no arguments.
 
 The following example show the problem without the module.
 
 \def\startletter
   {\dosingleempty\dostartletter}
 
 \def\dostartletter[#1]%
   {\dostartbuffer[letter][startletter][stopletter]}

either use \definebuffer, or do

\def\startletter
   {\bgroup\obeylines\dosingleempty\dostartletter}

\def\dostartletter[#1]%
   {\egroup\dostartbuffer[letter][startletter][stopletter]}



-
   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
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers and commands with optional arguments

2008-05-31 Thread Wolfgang Schuster
Hi Hans,

On Sat, May 31, 2008 at 12:33 PM, Hans Hagen [EMAIL PROTECTED] wrote:
 Wolfgang Schuster wrote:

  \doifsomething{#1}
{\tmpblockstartedtrue
 %\immediate\write\tmpblocks{\string#1}}%
 \immediate\write\tmpblocks{#1}}%

 i have no problem with the \long but changing the \string ... it's there
 for a reason so i need to look into it

I removed it because the output from

\startletter

text

\stopletter

was written as \partext to the temp file and I got \par text
after I removed the \string.

  \convertargument#1\to\ascii
  %\doifsomething{#1}
  \doifsomething\ascii
{\tmpblockstartedtrue
 %\immediate\write\tmpblocks{\string#1}}%
 %\immediate\write\tmpblocks{#1}}%
 \immediate\write\tmpblocks{\ascii}}%

 this may introduce spaces after \cs and therefore renders buffers
 useless for verbatim usage

This hack is not so importand because a empty line before the
\dorecurse did help.

 because I won't force users of my letter module to put a \relax
 after \startletter only because they use MkII.

 did you try

 \definebuffer[letter]

Seems to be work in my example, I will try it later with my module
but it looks good for the moment.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers (gone) in MK IV (was: MK IV Lilypond)

2007-08-26 Thread Mojca Miklavec
On 8/25/07, David Wooten wrote:
 Greetings,

 Did we end up with a working solution for t-lilypond?

I'm sorry. The file is attached. The only line added is
\ifx\savebuffer\undefined \else \savebuffer[lilypond-\the\lily!figures]\fi
and one probably needs the latest ConTeXt.

Mojca



\def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf
\lily!filename.eps}
+%D The following line is needed for LuaTeX, where buffers are kept in memory
+%D in contrast to other (older) flavours of TeX where they're written to a
+%D file automatically. We have to require writing to a file explicitely
+%D with \type{\savebuffer}.
+   \ifx\savebuffer\undefined \else
\savebuffer[lilypond-\the\lily!figures]\fi
\ifeof18


t-lilypond.tex
Description: TeX document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers (gone) in MK IV (was: MK IV Lilypond)

2007-08-25 Thread David Wooten
Greetings,

Did we end up with a working solution for t-lilypond? I've tinkered a  
bit Hans' response, too, but without luck.

Dave

On Aug. 21, 2007, at Aug 21, 3:53 PM, Mojca Miklavec wrote:

 On 8/21/07, Hans Hagen wrote:
 Mojca Miklavec wrote:
 On 8/21/07, David Wooten wrote:
 Greetings all,

 Has anyone had any luck getting the lilypond module to work with  
 mkiv/
 luatex engine? It fails for me (works fine with mkii/pdftex). I can
 send along some log info if others have found it to work.

 Hans has mentioned several times that buffers are not going to be
 written to files with luaTeX any more. This has a weird  
 consequence on
 many modules which relied exactly on that trick.

 Short example of what goes wrong:

 \starttext

 \startbuffer[a]
 Hello world!
 \stopbuffer
 \typebuffer[a]

 %\executesystemcommand{dosomethingwith \jobname-a.tmp}
 \stoptext

 The problem is that MK II created a file \jobname-a.tmp and lilypond
 module processed exactly that file further. In MK IV, that file  
 is not
 created any more (you can check that by running the above example  
 with
 --lua first and then with pdfTeX again. Only in the second case a  
 file
 [whateverthefilename]-a.tmp is created.)

 Lilypond module relied on that feature (I would rather call it
 dirty-but-very-useful-trick).

 Hans, what's the current general recipe for this kind of [mis]use  
 of buffers?

 I'll add savebuffer to core-buf.*

 Thanks a lot for that one!

 % engine=luatex

 \startluacode
  if not buffers.save then
  function buffers.save(name)
  if not name or name ==  then
  name = tex.jobname
  end
  local b, f = buffers.data[name],
 string.format(%s-%s.tmp,tex.jobname,name)
  b = (b and type(b) == table and table.join(b)) or b  
 or 
  io.savedata(f,b)
  end
  end
 \stopluacode

 \def\savebuffer{\dosingleempty\dosavebuffer}

 \def\dosavebuffer[#1]{\ctxlua{buffers.save(#1)}}

 \starttext

 \startbuffer[oeps]
 oeps
 \stopbuffer

 \startbuffer
 oepsoeps
 \stopbuffer

 \savebuffer[oeps] \savebuffer

 \stoptext

 I now tried to add the following three lines to t-lilypond.tex:

   \def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf \lily! 
 filename.eps}
   \beginLUATEX
   \savebuffer[lilypond-\the\lily!figures]%
   \endLUATEX
   \ifeof18
   \installprogram{\LP}%
 etc.

 But luaTeX now reports the following to console:

 system (LUATEX) : [line 32] \savebuffer [lilypond-\the \lily!figures
 ]\endLUATEX \ifeof 18 \installprogram {\LP }\doif \jobsuffix
 {pdf}{\installprogram {\PDF }}\else \executesystemcommand {\LP }\doif
 \jobsuffix {pdf}{\executesystemcommand {\PDF }}\fi \doifelse
 \jobsuffix {pdf} {\edef \lily!img {\lily!filename .pdf}}{\edef
 \lily!img {\lily!filename .eps}}\ifvmode \getfiguredimensions
 [\lily!filename .pdf]\leavevmode \newdimen \FigWidth \FigWidth
 =\figurewidth \ifdim \FigWidth \localhsize \!!dimena =\localhsize
 \advance \!!dimena by-\FigWidth \noindent \hskip \!!dimena \fi \fi
 \externalfigure [\lily!img ]\egroup

 and then

 systems : end file li at line 34
  )
 (\end occurred inside a group at level 1)

 ### simple group (level 1) entered at line 32 ({)
 ### bottom level
 ...
 No pages of output.
 Transcript written on li.log.


 It seems like a problem with grouping, but I have no idea how to
 prevent luaTeX from parsing the input further from what it's supposed
 to read.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers (gone) in MK IV

2007-08-22 Thread Hans Hagen
Mojca Miklavec wrote:

   \def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf 
 \lily!filename.eps}
   \beginLUATEX
   \savebuffer[lilypond-\the\lily!figures]%
   \endLUATEX

\beginLUATEX is not to be used in a macro

\beginLUATEX message to screen
bla bla
\endLUATEX

then becomes

\beginLUATEX message to screen bla bla \endLUATEX

and all goes to the message

just do

\ifx\savebuffer\undefined \else \savebuffer[] \fi

or so

since when don't you read the source code any more -)

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Buffers (gone) in MK IV (was: MK IV Lilypond)

2007-08-21 Thread Mojca Miklavec
On 8/21/07, David Wooten wrote:
 Greetings all,

 Has anyone had any luck getting the lilypond module to work with mkiv/
 luatex engine? It fails for me (works fine with mkii/pdftex). I can
 send along some log info if others have found it to work.

Hans has mentioned several times that buffers are not going to be
written to files with luaTeX any more. This has a weird consequence on
many modules which relied exactly on that trick.

Short example of what goes wrong:

\starttext

\startbuffer[a]
Hello world!
\stopbuffer
\typebuffer[a]

%\executesystemcommand{dosomethingwith \jobname-a.tmp}
\stoptext

The problem is that MK II created a file \jobname-a.tmp and lilypond
module processed exactly that file further. In MK IV, that file is not
created any more (you can check that by running the above example with
--lua first and then with pdfTeX again. Only in the second case a file
[whateverthefilename]-a.tmp is created.)

Lilypond module relied on that feature (I would rather call it
dirty-but-very-useful-trick).

Hans, what's the current general recipe for this kind of [mis]use of buffers?

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers (gone) in MK IV (was: MK IV Lilypond)

2007-08-21 Thread Hans Hagen
Mojca Miklavec wrote:
 On 8/21/07, David Wooten wrote:
 Greetings all,

 Has anyone had any luck getting the lilypond module to work with mkiv/
 luatex engine? It fails for me (works fine with mkii/pdftex). I can
 send along some log info if others have found it to work.
 
 Hans has mentioned several times that buffers are not going to be
 written to files with luaTeX any more. This has a weird consequence on
 many modules which relied exactly on that trick.
 
 Short example of what goes wrong:
 
 \starttext
 
 \startbuffer[a]
 Hello world!
 \stopbuffer
 \typebuffer[a]
 
 %\executesystemcommand{dosomethingwith \jobname-a.tmp}
 \stoptext
 
 The problem is that MK II created a file \jobname-a.tmp and lilypond
 module processed exactly that file further. In MK IV, that file is not
 created any more (you can check that by running the above example with
 --lua first and then with pdfTeX again. Only in the second case a file
 [whateverthefilename]-a.tmp is created.)
 
 Lilypond module relied on that feature (I would rather call it
 dirty-but-very-useful-trick).
 
 Hans, what's the current general recipe for this kind of [mis]use of buffers?

I'll add savebuffer to core-buf.*

% engine=luatex

\startluacode
 if not buffers.save then
 function buffers.save(name)
 if not name or name ==  then
 name = tex.jobname
 end
 local b, f = buffers.data[name], 
string.format(%s-%s.tmp,tex.jobname,name)
 b = (b and type(b) == table and table.join(b)) or b or 
 io.savedata(f,b)
 end
 end
\stopluacode

\def\savebuffer{\dosingleempty\dosavebuffer}

\def\dosavebuffer[#1]{\ctxlua{buffers.save(#1)}}

\starttext

\startbuffer[oeps]
oeps
\stopbuffer

\startbuffer
oepsoeps
\stopbuffer

\savebuffer[oeps] \savebuffer

\stoptext



-
   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
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffers (gone) in MK IV (was: MK IV Lilypond)

2007-08-21 Thread Mojca Miklavec
On 8/21/07, Hans Hagen wrote:
 Mojca Miklavec wrote:
  On 8/21/07, David Wooten wrote:
  Greetings all,
 
  Has anyone had any luck getting the lilypond module to work with mkiv/
  luatex engine? It fails for me (works fine with mkii/pdftex). I can
  send along some log info if others have found it to work.
 
  Hans has mentioned several times that buffers are not going to be
  written to files with luaTeX any more. This has a weird consequence on
  many modules which relied exactly on that trick.
 
  Short example of what goes wrong:
 
  \starttext
 
  \startbuffer[a]
  Hello world!
  \stopbuffer
  \typebuffer[a]
 
  %\executesystemcommand{dosomethingwith \jobname-a.tmp}
  \stoptext
 
  The problem is that MK II created a file \jobname-a.tmp and lilypond
  module processed exactly that file further. In MK IV, that file is not
  created any more (you can check that by running the above example with
  --lua first and then with pdfTeX again. Only in the second case a file
  [whateverthefilename]-a.tmp is created.)
 
  Lilypond module relied on that feature (I would rather call it
  dirty-but-very-useful-trick).
 
  Hans, what's the current general recipe for this kind of [mis]use of 
  buffers?

 I'll add savebuffer to core-buf.*

Thanks a lot for that one!

 % engine=luatex

 \startluacode
  if not buffers.save then
  function buffers.save(name)
  if not name or name ==  then
  name = tex.jobname
  end
  local b, f = buffers.data[name],
 string.format(%s-%s.tmp,tex.jobname,name)
  b = (b and type(b) == table and table.join(b)) or b or 
  io.savedata(f,b)
  end
  end
 \stopluacode

 \def\savebuffer{\dosingleempty\dosavebuffer}

 \def\dosavebuffer[#1]{\ctxlua{buffers.save(#1)}}

 \starttext

 \startbuffer[oeps]
 oeps
 \stopbuffer

 \startbuffer
 oepsoeps
 \stopbuffer

 \savebuffer[oeps] \savebuffer

 \stoptext

I now tried to add the following three lines to t-lilypond.tex:

\def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf 
\lily!filename.eps}
\beginLUATEX
\savebuffer[lilypond-\the\lily!figures]%
\endLUATEX
\ifeof18
\installprogram{\LP}%
etc.

But luaTeX now reports the following to console:

system (LUATEX) : [line 32] \savebuffer [lilypond-\the \lily!figures
]\endLUATEX \ifeof 18 \installprogram {\LP }\doif \jobsuffix
{pdf}{\installprogram {\PDF }}\else \executesystemcommand {\LP }\doif
\jobsuffix {pdf}{\executesystemcommand {\PDF }}\fi \doifelse
\jobsuffix {pdf} {\edef \lily!img {\lily!filename .pdf}}{\edef
\lily!img {\lily!filename .eps}}\ifvmode \getfiguredimensions
[\lily!filename .pdf]\leavevmode \newdimen \FigWidth \FigWidth
=\figurewidth \ifdim \FigWidth \localhsize \!!dimena =\localhsize
\advance \!!dimena by-\FigWidth \noindent \hskip \!!dimena \fi \fi
\externalfigure [\lily!img ]\egroup

and then

systems : end file li at line 34
 )
(\end occurred inside a group at level 1)

### simple group (level 1) entered at line 32 ({)
### bottom level
...
No pages of output.
Transcript written on li.log.


It seems like a problem with grouping, but I have no idea how to
prevent luaTeX from parsing the input further from what it's supposed
to read.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] buffers

2006-08-08 Thread Hans Hagen
Aditya Mahajan wrote:
 Hans, was this fixed. There is a typo in core-buf.tex and it is still 
 present in latest updateable version (2006.08.02).
   
ok done 

Hans 

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

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


Re: [NTG-context] buffers

2006-08-07 Thread Aditya Mahajan
On Mon, 31 Jul 2006, Aditya Mahajan wrote:

 On Mon, 31 Jul 2006, Hans van der Meer wrote:

 The ConTeXt manual tells me on page 237:

  You can define your own buffer with:
  \definebuffer[...]
  ... name
  After this command /getbuffer and \typebuffer are available where
 buffer is the name of the buffer.

 I do:
  \definebuffer[left]
  \startbuffer[left]
  left\crlf
  \stopbuffer
  \typeleft
 and it gives me the error:
  ! Undefined control sequence.
 \typeleft -\dodotypebuffer
   [left][def-3]
 l.92 \typeleft

 then I try:
  \typebuffer[left]

 this gives a typeset message [file examdoc-def-2.tmp does not exist]
 (file examdoc.tex being the containing tex file)

 when I try
  \getbuffer[left] or \getleft
 nothing at all seems to happen?

 Why doesn't it work according to the manual?
 Or do I misunderstand the manual completely?

 If you just want to tag buffers, you do not need to define new ones.
 You can simply do

 \startbuffer[test]
 Hello world
 \stopbuffer

 \typebuffer[test]

 \getbuffer[test]


 Defining new buffers is useful if you do not want to call buffers by
 some other name. This does not allow you to tag the buffers. There
 is also a bug in core-buf.tex due to which \typebuffer did not work.

 \unprotect
 \def\dodefinebuffer[#1][#2]%
   {\iffirstargument % else problems
  \doglobal\increment\nofdefinedbuffers
  \letvalue{\??bu#1\c!number}\nofdefinedbuffers
  \letvalue{\??bu#1\c!paragraph}\v!no
  \setevalue{\e!start#1}%

 {\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
  \setevalue{\e!get#1}%
{\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}%
  \setevalue{\e!type#1}%
{\noexpand\dotypebuffer[#1][def-\nofdefinedbuffers]}%
% TYPO: was
% {\noexpand\dodotypebuffer[#1][def-\nofdefinedbuffers]}%
  \getparameters[\??bu#1][#2]%
\fi}
 \protect

Hans, was this fixed. There is a typo in core-buf.tex and it is still 
present in latest updateable version (2006.08.02).

Aditya


 \definebuffer[Example]

 \startExample
   Hello again
 \stopExample

 \typeExample %The above fix is needed for this.

 \getExample
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] buffers

2006-08-01 Thread Hans van der Meer

On Aug 1, 2006, at 0:21, Aditya Mahajan wrote:

 On Mon, 31 Jul 2006, Hans van der Meer wrote:

 The ConTeXt manual tells me on page 237:

  You can define your own buffer with:
  \definebuffer[...]
  ... name
  After this command /getbuffer and \typebuffer are available where
 buffer is the name of the buffer.


 If you just want to tag buffers, you do not need to define new ones.
 You can simply do

 \startbuffer[test]
 Hello world
 \stopbuffer

 \typebuffer[test]

 \getbuffer[test]


Thanks, that solved it.

Hans van der Meer



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


[NTG-context] buffers

2006-07-31 Thread Hans van der Meer
The ConTeXt manual tells me on page 237:	You can define your own buffer with:	\definebuffer[...]	... name	After this command /getbuffer and \typebuffer are available where buffer is the name of the buffer.I do:	\definebuffer[left]	\startbuffer[left]	left\crlf	\stopbuffer	\typeleftand it gives me the error:	! Undefined control sequence.\typeleft -\dodotypebuffer                             [left][def-3]l.92 \typeleftthen I try:	\typebuffer[left]this gives a typeset message [file examdoc-def-2.tmp does not exist](file examdoc.tex being the containing tex file)when I try	\getbuffer[left] or \getleftnothing at all seems to happen?Why doesn't it work according to the manual? Or do I misunderstand the manual completely?Hans van der Meer ___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] buffers

2006-07-31 Thread Aditya Mahajan
On Mon, 31 Jul 2006, Hans van der Meer wrote:

 The ConTeXt manual tells me on page 237:

   You can define your own buffer with:
   \definebuffer[...]
   ... name
   After this command /getbuffer and \typebuffer are available where 
 buffer is the name of the buffer.

 I do:
   \definebuffer[left]
   \startbuffer[left]
   left\crlf
   \stopbuffer
   \typeleft
 and it gives me the error:
   ! Undefined control sequence.
 \typeleft -\dodotypebuffer
   [left][def-3]
 l.92 \typeleft

 then I try:
   \typebuffer[left]

 this gives a typeset message [file examdoc-def-2.tmp does not exist]
 (file examdoc.tex being the containing tex file)

 when I try
   \getbuffer[left] or \getleft
 nothing at all seems to happen?

 Why doesn't it work according to the manual?
 Or do I misunderstand the manual completely?

If you just want to tag buffers, you do not need to define new ones. 
You can simply do

\startbuffer[test]
Hello world
\stopbuffer

\typebuffer[test]

\getbuffer[test]


Defining new buffers is useful if you do not want to call buffers by 
some other name. This does not allow you to tag the buffers. There 
is also a bug in core-buf.tex due to which \typebuffer did not work.

\unprotect
\def\dodefinebuffer[#1][#2]%
   {\iffirstargument % else problems
  \doglobal\increment\nofdefinedbuffers
  \letvalue{\??bu#1\c!number}\nofdefinedbuffers
  \letvalue{\??bu#1\c!paragraph}\v!no
  \setevalue{\e!start#1}%

{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
  \setevalue{\e!get#1}%
{\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}%
  \setevalue{\e!type#1}%
{\noexpand\dotypebuffer[#1][def-\nofdefinedbuffers]}%
% was {\noexpand\dodotypebuffer[#1][def-\nofdefinedbuffers]}%
  \getparameters[\??bu#1][#2]%
\fi}
\protect


\definebuffer[Example]

\startExample
   Hello again
\stopExample

\typeExample %The above fix is needed for this.

\getExample


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


[NTG-context] buffers and mathml

2005-06-02 Thread jimarin
Hi all,

I hope not to be posing a silly question.

I am trying something like:

usemodule[mathml]
\starttext

\def\open
{}

\def\close
{}

\startbuffer
\open math display=block\close
\open apply\close \open sin/\close \open apply\close \open plus/\close
\open cn\close 2 \open /cn\close \open ci\close a \open /ci\close
\open /apply\close \open /apply\close
\open /math\close
\stopbuffer

\processXMLbuffer

\stoptext

But this does not pass to \processXMLbuffer the result of substituting
commands \open and \close...

how could this be achieved...?

I know that I could have used myself the  and 's instead of the ugly open
and close but that is not my requirement.

I tried defining a command

\def\Wea
{
\open math display=block\close
\open apply\close \open sin/\close \open apply\close \open plus/\close
\open cn\close 2 \open /cn\close \open ci\close a \open /ci\close
\open /apply\close \open /apply\close
\open /math\close
}

and then...

\startbuffer
\Wea
\stopbuffer

but that is plain wrong...



thanks

jima
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 2004/11/01

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