ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \typebuffer with typing style
@ 2009-06-08 16:20 Matthijs Kooijman
  2009-06-08 17:20 ` Matthijs Kooijman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthijs Kooijman @ 2009-06-08 16:20 UTC (permalink / raw)
  To: ntg-context


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

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

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

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

* Re: \typebuffer with typing style
  2009-06-08 16:20 \typebuffer with typing style Matthijs Kooijman
@ 2009-06-08 17:20 ` Matthijs Kooijman
  2009-06-09 16:28 ` Matthijs Kooijman
  2009-06-09 17:11 ` Peter Münster
  2 siblings, 0 replies; 6+ messages in thread
From: Matthijs Kooijman @ 2009-06-08 17:20 UTC (permalink / raw)
  To: ntg-context


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

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

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

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

* Re: \typebuffer with typing style
  2009-06-08 16:20 \typebuffer with typing style Matthijs Kooijman
  2009-06-08 17:20 ` Matthijs Kooijman
@ 2009-06-09 16:28 ` Matthijs Kooijman
  2009-06-09 17:11 ` Peter Münster
  2 siblings, 0 replies; 6+ messages in thread
From: Matthijs Kooijman @ 2009-06-09 16:28 UTC (permalink / raw)
  To: ntg-context


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

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

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

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

* Re: \typebuffer with typing style
  2009-06-08 16:20 \typebuffer with typing style Matthijs Kooijman
  2009-06-08 17:20 ` Matthijs Kooijman
  2009-06-09 16:28 ` Matthijs Kooijman
@ 2009-06-09 17:11 ` Peter Münster
  2009-06-10 13:52   ` Matthijs Kooijman
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Münster @ 2009-06-09 17:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


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

* Re: \typebuffer with typing style
  2009-06-09 17:11 ` Peter Münster
@ 2009-06-10 13:52   ` Matthijs Kooijman
  2009-06-10 15:53     ` Peter Münster
  0 siblings, 1 reply; 6+ messages in thread
From: Matthijs Kooijman @ 2009-06-10 13:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

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

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

* Re: \typebuffer with typing style
  2009-06-10 13:52   ` Matthijs Kooijman
@ 2009-06-10 15:53     ` Peter Münster
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Münster @ 2009-06-10 15:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


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

end of thread, other threads:[~2009-06-10 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08 16:20 \typebuffer with typing style Matthijs Kooijman
2009-06-08 17:20 ` Matthijs Kooijman
2009-06-09 16:28 ` Matthijs Kooijman
2009-06-09 17:11 ` Peter Münster
2009-06-10 13:52   ` Matthijs Kooijman
2009-06-10 15:53     ` Peter Münster

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