Re: [NTG-context] \typebuffer with typing style

2009-06-10 Thread Matthijs Kooijman
Hi Peter,

 \setuptyping[option=TEX]

This is what I am using now, but this changes the global settings and requires
resetting them afterwards. Not so pretty. I was hoping for a better method to
achieve this, but I'm starting to doubt there is one currently.

I've been trying to give \typebuffer a second argument with options or a
typing style, but I haven't been so succesful so far...


However, from looking at the definition of \dotypebuffer makes me wonder a bit
if my understanding of TeX macros is faulty, or the code is weird:

\def\dotypebuffer[#1][#2]%
  {\iffirstargument
 \dobuffer{17}{#1}\dotypefilebuffer
   \else
 \dobuffer{17}{#2}\dotypefilebuffer
   \fi}

What I see here is the there is an argument 17 passed, which is not used by
\dobuffer at all. Also, why is this 17 ? Secondly, there is a use of #2 in
this definition, but only when there is no first argument (and thus, no second
argument either). Is this a leftover that could be replaced with {}, or am I
missing something?

Gr.

Matthijs


signature.asc
Description: Digital signature
___
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] \typebuffer with typing style

2009-06-10 Thread Peter Münster
On Wed, 10 Jun 2009, Matthijs Kooijman wrote:

  \setuptyping[option=TEX]
 
 This is what I am using now, but this changes the global settings and requires
 resetting them afterwards. Not so pretty. I was hoping for a better method to
 achieve this, but I'm starting to doubt there is one currently.

2 ideas:

- With \setuptyping[file][option=TEX] the global setting is only for
  \typefile or \typebuffer.
- Use grouping, for example:
  \def\myTypeBuffer#1{\bgroup \setuptyping[...] \typebuffer[#1] \egroup}

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/

___
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] \typebuffer with typing style

2009-06-09 Thread Matthijs Kooijman
Hi all,

 Snip question about styled \typebuffer

Shortly after sending my email, I realized the actual problem I was trying to
solve was not the one I posted, so perhaps I can clarify that a bit.

What I'm trying to do, is pass some text to a custom command, which should
then be displayed in a custom typing style. It seems I can pass some text to a
command fine, even multiple lines:

  \define[1]\test{Lines: #1}

  \test{
One line
Two lines
Three lines
  }

However, this will obviously not give me any typing style at all, just a
single line with all the words after eachother. I can't just use \starttyping
(or \startFOO, which was the actual goal of all this) inside a \define, since
that gives me:

  File ended while scanning use of \dododowithbuffer.

So, this made me look at using buffers, since I can pass in an entire buffer
and use \typebuffer to get it in a typing style. However, as mentioned before
I can't seem to be able to pass an actual style to \typebuffer (one defined
with \definetyping).

The only way I've found just now, is to use \setuptyping. However, that takes
effect for the rest of the document, so I have to reset the settings to their
defaults afterwards, destroying any custom settings that could have been set.
I can't seem to find a way to push the typing settings or save them somehow,
so this is not quite a perfect solution...

Any other suggestions?

Gr.

Matthijs


signature.asc
Description: Digital signature
___
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] \typebuffer with typing style

2009-06-09 Thread Peter Münster
On Mon, 8 Jun 2009, Matthijs Kooijman wrote:

 \definetyping[FOO][option=FOO]
 
 \startbuffer[bar]
 baz
 \stopbuffer
 
 \typebuffer[FOO][bar]

Perhaps you are looking for this:

\setuptyping[option=TEX]
\starttext
\startbuffer[bar]
This is \ConTeXt.
\stopbuffer
\typebuffer[bar]
\stoptext

?

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/

___
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] \typebuffer with typing style

2009-06-08 Thread Matthijs Kooijman
Hi,

I'm trying to use a buffer together with a custom typing style using the
latest beta with MkIV, but so far I've only managed to do this using \startFOO
and \stopFOO inside the buffer:

\definetyping[FOO][option=FOO]

\startbuffer[bar]
\startFOO
baz
\stopFOO
\stopbuffer

\getbuffer[bar]


Since the \getbuffer is really inside some self-defined command, I'd like to
put the startFOO / stopFOO in there as well. However, I can't seem to find a
way to do this, since \startFOO \getbuffer[bar] \stopFOO gives me compile
errors. It seems the canonical way to define typing and buffers is using
\typebuffer, but that only seems to work with the default typing style. I'd
like to do the following:

\definetyping[FOO][option=FOO]

\startbuffer[bar]
baz
\stopbuffer

\typebuffer[FOO][bar]

From looking at buff-ini.mkiv it seems typebuffer has some code to handle a
second argument, but it seems to always throw it away (as far as I can
understand this Tex stuff... :-).

Is there some way to achieve this? Would it be good to make \typebuffer
support this if there isn't?

Gr.

Matthijs


signature.asc
Description: Digital signature
___
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] \typebuffer with typing style

2009-06-08 Thread Matthijs Kooijman
Hi all,

  since \startFOO \getbuffer[bar] \stopFOO gives me compile errors. 
Actually, that turned out to be my own typo. However, this doesn't give me
what I want, but just a verbatim \getbuffer[bar]...

Gr.

Matthijs


signature.asc
Description: Digital signature
___
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
___