Re: [NTG-context] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Uff, this is indeed deep tex. Thanks a lot for the example, Hans! I still need 
to learn a lot.

After a walk and a bit of fresh air, I found another (much easier) way around 
my problem. This works since I don't need to deal with #2 in any special way:

\tolerant\def\startMyCommand[#1]%
{
\startallbeautifulcontextcommands
% whatever #1 does
}

\tolerant\def\stopMyCommand%
{
\stopallbeautifulcontextcommands
}

Then one can do in the main files:

\startMyCommand

\beginMyBuffer
bla bla
\endMyBuffer

\stopMycommand

> On Jan 2, 2022, at 14:43, Hans Hagen  wrote:
> 
> On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:
>> Thanks, Hans, for the answer, but I'm not sure if I get the point.
>> While this is possible in ConTeXt:
>> \startsection[title={My Title}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopsection
>> The following won't work (end of file error):
>> \startMyCommand[optional={Maybe}]
>> \beginMyBlock
>> bla bla
>> \endMyBlock
>> \stopMyCommand
>> I had hoped for a simple command/modifier like 
>> \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work 
>> in a similar way.
>> But maybe, as Wolfgang stated here 
>> (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
>> blocks can't be used in commands. (To add: Even when passed as arguments 
>> during compilation?)
> 
> You can bet that WS is right.
> 
> You really have to go dirty tex for this kind of magic:
> 
> \defineblock[MyBlock]
> \keepblocks[MyBlock]
> 
> \starttext
> 
> \tolerant\def\startMyCommand[#1]%
>  {\begingroup
>   \setcatcodetable\notcatcodes
>   \dostartMyCommand[#1]}
> 
> \let\stopMyCommand\relax
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92
>  stopMyCommand}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> or
> 
> \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes 
> {\stopMyCommand}}%
>  {\endgroup
>   % whatever #1 does
>   \setbuffer[foo]#2\endbuffer
>   \typebuffer[foo]
>   \getbuffer[foo]}
> 
> \startMyCommand[optional={Maybe}]
> 
> \beginMyBlock
> bla bla
> \endMyBlock
> 
> \stopMyCommand
> 
> \stoptext
> 
> and then of course further nesting mess ...
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Hans Hagen via ntg-context

On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:

Thanks, Hans, for the answer, but I'm not sure if I get the point.

While this is possible in ConTeXt:

\startsection[title={My Title}]

\beginMyBlock
bla bla
\endMyBlock

\stopsection

The following won't work (end of file error):

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

I had hoped for a simple command/modifier like 
\pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand  to have #2 work in 
a similar way.

But maybe, as Wolfgang stated here 
(https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
blocks can't be used in commands. (To add: Even when passed as arguments during 
compilation?)


You can bet that WS is right.

You really have to go dirty tex for this kind of magic:

\defineblock[MyBlock]
\keepblocks[MyBlock]

\starttext

\tolerant\def\startMyCommand[#1]%
  {\begingroup
   \setcatcodetable\notcatcodes
   \dostartMyCommand[#1]}

\let\stopMyCommand\relax

\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92 
stopMyCommand}%

  {\endgroup
   % whatever #1 does
   \setbuffer[foo]#2\endbuffer
   \typebuffer[foo]
   \getbuffer[foo]}

or

\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes 
{\stopMyCommand}}%

  {\endgroup
   % whatever #1 does
   \setbuffer[foo]#2\endbuffer
   \typebuffer[foo]
   \getbuffer[foo]}

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

\stoptext

and then of course further nesting mess ...

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Benjamin Buchmuller via ntg-context
Thanks, Hans, for the answer, but I'm not sure if I get the point.

While this is possible in ConTeXt:

\startsection[title={My Title}]

\beginMyBlock
bla bla
\endMyBlock

\stopsection

The following won't work (end of file error):

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

I had hoped for a simple command/modifier like 
\pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand  to have #2 work in 
a similar way. 

But maybe, as Wolfgang stated here 
(https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and 
blocks can't be used in commands. (To add: Even when passed as arguments during 
compilation?)

Many Thanks again!


Benjamin

> On Jan 2, 2022, at 12:19, Hans Hagen  wrote:
> 
> On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:
>> Hi list,
>> I'm playing around with blocks and buffers again, realizing that I cannot 
>> use them inbetween a \start...\stop that I defined myself. Apparently, they 
>> work between \startsection...\stopsection and the like, so I was wondering 
>> how I should define or expand #2 in the MWE below to make TeX happily accept 
>> these useful features?
> buffers are stored as-is so no catcode magic stored, contrary to macros
> 
> you can use \setbuffer but that doesn't solve the argument passing
> 
> however, you can nest buffers so you can make other \start\stop commands 
> buffers too and then do some at the start and (look for \defiebuffer) but it 
> quickly becomes messy i think
> 
> Hans
> 
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to make \def accept block or buffer as part of (long) command argument

2022-01-02 Thread Hans Hagen via ntg-context

On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:

Hi list,

I'm playing around with blocks and buffers again, realizing that I cannot use 
them inbetween a \start...\stop that I defined myself. Apparently, they work 
between \startsection...\stopsection and the like, so I was wondering how I 
should define or expand #2 in the MWE below to make TeX happily accept these 
useful features?

buffers are stored as-is so no catcode magic stored, contrary to macros

you can use \setbuffer but that doesn't solve the argument passing

however, you can nest buffers so you can make other \start\stop commands 
buffers too and then do some at the start and (look for \defiebuffer) 
but it quickly becomes messy i think


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] LMTX deeptextcommand issue

2019-04-02 Thread Hans Hagen

On 4/2/2019 8:41 PM, Jan Tosovsky wrote:

Dear All,

my document ends with the index

\startbackmatter
\chapter{Rejstřík jmenný}
\start
\switchtobodyfont[8pt]
\placeindexname
\stop
\stopbackmatter
\startbackmatter
\chapter{Rejstřík věcný}
\start
\switchtobodyfont[8pt]
\placeindexsubject
\stop
\stopbackmatter

At the beginning there is a condition for one word (kind of manual column
balancing) - but according to the log, see below, this seems to be an issue:
\newconditional\IndexState
\define[1]\IndexInternalCommand
  
{\doifelse{#1}{Dolsko}{\global\settrue\IndexState}{\global\setfalse\IndexSta

te}#1}

\define[1]\IndexCommand
   {\setfalse\IndexState
\setbox\scratchbox\hbox{#1}%
\ifconditional\IndexState
  \column
\fi
\box\nextbox}


does

\unexpanded\def\IndexCommand#1%
  {

work?


\defineregister[indexname][indexnames]
\setupregister[indexname][command=\Word, textcommand=\IndexCommand,
deeptextcommand=\IndexInternalCommand]

\defineregister[indexsubject][indexsubjects]
\setupregister[indexsubject][command=\Word]
\setupheadtext[indexname=Rejstřík jmenný]
\setupheadtext[indexsubject=Rejstřík věcný]


This worked in luatex 1.0.1, but in LMTX I am getting:

structures  > begin of sectionblock 'backpart'
structure   > sectioning > chapter @ level 2 : 0.1 -> Rejstřík jmenný
fonts   > defining > font 'palab', feature 'locl', script 'latn', no
language 'dflt'

tex error   > tex error on line 25 in file
D:/context-lmtx/tex/texmf-context/tex/context/base/mkiv/page-run.mkiv: ?

 [internal expandable lua function call]

\IndexInternalCommand ...\setfalse \IndexState }#1
   
\IndexCommand ...ate \setbox \scratchbox \hbox {#1

   }\ifconditional
\IndexStat...
\doapplyregisterentrycommand ...extcommand {#2
   \dostoptagged
\registerentry ...plyregisterentrycommand {#2}{#5}
   \fi \else \let
\currentreg...
l.25 }
 
...l.11633 \stop



15
16 \registerctxluafile{page-run}{}
17
18 \unprotect
19
20 \unexpanded\gdef\showprint{\dotripleempty\page_layouts_show_print}
21
22 \gdef\page_layouts_show_print[#1][#2][#3]% only english
23   {\setbuffer[crap]%
24   \unprotect
25 >>  \definepapersize[X][\c!width=4em, \c!height=6em]
26 \definepapersize[Y][\c!width=12em,\c!height=14em]
27 \setuppapersize[X,#1][Y,#2]
28 \setuplayout[#3]
29 \setuplayout[\v!page]
30 \framed
31   [\c!offset=\v!overlay,\c!strut=\v!no,
32\c!width=\paperwidth,\c!height=\paperheight]
33   {\ss ABC\par DEF}%
34   \protect
35\endbuffer


When I've seen that 'crap' and weird page dimensions, I thought it is part
of the April fool, like all that LMTX announcement.

This issue is not urgent, I was just curious how different the output is.

Thanks,

Jan

___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] LMTX deeptextcommand issue

2019-04-02 Thread Jan Tosovsky
Dear All,

my document ends with the index

\startbackmatter
\chapter{Rejstřík jmenný}
\start
\switchtobodyfont[8pt]
\placeindexname
\stop
\stopbackmatter
\startbackmatter
\chapter{Rejstřík věcný}
\start
\switchtobodyfont[8pt]
\placeindexsubject
\stop
\stopbackmatter

At the beginning there is a condition for one word (kind of manual column
balancing) - but according to the log, see below, this seems to be an issue:
\newconditional\IndexState
\define[1]\IndexInternalCommand
 
{\doifelse{#1}{Dolsko}{\global\settrue\IndexState}{\global\setfalse\IndexSta
te}#1}

\define[1]\IndexCommand
  {\setfalse\IndexState
   \setbox\scratchbox\hbox{#1}%
   \ifconditional\IndexState
 \column
   \fi
   \box\nextbox}

\defineregister[indexname][indexnames]
\setupregister[indexname][command=\Word, textcommand=\IndexCommand,
deeptextcommand=\IndexInternalCommand]

\defineregister[indexsubject][indexsubjects]
\setupregister[indexsubject][command=\Word]
\setupheadtext[indexname=Rejstřík jmenný]
\setupheadtext[indexsubject=Rejstřík věcný]


This worked in luatex 1.0.1, but in LMTX I am getting:

structures  > begin of sectionblock 'backpart'
structure   > sectioning > chapter @ level 2 : 0.1 -> Rejstřík jmenný
fonts   > defining > font 'palab', feature 'locl', script 'latn', no
language 'dflt'

tex error   > tex error on line 25 in file
D:/context-lmtx/tex/texmf-context/tex/context/base/mkiv/page-run.mkiv: ?

 [internal expandable lua function call]
   
\IndexInternalCommand ...\setfalse \IndexState }#1
  
\IndexCommand ...ate \setbox \scratchbox \hbox {#1
  }\ifconditional
\IndexStat...
\doapplyregisterentrycommand ...extcommand {#2
  \dostoptagged 
\registerentry ...plyregisterentrycommand {#2}{#5}
  \fi \else \let
\currentreg...
l.25 }

...l.11633 \stop
   

15 
16 \registerctxluafile{page-run}{}
17 
18 \unprotect
19 
20 \unexpanded\gdef\showprint{\dotripleempty\page_layouts_show_print}
21 
22 \gdef\page_layouts_show_print[#1][#2][#3]% only english
23   {\setbuffer[crap]%
24   \unprotect
25 >>  \definepapersize[X][\c!width=4em, \c!height=6em]
26 \definepapersize[Y][\c!width=12em,\c!height=14em]
27 \setuppapersize[X,#1][Y,#2]
28 \setuplayout[#3]
29 \setuplayout[\v!page]
30 \framed
31   [\c!offset=\v!overlay,\c!strut=\v!no,
32\c!width=\paperwidth,\c!height=\paperheight]
33   {\ss ABC\par DEF}%
34   \protect
35\endbuffer


When I've seen that 'crap' and weird page dimensions, I thought it is part
of the April fool, like all that LMTX announcement.

This issue is not urgent, I was just curious how different the output is.

Thanks,

Jan

___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Buffer within a \def

2018-08-10 Thread Wolfgang Schuster



Procházka Lukáš Ing. schrieb am 10.08.18 um 13:31:

Hello,

I'm not very familiar with using buffers, so a basic question:

Is it possible to use buffers within a \def?


No.


The following sample doesn't compile:


\def\T{
  \startbuffer[Buf]
a b ccc
d e f
  \stopbuffer
  \getbuffer[Buf]
}


\def\T
  {\setbuffer[Buf]a b ccc d e f\endbuffer
   \getbuffer[Buf]}

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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] add to \setbuffer

2018-01-10 Thread Hans Hagen

On 1/10/2018 6:30 PM, Wolfgang Schuster wrote:



dr. Hans van der Meer <mailto:havdm...@ziggo.nl>
10. Januar 2018 um 13:45
With \setbuffer[ABUFFER] .. \endbuffer I can program a macro to put 
something in this buffer.
But is it possible to add something at the end of this buffer at a 
later moment?


You can use the “buffers.append” and “buffers.prepend” functions to add 
text to a buffer.


\starttext

\startbuffer[a]
First
\stopbuffer

\startbuffer[b]
Second
\stopbuffer

\startbuffer[c]
Third
\stopbuffer

\startluacode

buffers.append("b",buffers.getcontent("c"))

buffers.prepend("b",buffers.getcontent("a"))

\stopluacode

\getbuffer[b]

\stoptext

or just getbuffer[a,b,c]


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] add to \setbuffer

2018-01-10 Thread Wolfgang Schuster



dr. Hans van der Meer <mailto:havdm...@ziggo.nl>
10. Januar 2018 um 13:45
With \setbuffer[ABUFFER] .. \endbuffer I can program a macro to put 
something in this buffer.
But is it possible to add something at the end of this buffer at a 
later moment?


You can use the “buffers.append” and “buffers.prepend” functions to add 
text to a buffer.


\starttext

\startbuffer[a]
First
\stopbuffer

\startbuffer[b]
Second
\stopbuffer

\startbuffer[c]
Third
\stopbuffer

\startluacode

buffers.append("b",buffers.getcontent("c"))

buffers.prepend("b",buffers.getcontent("a"))

\stopluacode

\getbuffer[b]

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] add to \setbuffer

2018-01-10 Thread dr. Hans van der Meer
With \setbuffer[ABUFFER] .. \endbuffer I can program a macro to put something 
in this buffer.
But is it possible to add something at the end of this buffer at a later moment?

Hans van der Meer


___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] letters in context mkiv

2017-07-31 Thread r . ermers
Dear Contex’ers,This morning I have been experimenting with the solutions suggested by Thomas and Wolfgang.Thomas’ solution works, it produces two distinct letters, yet the address is probably on another layer. This means that it is not shifted to the right, at least not with the command (\setupletterlayer[address]), so that it will be visible through the envelope window.With Wolfgang’s solution the address is moved to its desired place, and the letter text is printed as well.However, inserting a text (by means of \input) is problematic (see pdf), with or without \relax.I then experimented with alternatives like \startbuffer[lettercontent] … endbuffer. The \input problem remains: it appears that the buffer takes any command (\foo) as literal text.I tried moving the setbuffer … endbuffer part to elswhere in the document. I also experimented with \input a sample text of my own on my harddisk. I tried deleting the \placeletter command - no difference.So, I feel I am close, but not yet there, one more step …Robert\usemodule[letter]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem      Mr. K. Hendriks  Grotestraat 5  1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen     Mr. P. Janssen Kortestraat 8 1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}\stopxmlsetups\xmlregistersetup{xml:setups}\setuplettersection[content][alternative=setups]\startsetups[letter:layer:address]    \correspondenceparameter{toname}\\    \correspondenceparameter{toaddress}\stopsetups\setuplettertext[en][date=]\setuplettertext[nl][date=]\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\setupletterlayer  [address]  [alternative=setups,   y=6cm,   x=12cm,   color=red,   style=\ss\tfa]\startsetups[letter:section:content]    \getbuffer[lettercontent]\stopsetups%\startbuffer[lettercontent]%content of the letter \xmltext{#1}{/city}%\input knuth \relax%\stopbuffer\startxmlsetups xml:contact    \setupletter  [toaddress={\xmlall{#1}{/address/p}\par  \xmltext{#1}{/kix}}, opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},}, closing={Kind regards,}, subject={subject: your life in \xmltext{#1}{/city}},   signature={Herman}]\setbuffer[lettercontent]%This is the content of the letter.\input knuth \relax\endbuffer\placeletter\stopxmlsetups\setuppagenumbering [state=stop]\starttext\xmlprocessbuffer{main}{participants}{}\stoptext

brieven2mkiv3.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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Jaroslav Hajtmar
Hello Adytia.
It seems now, that everything at this time works as intended. Many thanks for 
your support. Below is a minimal example. Attached is a PDF sample result.
I tried also to experiment with the choice "object = no", as suggested by Hans, 
but without success. I would asking  if you make any changes in filter module?
Or have I misunderstood Your opinion? 
Thank you once again
Jaroslav Hajtmar


Here is minimal example:

\usemodule[filter]

\unprotect
\appendtoks
   \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
   {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options

\begingroup
\edef\currentexternalfilter{#1}

\setupexternalfilter[#1][\c!name=,#2]

\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer

\externalfilter@process_filter
  \stoptexdefinition
\protect

\defineexternalfilter
   [ASY]
   [
 filtercommand={asy -tex context \externalfilterinputfile\space -o 
\externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
 purge=no, 
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
\setASYbuffer{
import graph;
draw(Circle((0,0),#1));
}}


\starttext

\startASY
 import graph;
 draw((0,0)--(100,100));
\stopASY

\mycircle{10}

\mycircle{20}

\mycircle{30}

\stoptext







Dne 23.12.16 20:22, ntg-context za uživatele Aditya Mahajan 
<ntg-context-boun...@ntg.nl za uživatele adit...@umich.edu> napsal(a):

On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:

> Thanks for sending Your code. It seems that it works with Asymptote. 
> Unfortunately, when I am trying to multiple call a macro then I get 
> fatal error, and then compile collapse. I do not know what it could be.

When called for the first time, the code generates test-ASY.pdf file and 
includes it. After the second call, a new test-ASY.pdf is generated. 
ConTeXt generates an error because the name of the files is the same, but 
the content is not.

There should be an option for \externalfigure to disable this check, but I 
couldn't find it. Here is an alternative approach, that changes the name 
of the PDF.

\usemodule[filter]

\unprotect
\appendtoks
   \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
   {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options

\begingroup
\edef\currentexternalfilter{#1}

\setupexternalfilter[#1][\c!name=,#2]

\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer

\externalfilter@process_filter
  \stoptexdefinition
\protect

\defineexternalfilter
 [MARKDOWN]
 [
   filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
   cache=yes,
   purge=no,
 ]

\define[1]\NEW
 {\setMARKDOWNbuffer{This is #1}}

\traceexternalfilters

\starttext
\startMARKDOWN
   This is **one**
\stopMARKDOWN

\NEW{**ONE**}

\NEW{_TWO_}
\stoptext

Note that this has the same limitation as using \type{...}. The contents of
\NEW{...} must have matched braces. If this works, I can include the code in
t-filter (mkiv only, as I no longer want to maintain the mkii branch).

Aditya

___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net

___



AsymptoteCodeInConTeXt03a-Adytia.pdf
Description: AsymptoteCodeInConTeXt03a-Adytia.pdf
___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Aditya Mahajan

On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:

Thanks for sending Your code. It seems that it works with Asymptote. 
Unfortunately, when I am trying to multiple call a macro then I get 
fatal error, and then compile collapse. I do not know what it could be.


When called for the first time, the code generates test-ASY.pdf file and 
includes it. After the second call, a new test-ASY.pdf is generated. 
ConTeXt generates an error because the name of the files is the same, but 
the content is not.


There should be an option for \externalfigure to disable this check, but I 
couldn't find it. Here is an alternative approach, that changes the name 
of the PDF.


\usemodule[filter]

\unprotect
\appendtoks
  \setuevalue{set\currentexternalfilter 
buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter

\unexpanded\def\externalfilter@set
  {\dodoubleargument\externalfiter@set_indeed}

\starttexdefinition externalfiter@set_indeed [#1][#2]#3
   % #1 = filter
   % #2 = options

   \begingroup
   \edef\currentexternalfilter{#1}

   \setupexternalfilter[#1][\c!name=,#2]

   \externalfilter@set_filenames
   \setbuffer[\externalfilter@buffer_name]#3\endbuffer

   \externalfilter@process_filter
 \stoptexdefinition
\protect

\defineexternalfilter
[MARKDOWN]
[
  filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
  cache=yes,
  purge=no,
]

\define[1]\NEW
{\setMARKDOWNbuffer{This is #1}}

\traceexternalfilters

\starttext
\startMARKDOWN
  This is **one**
\stopMARKDOWN

\NEW{**ONE**}

\NEW{_TWO_}
\stoptext

Note that this has the same limitation as using \type{...}. The contents of
\NEW{...} must have matched braces. If this works, I can include the code in
t-filter (mkiv only, as I no longer want to maintain the mkii branch).

Aditya
___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Asymptote or Metapost and ConTeXt parameters.

2016-12-23 Thread Jaroslav Hajtmar
Hello Adytia.
Thanks for sending Your code. It seems that it works with Asymptote. 
Unfortunately, when I am trying to multiple call a macro then I get fatal 
error, and then compile collapse. I do not know what it could be. Is it 
possible that my code is wrong. But it is possible that there is a stack 
overflow etc. It would be a need to look at why the fatal error occurs - It 
probably can evaluate Hans. Thanks again for your support. Below is my code. If 
removed commentary characters occurs advised error.

Jaroslav Hajtmar


\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
 filtercommand={asy -tex context \externalfilterinputfile\space -o 
\externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
 purge=no, 
 cache=yes,
 readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
#1 - XXX
\setbuffer[ASY]
import graph;
draw(Circle((0,0),#1));
\endbuffer
\processASYbuffer[ASY]
}

\starttext
AAA
\startASY
import graph;
draw((0,0)--(100,100));
\stopASY

BBB
\mycircle{100}


%CCC
%\mycircle{50}

%DDD
%\mycircle{200}

\stoptext





Dne 22.12.16 5:49, ntg-context za uživatele Aditya Mahajan 
<ntg-context-boun...@ntg.nl za uživatele adit...@umich.edu> napsal(a):

On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote:

> very much for your Metapost example. This I certainly sufficient for the 
> production of simple images for my ideas.

> \define[1]\mycircle{
>   \startASY
>   import graph;
>   draw(Circle((0,0),#1));
>   \stopASY
> }
>
> \starttext
> \mycircle{20}
> \mycircle{30}
> \mycircle{40}
> \stoptext

It is already feasible to define something this simple using the filter 
module. I don't have asymptote installed on the machine that I am 
currently working on, but here is an example that uses pandoc.

\usemodule[filter]

\defineexternalfilter
 [MARKDOWN]
 [
   filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
   cache=yes,
   purge=no, % Just for testing. May be removed.
 ]

\define[1]\TEST
 {\setbuffer[MARKDOWN]This is #1\endbuffer
  \processMARKDOWNbuffer[MARKDOWN]}

\starttext
\startMARKDOWN
   This is **one**
\stopMARKDOWN

\TEST{**ONE**}

\TEST{_TWO_}
\stoptext

With this method, the results are not cached. Let me know if this works 
for your needs.

Aditya

___
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  : https://bitbucket.org/phg/context-mirror/commits/
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Asymptote or Metapost and ConTeXt parameters.

2016-12-21 Thread Aditya Mahajan

On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote:

very much for your Metapost example. This I certainly sufficient for the 
production of simple images for my ideas.



\define[1]\mycircle{
\startASY
import graph;
draw(Circle((0,0),#1));
\stopASY
}

\starttext
\mycircle{20}
\mycircle{30}
\mycircle{40}
\stoptext


It is already feasible to define something this simple using the filter 
module. I don't have asymptote installed on the machine that I am 
currently working on, but here is an example that uses pandoc.


\usemodule[filter]

\defineexternalfilter
[MARKDOWN]
[
  filtercommand={pandoc -f markdown -t context 
\externalfilterinputfile\space -o \externalfilteroutputfile},
  cache=yes,
  purge=no, % Just for testing. May be removed.
]

\define[1]\TEST
{\setbuffer[MARKDOWN]This is #1\endbuffer
 \processMARKDOWNbuffer[MARKDOWN]}

\starttext
\startMARKDOWN
  This is **one**
\stopMARKDOWN

\TEST{**ONE**}

\TEST{_TWO_}
\stoptext

With this method, the results are not cached. Let me know if this works 
for your needs.


Aditya
___
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  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] buffering inside xmlsetups

2016-10-11 Thread Wolfgang Schuster

Meer, Hans van der <mailto:h.vanderm...@uva.nl>
11. Oktober 2016 um 14:43
A problem I am obviously not able to solve.
It can be described as follows.

I have an xmlsetup .. that typesets texcode embedded in an 
xml document. Now it is needed to embed initializing a buffer and 
typesetting lateron with \getbuffer. Alas, doing the following does 
not woek:


\startbuffer[name]
bufferdata
\stopbuffer

because the TeX input hangs. My guess being that the \stopbuffer fails 
to terminate the data intake.


I then tried to split off the buffer filling with a separate xmlsetup. 
But here too, the TeX input halts:


% Usage: 
\startxmlsetups xmlcommon:buffer
\startbuffer[name=\xmlatt{#1}{name}]
\xmlflush{#1}
\stopbuffer
\stopxmlsetups
% Usage: 
\startxmlsetups xmlcommon:getbuffer
\xmlflushcontext{\getbuffer[name=\xmlatt{#1}{name}]}
\stopxmlsetups

and as input: inputdata followed by .
The getbuffer setup is not even reached, as is obvious.

I tried \xmltofile to put the data into an intermediate file, but to 
no avail because it produces the following, leading at best to 
recursion when processed by \xmlprocessfile.





bufferdata


Is there a solution to this?

\setbuffer[]...\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://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] help on def & buffer

2016-03-30 Thread Erik Margraf
Ups, didn't expect that ...  ;-)
Thanks Wolfgang! Actually your version works, Hans' version does not ...
(could try them only now)

Kind regards
Erik

On Wed, Mar 30, 2016 at 2:46 PM, Wolfgang Schuster <
schuster.wolfg...@gmail.com> wrote:

> Hans Hagen <pra...@wxs.nl>
> 30. März 2016 um 10:11
>
>
> \startbuffer .. \stopbuffer is parsed special
>
> so use:
>
> \def\Buffer#1#2
>   {\setbuffer[#1]{\input #2\relax}}
>
> \def\Buffer#1#2%
>   {\setbuffer[#1]\input{#2}\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
>
> ___
>
___
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] help on def & buffer

2016-03-30 Thread Wolfgang Schuster

Hans Hagen <mailto:pra...@wxs.nl>
30. März 2016 um 10:11


\startbuffer .. \stopbuffer is parsed special

so use:

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

\def\Buffer#1#2%
  {\setbuffer[#1]\input{#2}\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] help on def & buffer

2016-03-30 Thread Erik Margraf
Than you Hans!
My plan is simply to use the output of a sagemath run in this way. A run
should produce
several files containing TeX code. I only wanted to shorten the
\startbuffer \input ... \stopbuffer
sequence. Maybe this (including sagemath output) could be done differently,
but this was
the first (and only ;-)) idea I came up with.

kind regards
Erik

On Wed, Mar 30, 2016 at 10:11 AM, Hans Hagen <pra...@wxs.nl> wrote:

> 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
> -
>
> ___
> 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
>
> ___
___
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] help on def & buffer

2016-03-30 Thread Hans Hagen

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
-
___
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] Reprocessing part of input

2016-02-02 Thread Hans Hagen

On 2/2/2016 4:28 PM, Meer, Hans van der wrote:

How to do the following eludes me.

Inside macro -processing read into a buffer the following part of the input
\startmyinput ...\stopmyinput


Analogous to input containing
\startbuffer[mystoragebuffer]
\startmyinput
 ...
\stopmyinput
\stopbuffer

but now not executed at once, but stored in and executable from a buffer with 
\getbuffer[mystoragebuffer].


\setbuffer[foo]bar\endbuffer


But of course there might be a better way to execute the same code more than 
once within one run of TeX.


for that to answer you need to give more info


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | 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] mathvariant bold NOT bold-italic

2013-06-16 Thread Steffen Wolfrum
Hi,

as far as I have understood MathML, elements tagged with mathvariant=bold 
should be set upright bold, not bold-italic.

Could this be corrected, please?

Thank you very much!
Steffen
---

\usemodule[mathml] \starttext

\placeformula\startformula[9pt]
\setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mi mathvariant=boldp/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
/mml:math\endbuffer{\processxmlbuffer}
\stopformula


___
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] mathml linebreak?

2013-06-09 Thread Steffen Wolfrum
Hi,

usually it is possible to break long formulas.

But is there a way to do so, when formula is coded in mathml (see example 
below)?

Thanks, Steffen

---

\placeformula\startformula[9pt]
\setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
msub xmlns=http://www.w3.org/1998/Math/MathML;
mrow
miC/mi
miE/mi
/mrow
mrow
miA/mi
/mrow
/msub
mo xmlns=http://www.w3.org/1998/Math/MathML;=/mo
mi xmlns=http://www.w3.org/1998/Math/MathML;F/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;+/mo
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mi mathvariant=boldv/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;+/mo
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mi mathvariant=boldi/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;-/mo
mfrac xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mn1/mn
/mrow
mrow
mn2/mn
/mrow
/mfrac
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bold /mi
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=boldK/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bold /mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;-/mo
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normalm/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normala/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normalx/mi
mfenced xmlns=http://www.w3.org/1998/Math/MathML; separators=.
mrow
msub
mrow
miλ/mi
/mrow
mrow
mn1/mn
/mrow
/msub
mo,/mo
msub
mrow
miλ/mi
/mrow
mrow
mn2/mn
/mrow
/msub
mo,/mo
mo…/mo
mo,/mo
msub
mrow
miλ/mi
/mrow
mrow
min/mi
/mrow
/msub
/mrow
/mfenced
mo xmlns=http://www.w3.org/1998/Math/MathML;·/mo
mfenced xmlns=http://www.w3.org/1998/Math/MathML; open=[ close=] 
separators=.
mrow
mic/mi
mo-/mo
msup
mrow
mi mathvariant=boldf/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi mathvariant=bolda/mi
mo+/mo
mil/mi
mfenced separators=.
mrow
msup
mrow
mi mathvariant=boldv/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi mathvariant=bolda/mi
/mrow
/mfenced
/mrow
/mfenced
mo xmlns=http://www.w3.org/1998/Math/MathML;-/mo
mfrac xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mir/mi
/mrow
mrow
mn2/mn
/mrow
/mfrac
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mfenced open={ close=} separators=.
mrow
mi mathvariant=boldλ/mi
mi mathvariant=bold /mi
mo⊙/mo
mfenced open=[ close=] separators=.
mrow
mfenced separators=.
mrow
mn1/mn
mo-/mo
mil/mi
/mrow
/mfenced
mi mathvariant=boldv/mi
mo+/mo
mi mathvariant=boldf/mi
/mrow
/mfenced
/mrow
/mfenced
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bold /mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=boldΣ/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normal /mi
mfenced xmlns=http://www.w3.org/1998/Math/MathML; open={ close=} 
separators=.
mrow
mi mathvariant=boldλ/mi
mi mathvariant=bold /mi
mo⊙/mo
mfenced open=[ close=] separators=.
mrow
mfenced separators=.
mrow
mn1/mn
mo-/mo
mil/mi
/mrow
/mfenced
mi mathvariant=boldv/mi
mo+/mo
mi mathvariant=boldf/mi
/mrow
/mfenced
/mrow
/mfenced
/mml:math\endbuffer{\processxmlbuffer}
\stopformula
___
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] math guru wanted

2013-06-09 Thread Steffen Wolfrum
Hi,

whats wrong with this formula (see below)?
It runs into error:

! Missing \endgroup inserted.

system   tex  error on line 10 in file 
/Volumes/daten_pro/_AKTUELL/BRUNNER/mathml_test/mathml_test1.tex: Missing  ...

 1 %context
 2 %!TEX TS-program = luatex
 3 
 4 
 5 
 6 \usemodule[mathml] \starttext
 7 
 8 
 9 \setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
10   mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
11 mo xmlns=http://www.w3.org/1998/Math/MathML;∈/mo
12 mi xmlns=http://www.w3.org/1998/Math/MathML; 
mathvariant=normala/mi
13 mi xmlns=http://www.w3.org/1998/Math/MathML; 
mathvariant=normalr/mi
14 mi xmlns=http://www.w3.org/1998/Math/MathML; 
mathvariant=normalg/mi
15 mrow xmlns=http://www.w3.org/1998/Math/MathML;
16 mrow
17 munder
18 mrow
19 mi mathvariant=normalmax/mi
20 /mrow

inserted text 
\endgroup 
to be read again 
\right 
\fakerightdelimiter ...nesting \zerocount \right 
  .\fi 
argument ...imiter \xmlflush {temp::22}\fakerightdelimiter 
  \disabledelimiter 
\firstoftwoarguments #1#2h-#1
 
\15:mml:mrow ...sabledelimiter } {\xmlflush {#1}}
  \endgroup 
...
l.217 /mml:math\endbuffer{\processxmlbuffer}

? 
Process aborted



Steffen
---


\usemodule[mathml] \starttext


\setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;∈/mo
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normala/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normalr/mi
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=normalg/mi
mrow xmlns=http://www.w3.org/1998/Math/MathML;
mrow
munder
mrow
mi mathvariant=normalmax/mi
/mrow
mrow
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
/mrow
/munder
/mrow
mo⁡/mo
mrow
mfenced open={ close=} separators=.
mrow
miF/mi
mo+/mo
msup
mrow
mi mathvariant=boldv/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
mo+/mo
msup
mrow
mi mathvariant=boldi/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi mathvariant=bolda/mi
mo-/mo
mfrac
mrow
mn1/mn
/mrow
mrow
mn2/mn
/mrow
/mfrac
mi mathvariant=bold /mi
msup
mrow
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi mathvariant=boldK/mi
mi mathvariant=bold /mi
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
mo-/mo
mfenced open=[ close=] separators=.
mrow
mic/mi
mo-/mo
msup
mrow
mi mathvariant=boldf/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
mo+/mo
mil/mi
mfenced separators=.
mrow
msup
mrow
mi mathvariant=boldv/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
/mrow
/mfenced
/mrow
/mfenced
mo-/mo
mfrac
mrow
mir/mi
/mrow
mrow
mn2/mn
/mrow
/mfrac
msup
mrow
mfenced open=[ close=] separators=.
mrow
mfenced separators=.
mrow
mn1/mn
mo-/mo
mil/mi
/mrow
/mfenced
mi mathvariant=boldv/mi
mo+/mo
mi mathvariant=boldf/mi
/mrow
/mfenced
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi mathvariant=bold /mi
mi mathvariant=boldΣ/mi
mfenced open=[ close=] separators=.
mrow
mfenced separators=.
mrow
mn1/mn
mo-/mo
mil/mi
/mrow
/mfenced
mi mathvariant=boldv/mi
mo+/mo
mi mathvariant=boldf/mi
/mrow
/mfenced
mo|/mo
mi mathvariant=bold-italic /mi
msup
mrow
mi mathvariant=bolda/mi
/mrow
mrow
mi mathvariant=bold'/mi
/mrow
/msup
mo∈/mo
msubsup
mrow
mi mathvariant=double-struckR/mi
/mrow
mrow
mo+/mo
/mrow
mrow
min/mi
/mrow
/msubsup
/mrow
/mfenced
/mrow
/mrow
/mml:math\endbuffer{\processxmlbuffer}


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

Re: [NTG-context] buff_gobble error MathML

2013-06-08 Thread Wolfgang Schuster

Am 08.06.2013 um 12:53 schrieb Steffen Wolfrum cont...@st.estfiles.de:

 Hi friends,
 
 we need to run MathML inside \sym (see below).
 Is there a way to solve the error ! Argument of \buff_gobble has an extra }.

You can’t use \startbuffer … \stopbuffer in other commands but with \setbuffer
there is a command which can be used here.

  \sym{\setbuffer … \endbuffer\processxmlbuffer}

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] buff_gobble error MathML

2013-06-08 Thread Steffen Wolfrum

Am 08.06.2013 um 16:18 schrieb Wolfgang Schuster:

 
 Am 08.06.2013 um 12:53 schrieb Steffen Wolfrum cont...@st.estfiles.de:
 
 Hi friends,
 
 we need to run MathML inside \sym (see below).
 Is there a way to solve the error ! Argument of \buff_gobble has an extra 
 }.
 
 You can’t use \startbuffer … \stopbuffer in other commands but with \setbuffer
 there is a command which can be used here.
 
 \sym{\setbuffer … \endbuffer\processxmlbuffer}



great, thanks. but this immediately gives the next error: invalid xml file - 
parsed text

what's wrong with the code below?

Steffen
---

\usemodule[mathml] \starttext


\setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
mn xmlns=http://www.w3.org/1998/Math/MathML;0/mn
mo xmlns=http://www.w3.org/1998/Math/MathML;≤/mo
msub xmlns=http://www.w3.org/1998/Math/MathML;
mrow
miδ/mi
/mrow
mrow
mij/mi
mis/mi
/mrow
/msub
mo xmlns=http://www.w3.org/1998/Math/MathML;/mo
mroot xmlns=http://www.w3.org/1998/Math/MathML;
mrow
msub
mrow
mik/mi
/mrow
mrow
mij/mi
/mrow
/msub
msub
mrow
mik/mi
/mrow
mrow
mis/mi
/mrow
/msub
/mrow
mrow/
/mroot
/mml:math\endbuffer\processxmlbuffer

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

Re: [NTG-context] buff_gobble error MathML

2013-06-08 Thread Wolfgang Schuster

Am 08.06.2013 um 16:51 schrieb Steffen Wolfrum cont...@st.estfiles.de:

 
 Am 08.06.2013 um 16:18 schrieb Wolfgang Schuster:
 
 
 Am 08.06.2013 um 12:53 schrieb Steffen Wolfrum cont...@st.estfiles.de:
 
 Hi friends,
 
 we need to run MathML inside \sym (see below).
 Is there a way to solve the error ! Argument of \buff_gobble has an extra 
 }.
 
 You can’t use \startbuffer … \stopbuffer in other commands but with 
 \setbuffer
 there is a command which can be used here.
 
 \sym{\setbuffer … \endbuffer\processxmlbuffer}
 
 
 
 great, thanks. but this immediately gives the next error: invalid xml file - 
 parsed text
 
 what's wrong with the code below?

Replace the  operator with lt;

 […]
 mo xmlns=http://www.w3.org/1998/Math/MathML;/mo
 […]

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] mathvariant bold

2013-06-08 Thread Steffen Wolfrum
Hi,

any idea, how to get  it

mi mathvariant=boldp/mi

typeset in bold??



Steffen
---



\usemodule[mathml] \starttext

\placeformula\startformula[9pt]
\setbuffer mml:math xmlns:mml=http://www.w3.org/1998/Math/MathML;
mi xmlns=http://www.w3.org/1998/Math/MathML;π/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;=/mo
msup xmlns=http://www.w3.org/1998/Math/MathML;
mrow
mi mathvariant=boldp/mi
/mrow
mrow
mi mathvariant=boldT/mi
/mrow
/msup
mi xmlns=http://www.w3.org/1998/Math/MathML; mathvariant=bolda/mi
mo xmlns=http://www.w3.org/1998/Math/MathML;+/mo
msub xmlns=http://www.w3.org/1998/Math/MathML;
mrow
miε/mi
/mrow
mrow
miπ/mi
/mrow
/msub
mo xmlns=http://www.w3.org/1998/Math/MathML;=/mo
msubsup xmlns=http://www.w3.org/1998/Math/MathML;
mo∑/mo
mrow
mij/mi
mo=/mo
mn1/mn
/mrow
mrow
min/mi
/mrow
/msubsup
mrow xmlns=http://www.w3.org/1998/Math/MathML;
msub
mrow
mip/mi
/mrow
mrow
mij/mi
/mrow
/msub
msub
mrow
mo·/mo
mia/mi
/mrow
mrow
mij/mi
/mrow
/msub
/mrow
mo xmlns=http://www.w3.org/1998/Math/MathML;+/mo
msub xmlns=http://www.w3.org/1998/Math/MathML;
mrow
miε/mi
/mrow
mrow
miπ/mi
/mrow
/msub
/mml:math\endbuffer{\processxmlbuffer}
\stopformula



___
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] buffer broken?

2012-01-11 Thread luigi scarso
On Wed, Jan 11, 2012 at 11:11 AM, Hans van der Meer havdm...@xs4all.nlwrote:

 Something must have been changed with buffers between the versions:
 ConTeXt  ver: 2011.11.29 18:47 MKIV  fmt: 2011.12.31
 and
 ConTeXt  ver: 2012.01.09 10:08 MKIV  fmt: 2012.1.11

 Formerly this was ok:
 \startbuffer[abc]
 whatever
 \stopbuffer

 Now I get: ! Missing } inserted.

 Because running this in isolation goes without a problem, I suspect the
 change has to do with the project structure in which I use the buffer. But
 again, it worked in the past.

Does it works with
\setbuffer[abc]
whatever
\endbuffer
?


-- 
luigi
___
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] buffer broken?

2012-01-11 Thread Meer, H. van der


On 11 jan. 2012, at 11:33, luigi scarso wrote:



On Wed, Jan 11, 2012 at 11:11 AM, Hans van der Meer 
havdm...@xs4all.nlmailto:havdm...@xs4all.nl wrote:
Something must have been changed with buffers between the versions:
ConTeXt  ver: 2011.11.29 18:47 MKIV  fmt: 2011.12.31
and
ConTeXt  ver: 2012.01.09 10tel:2012.01.09%2010:08 MKIV  fmt: 2012.1.11

Formerly this was ok:
\startbuffer[abc]
whatever
\stopbuffer

Now I get: ! Missing } inserted.

Because running this in isolation goes without a problem, I suspect the change 
has to do with the project structure in which I use the buffer. But again, it 
worked in the past.
Does it works with
\setbuffer[abc]
whatever
\endbuffer
?


It works with these macros, yes. Thanks.

But is \setbuffer..\endbuffer something new? I do not see it on the Reference 
page of the wiki. Also it doesn't seem in line with ConTeXt's regular naming 
scheme of \startsomething..\stopsomething.
Can you give somewhat more information, for examle what is the difference 
between \setbuffer and \startbuffer?


Hans van der Meer

___
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] buffer broken?

2012-01-11 Thread luigi scarso
On Wed, Jan 11, 2012 at 12:52 PM, Meer, H. van der h.vanderm...@uva.nlwrote:



  On 11 jan. 2012, at 11:33, luigi scarso wrote:



 On Wed, Jan 11, 2012 at 11:11 AM, Hans van der Meer havdm...@xs4all.nlwrote:

 Something must have been changed with buffers between the versions:
  ConTeXt  ver: 2011.11.29 18:47 MKIV  fmt: 2011.12.31
  and
  ConTeXt  ver: 2012.01.09 10:08 MKIV  fmt: 2012.1.11

  Formerly this was ok:
  \startbuffer[abc]
  whatever
  \stopbuffer

  Now I get: ! Missing } inserted.

  Because running this in isolation goes without a problem, I suspect the
 change has to do with the project structure in which I use the buffer. But
 again, it worked in the past.

   Does it works with
  \setbuffer[abc]
  whatever
  \endbuffer
  ?


  It works with these macros, yes. Thanks.

  But is \setbuffer..\endbuffer something new? I do not see it on the
 Reference page of the wiki. Also it doesn't seem in line with ConTeXt's
 regular naming scheme of \startsomething..\stopsomething.
 Can you give somewhat more information, for examle what is the difference
 between \setbuffer and \startbuffer?


  Hans van der Meer



 ___
 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

 ___

Well, start/stopbuffer should work... and Hans said that it will be fixed
in the next beta.

The problems seems to be a missing \endgroup

\setuvalue{\e!start\v!buffer}%
  {\bgroup
   \obeylines
   \dosingleempty\buff_start}

\def\buff_start[#1]%
  {\buff_start_indeed{}{#1}{\e!start\v!buffer}{\e!stop\v!buffer}}

\def\buff_start_indeed#1#2#3#4% \donothing needed !
  {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4

Perhaps it should be
\def\buff_start[#1]%
  {\buff_start_indeed{}{#1}{\e!start\v!buffer}{\e!stop\v!buffer}\egroup}



-- 
luigi
___
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] buffer broken?

2012-01-11 Thread Wolfgang Schuster

Am 11.01.2012 um 12:52 schrieb Meer, H. van der:

 
 
 On 11 jan. 2012, at 11:33, luigi scarso wrote:
 
 
 
 On Wed, Jan 11, 2012 at 11:11 AM, Hans van der Meer havdm...@xs4all.nl 
 wrote:
 Something must have been changed with buffers between the versions:
 ConTeXt  ver: 2011.11.29 18:47 MKIV  fmt: 2011.12.31
 and
 ConTeXt  ver: 2012.01.09 10:08 MKIV  fmt: 2012.1.11
 
 Formerly this was ok:
 \startbuffer[abc]
 whatever
 \stopbuffer
 
 Now I get: ! Missing } inserted.
 
 Because running this in isolation goes without a problem, I suspect the 
 change has to do with the project structure in which I use the buffer. But 
 again, it worked in the past.
 Does it works with 
 \setbuffer[abc]
 whatever
 \endbuffer
 ?
 
 
 It works with these macros, yes. Thanks.
 
 But is \setbuffer..\endbuffer something new?

No, it’s a old command but not very useful for a user.

 I do not see it on the Reference page of the wiki.

The original source for the reference pages didn’t provide a way to describe 
the syntax for \setbuffer but there are also many commands which are 
undocumented.

 Also it doesn't seem in line with ConTeXt's regular naming scheme of 
 \startsomething..\stopsomething.
 Can you give somewhat more information, for examle what is the difference 
 between \setbuffer and \startbuffer?

\setbuffer can’t be nested like \startbuffer and not a command which should be 
used in a document. It’s useful for internal use when one write macros where 
the regular buffer environment can’t be used.

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] xtables in custom macros

2011-11-04 Thread Hans Hagen

On 3-11-2011 23:01, Stefan Müller wrote:

\define\Doesnt{\startxtable \startxrow \startxcell does not work
 \stopxcell \stopxrow \stopxtable}
  
\starttext
\Works \stopxtable
%\Doesnt
\stoptext

\def\test
  {\setbuffer[demo]
 \startxtable
   \startxrow
 \startxcell does not work \stopxcell
   \stopxrow
 \stopxtable
   \endbuffer
   \processxtablebuffer[demo]}


--

-
  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] xtables in custom macros

2011-11-04 Thread Thomas A. Schmitz

On 11/4/11 10:38 AM, Hans Hagen wrote:

\def\test
   {\setbuffer[demo]
  \startxtable
\startxrow
  \startxcell does not work \stopxcell
\stopxrow
  \stopxtable
\endbuffer
\processxtablebuffer[demo]}



Hans,

is the solution to my xml problem along these lines as well? Example:

\startbuffer[test]
a
 table
  tablerow
   tablecell
One
   /tablecell
   tablecell
Two
   /tablecell
  /tablerow
  tablerow
   tablecell
Three
   /tablecell
   tablecell
Four
   /tablecell
  /tablerow
 /table
/a
\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{main}{a|table|tablerow|tablecell}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:a
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:table
\startxtable
  \xmlflush{#1}
\stopxtable
\stopxmlsetups

\startxmlsetups xml:tablerow
\startxrow
  \xmlflush{#1}
\stopxrow
\stopxmlsetups

\startxmlsetups xml:tablecell
\startxcell \xmlflush{#1} \stopxcell
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

Would like to find a way to use the new mechanism with xml.

All best

Thomas
___
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] xtables in custom macros

2011-11-04 Thread Hans Hagen

On 4-11-2011 11:11, Thomas A. Schmitz wrote:

On 11/4/11 10:38 AM, Hans Hagen wrote:

\def\test
{\setbuffer[demo]
\startxtable
\startxrow
\startxcell does not work \stopxcell
\stopxrow
\stopxtable
\endbuffer
\processxtablebuffer[demo]}



Hans,

is the solution to my xml problem along these lines as well? Example:

\startbuffer[test]
a
table
tablerow
tablecell
One
/tablecell
tablecell
Two
/tablecell
/tablerow
tablerow
tablecell
Three
/tablecell
tablecell
Four
/tablecell
/tablerow
/table
/a
\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{main}{a|table|tablerow|tablecell}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:a
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:table
\startxtable
\xmlflush{#1}
\stopxtable
\stopxmlsetups

\startxmlsetups xml:tablerow
\startxrow
\xmlflush{#1}
\stopxrow
\stopxmlsetups

\startxmlsetups xml:tablecell
\startxcell \xmlflush{#1} \stopxcell
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

Would like to find a way to use the new mechanism with xml.


In the next beta .. still somewhat experimental as we need to deal with 
all kind of situations, like \asciimode in regular tex.


\startbuffer[test]
table
tablerow
tablecell
One
/tablecell
tablecell
Two
/tablecell
/tablerow
tablerow
tablecell
bThree/b
/tablecell
tablecell
Four
/tablecell
/tablerow
/table
\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{main}{b|table|tablerow|tablecell}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:b
\bold{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:table
\startembeddedxtable
\xmlflush{#1}
\stopembeddedxtable
\stopxmlsetups

\startxmlsetups xml:tablerow
\startxrow
\xmlflush{#1}
\stopxrow
\stopxmlsetups

\startxmlsetups xml:tablecell
\startxcell
\xmlflush{#1}
\stopxcell
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

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] xtables in custom macros

2011-11-04 Thread Stefan Müller
 On 3-11-2011 23:01, Stefan Müller wrote:
  \define\Doesnt{\startxtable \startxrow \startxcell does not work
   \stopxcell \stopxrow \stopxtable}

  \starttext
  \Works \stopxtable
  %\Doesnt
  \stoptext
 \def\test
{\setbuffer[demo]
   \startxtable
 \startxrow
   \startxcell does not work \stopxcell
 \stopxrow
   \stopxtable
 \endbuffer
 \processxtablebuffer[demo]}

Nice! Thank you very much!

Stefan
-- 


___
ey, leute, ich hab so lange gebraucht um mir plan a auszudenken, fragt jetzt 
doch nicht auch 
noch nach plan b!

Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
___
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] xtables in custom macros

2011-11-04 Thread Hans Hagen

On 4-11-2011 18:18, Stefan Müller wrote:

On 3-11-2011 23:01, Stefan Müller wrote:

\define\Doesnt{\startxtable \startxrow \startxcell does not work
  \stopxcell \stopxrow \stopxtable}

  
 \starttext
 \Works \stopxtable
 %\Doesnt
 \stoptext

\def\test
{\setbuffer[demo]
   \startxtable
 \startxrow
   \startxcell does not work \stopxcell
 \stopxrow
   \stopxtable
 \endbuffer
 \processxtablebuffer[demo]}


Nice! Thank you very much!


the manual shows a more convenient way (embeddedxtable)

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] Handling EMBED tag in Tex

2011-01-06 Thread Wolfgang Schuster

Am 06.01.2011 um 04:42 schrieb Anand Raj:

 Hi,
 
 I have embed tags in my xhtml can i render it in my pdf. 
 
 How should I form the .tex file to handle this?
 
 embed type='image/svg+xml' align='middle' width='200' height='200' 
 src='/javascript/d.svg' 
 script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
  /

Write the whole block to a external file and read import it them with 
\externalfigure.

\startxmlsetups xml:embed
   \setbuffer[embed]\xmlflush{#1}\endbuffer
   \savebuffer[embed][embed.svg]
   \externalfigure[embed.svg]
\stopxmlsetups

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] Handling EMBED tag in Tex

2011-01-06 Thread Hans Hagen

On 6-1-2011 9:02, Wolfgang Schuster wrote:


Am 06.01.2011 um 04:42 schrieb Anand Raj:


Hi,

I have embed tags in my xhtml can i render it in my pdf.

How should I form the .tex file to handle this?

embed type='image/svg+xml' align='middle' width='200' height='200' src='/javascript/d.svg' 
script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
 /


Write the whole block to a external file and read import it them with 
\externalfigure.

\startxmlsetups xml:embed
\setbuffer[embed]\xmlflush{#1}\endbuffer
\savebuffer[embed][embed.svg]
\externalfigure[embed.svg]
\stopxmlsetups


remind me to make a \xmltofile some time

-
  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] Handling EMBED tag in Tex

2011-01-06 Thread Anand Raj
Yes. the svg content is not stored in the embed.svg.

can you make it?

Thanks

On Thu, Jan 6, 2011 at 5:28 PM, Hans Hagen pra...@wxs.nl wrote:

 On 6-1-2011 9:02, Wolfgang Schuster wrote:


 Am 06.01.2011 um 04:42 schrieb Anand Raj:

  Hi,

 I have embed tags in my xhtml can i render it in my pdf.

 How should I form the .tex file to handle this?

 embed type='image/svg+xml' align='middle' width='200' height='200'
 src='/javascript/d.svg'
 script='initPicture(-.5,5,-.5,5);path([[0,0],[1,4],[4,4],[3,0],[0,0]]);text([2.5,4],44,above);text([3.5,2],44,right);stroke=red;fontfill=red;line([1,0],[1,4]);text([1,2],?,right);'
 /


 Write the whole block to a external file and read import it them with
 \externalfigure.

 \startxmlsetups xml:embed
\setbuffer[embed]\xmlflush{#1}\endbuffer
\savebuffer[embed][embed.svg]
\externalfigure[embed.svg]
 \stopxmlsetups


 remind me to make a \xmltofile some time

 -
  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

 ___

___
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] vbox construct breaking MKII

2010-08-04 Thread Hans Hagen

On 4-8-2010 6:51, Aditya Mahajan wrote:

On Wed, 4 Aug 2010, Hans Hagen wrote:


On 4-8-2010 9:16, Willi Egger wrote:

Hi all,

Any variation of the following construct breaks in MKII as long as there
is no new line after the closing } of the vbox. MKIV does not have this
problem.

\startbuffer[bf4]
\vbox{
test
}\stopbuffer

Please refer to the testfile


\stopbuffer has to be on a line of its own so

}
\stopbuffer


Is it possible to have an inline version of \start...stopbuffer. So that

\buffer[options]{...} is similar to

\startbuffer[options]
...
\stopbuffer

The functionality is already there. \type parses the contents correctly,
and
\startbuffer writes it to an external file. Something that combines the
two will
be great.

Such a feature will be handy for inline syntax highlighting with the t-vim
module.


\setbuffer[bla]more bla\endbuffer

-
  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] vbox construct breaking MKII

2010-08-04 Thread Aditya Mahajan

On Wed, 4 Aug 2010, Hans Hagen wrote:


On 4-8-2010 6:51, Aditya Mahajan wrote:

 On Wed, 4 Aug 2010, Hans Hagen wrote:

  On 4-8-2010 9:16, Willi Egger wrote:
   Hi all,
  
   Any variation of the following construct breaks in MKII as long as 
   there
   is no new line after the closing } of the vbox. MKIV does not have 
   this

   problem.
  
   \startbuffer[bf4]

   \vbox{
   test
   }\stopbuffer
  
   Please refer to the testfile
 
  \stopbuffer has to be on a line of its own so
 
  }

  \stopbuffer

 Is it possible to have an inline version of \start...stopbuffer. So that

 \buffer[options]{...} is similar to

 \startbuffer[options]
 ...
 \stopbuffer

 The functionality is already there. \type parses the contents correctly,
 and
 \startbuffer writes it to an external file. Something that combines the
 two will
 be great.

 Such a feature will be handy for inline syntax highlighting with the t-vim
 module.


\setbuffer[bla]more bla\endbuffer


That does not work in mkii and does not look right for the user interface. 
For pretty printing using the inbuilt macros, one can use


\startTEX

\stopTEX

and \typeTEX{...}

Normally, I want the display version to insert blank spaces while the 
inline version to leave them alone. In the t-vim module, I can create 
environment


\startvimTEX
...
\stopvimTEX

(that writes contents to file and inputs the result) but cannot easily 
create \typevimTEX. For that I will need to reimplement all the catcode 
trickery of \definetype and \definebuffer.


Aditya
___
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] from latex pstricks to context

2009-07-13 Thread luigi scarso
On Mon, Jul 13, 2009 at 11:05 AM, R. Bastian rbast...@free.fr wrote:


 What is the sense of \startPSTRICKS ... \stopPSTRICKS ?

A wrapper around \executesystemcommand,

 \long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS
  {\doifelse{\jobsuffix}{dvi} % will some day move to app as switch
 {\hbox{#2}}
 {\startTEXapplication[#1]{\usemodule[pstric]}#2\stopTEXapplication}}

for \startTEXapplication see
page-app.tex


\long\def\dostartTEXapplication[#1]#2#3\stopTEXapplication
  {\bgroup
   \bgroup
   \let\f!temporaryextension\c!tex
   \setbuffer[\@@texapp]%
 \starttext
 #2% preamble
 \startTEXpage[#1]%
   \topskip\zeropoint
   \setbox\scratchbox\hbox{#3}%
   \saveTEXapplication02% dimensions
   \box\scratchbox
 \stopTEXpage
 \stoptext
   \endbuffer
   \egroup
   \doifelse\jobsuffix{dvi}\donetrue\donefalse
   \executesystemcommand{texexec \bufferprefix\@@texapp.tex --once --batch}%
   \ifdone % eps
 \executesystemcommand{dvips -E* -o \@@texapp.eps \@@texapp}%
   \else % pdf
 \executesystemcommand{dvips \bufferprefix\@@texapp}%
 \executesystemcommand{ps2pdf
\bufferprefix\@@texapp.ps\bufferprefix\@@texapp.pdf}%
%  \executesystemcommand{texmfstart pstopdf
\bufferprefix\@@texapp.ps\bufferprefix\@@texapp.pdf}%
   \fi
   \restoreTEXapplication % dimensions
   \doifelse\jobsuffix{dvi}\donetrue\donefalse
   \setbox\scratchbox\hbox
 {\expanded{\externalfigure
[\bufferprefix\@@texapp.\ifdone eps\else pdf\fi]
[\c!object=\v!no]}}%
   \setbox\scratchbox\hbox
 {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}%
   \wd\scratchbox\dimen0
   \ht\scratchbox\dimen2
   \dp\scratchbox\zeropoint
   \box\scratchbox
   \egroup}


I suppose that works ok in mkii, but maybe not in mkiv
so the actually the best way is (imho) make pdf images  using traditional
way (latex+dvips)
and include them by \externalfigure

-- 
luigi
___
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] \setbuffer

2009-05-10 Thread Wolfgang Schuster


Am 14.02.2009 um 10:09 schrieb Wolfgang Schuster:


Hi Hans,

why is \setbuffer not defined as \long, I want to use it as part
of a macro and need it to allow paragraphs as content.

Can you change this?

TIA,
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] \setbuffer

2009-05-10 Thread Hans Hagen

Wolfgang Schuster wrote:


Am 14.02.2009 um 10:09 schrieb Wolfgang Schuster:


Hi Hans,

why is \setbuffer not defined as \long, I want to use it as part
of a macro and need it to allow paragraphs as content.

Can you change this?


no need as \dosetbuffer is defined as \long and \setbuffer itself does 
not has any arguments



-
  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] \setbuffer

2009-02-24 Thread Wolfgang Schuster
On Sat, Feb 14, 2009 at 10:09 AM, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:
 Hi Hans,

 why is \setbuffer not defined with \long, I want to use it as part
 of a macro and need it to allow paragraphs as content.

 Can you change this?

 TIA,
 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] \setbuffer

2009-02-19 Thread Wolfgang Schuster


Am 14.02.2009 um 10:09 schrieb Wolfgang Schuster:


Hi Hans,

why is \setbuffer not defined with \long, I want to use it as part
of a macro and need it to allow paragraphs as content.

Can you change this?

TIA,
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] \setbuffer

2009-02-14 Thread Wolfgang Schuster

Hi Hans,

why is \setbuffer not defined with \long, I want to use it as part
of a macro and need it to allow paragraphs as content.

Can you change this?

TIA,
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] creating environments

2007-02-05 Thread Wolfgang Schuster

2007/1/31, Wolfgang Schuster [EMAIL PROTECTED]:




2007/1/31, Hans Hagen [EMAIL PROTECTED]:

 Wolfgang Schuster wrote:
  On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
  Aditya Mahajan  [EMAIL PROTECTED] wrote:
 
 
  On Tue, 30 Jan 2007, Wolfgang Schuster wrote:
 
 
  On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
  Aditya Mahajan  [EMAIL PROTECTED] 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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] creating environments

2007-01-31 Thread Hans Hagen
Wolfgang Schuster wrote:
 On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
 Aditya Mahajan [EMAIL PROTECTED] wrote:

   
 On Tue, 30 Jan 2007, Wolfgang Schuster wrote:

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

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


Re: [NTG-context] creating environments

2007-01-31 Thread Wolfgang Schuster

2007/1/31, Hans Hagen [EMAIL PROTECTED]:


Wolfgang Schuster wrote:
 On Tue, 30 Jan 2007 10:05:23 -0500 (EST)
 Aditya Mahajan [EMAIL PROTECTED] wrote:


 On Tue, 30 Jan 2007, Wolfgang Schuster wrote:


 On Mon, 29 Jan 2007 10:15:34 -0500 (EST)
 Aditya Mahajan [EMAIL PROTECTED] 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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] LilyPond module for LilyPond 2.9.x

2006-10-03 Thread Henning Hraban Ramm
Hello again, I'm still stuck with the counter problem, unfortunately  
I got no response...


ConTeXts writes out all the LilyPond pieces as myfile-lilypond- 
#.tmp, sequential numbered.
Then it should run LilyPond and epstopdf on the snippets, but runs  
them always only on no.1

I.e. the counter doesn't behave like it should. Why?

I think, these are the regarding code snippets (sorry, can't think of  
a minimal example for I don't understand the code by Christopher):


\unprotect
\def\??lily{lilypond-}
%...
\newcount\lily!figures
%...
\long\def\dodostartlilypond[#1]#2\stoplilypond{%
   \egroup% from \dostartlilypond
   \bgroup%
%...
   \global\advance\lily!figures\plusone
   \startmode[*\v!first]%
   \def\obeyedlines{\string^^J}%
   \convertargument#2\to\ascii
   \expanded{%
   \setbuffer[lilypond-\the\lily!figures]%
% here it works, all buffers are numbered
% ...
   \ascii%
   \ifundefined{\??lily fragment}\else\lily!fragmentsuffix\fi
   }% expanded
   \endbuffer%

   \def\LP{texmfstart --exec bin:lilypond -b eps -dno-gs-load-fonts - 
dinclude-eps-fonts }

   \def\PDF{texmfstart --ifchanged=}

% here the counter is always 1  
   \ifeof18
  \installprogram{\LP\bufferprefix lilypond-\the\lily!figures.tmp}%
% can someone explain this installprogram?
  \doif\jobsuffix{pdf}{%
 \installprogram{\PDF\bufferprefix lilypond-\the\lily! 
figures.eps pstopdf  \bufferprefix lilypond-\the\lily!figures.eps}%

  }%
   \else
  \executesystemcommand{\LP\bufferprefix lilypond-\the\lily! 
figures.tmp}%

  \doif\jobsuffix{pdf}{%
 \executesystemcommand{\PDF\bufferprefix lilypond-\the\lily! 
figures.eps pstopdf  \bufferprefix lilypond-\the\lily!figures.eps}%

  }%
   \fi
   \stopmode% only first run
   \doifelse\jobsuffix{pdf}
  {\edef\lily!img{\bufferprefix lilypond-\the\lily!figures.pdf}}%
  {\edef\lily!img{\bufferprefix lilypond-\the\lily!figures.eps}}%

   \ifvmode
  \getfiguredimensions[\bufferprefix lilypond-\the\lily! 
figures.pdf]%

% here it works again, image no.# is not found (besides no.1)
  \leavevmode%
  \newdimen\FigWidth
  \FigWidth=\figurewidth
  \ifdim\FigWidth\localhsize
 \!!dimena=\localhsize
 \advance\!!dimena by-\FigWidth
 \noindent\hskip\!!dimena
  \fi
   \fi
   \externalfigure[\lily!img]%
   \egroup%
}%


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)



smime.p7s
Description: S/MIME cryptographic signature
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] LilyPond module for LilyPond 2.9.x

2006-10-03 Thread Mojca Miklavec
On 10/3/06, Henning Hraban Ramm wrote:
 Hello again, I'm still stuck with the counter problem, unfortunately
 I got no response...

 ConTeXts writes out all the LilyPond pieces as myfile-lilypond-
 #.tmp, sequential numbered.
 Then it should run LilyPond and epstopdf on the snippets, but runs
 them always only on no.1
 I.e. the counter doesn't behave like it should. Why?

 I think, these are the regarding code snippets (sorry, can't think of
 a minimal example for I don't understand the code by Christopher):

 \unprotect
 \def\??lily{lilypond-}
 %...
 \newcount\lily!figures
 %...
 \long\def\dodostartlilypond[#1]#2\stoplilypond{%
 \egroup% from \dostartlilypond
 \bgroup%
 %...
 \global\advance\lily!figures\plusone
 \startmode[*\v!first]%
 \def\obeyedlines{\string^^J}%
 \convertargument#2\to\ascii
 \expanded{%
 \setbuffer[lilypond-\the\lily!figures]%
 % here it works, all buffers are numbered
 % ...
 \ascii%
 \ifundefined{\??lily fragment}\else\lily!fragmentsuffix\fi
 }% expanded
 \endbuffer%

 \def\LP{texmfstart --exec bin:lilypond -b eps -dno-gs-load-fonts -
 dinclude-eps-fonts }
 \def\PDF{texmfstart --ifchanged=}

 % here the counter is always 1
 \ifeof18
\installprogram{\LP\bufferprefix lilypond-\the\lily!figures.tmp}%
 % can someone explain this installprogram?
\doif\jobsuffix{pdf}{%
   \installprogram{\PDF\bufferprefix lilypond-\the\lily!
 figures.eps pstopdf  \bufferprefix lilypond-\the\lily!figures.eps}%
}%
 \else
\executesystemcommand{\LP\bufferprefix lilypond-\the\lily!
 figures.tmp}%
\doif\jobsuffix{pdf}{%
   \executesystemcommand{\PDF\bufferprefix lilypond-\the\lily!
 figures.eps pstopdf  \bufferprefix lilypond-\the\lily!figures.eps}%
}%
 \fi
 \stopmode% only first run
 \doifelse\jobsuffix{pdf}
{\edef\lily!img{\bufferprefix lilypond-\the\lily!figures.pdf}}%
{\edef\lily!img{\bufferprefix lilypond-\the\lily!figures.eps}}%

 \ifvmode
\getfiguredimensions[\bufferprefix lilypond-\the\lily!
 figures.pdf]%
 % here it works again, image no.# is not found (besides no.1)
\leavevmode%
\newdimen\FigWidth
\FigWidth=\figurewidth
\ifdim\FigWidth\localhsize
   \!!dimena=\localhsize
   \advance\!!dimena by-\FigWidth
   \noindent\hskip\!!dimena
\fi
 \fi
 \externalfigure[\lily!img]%
 \egroup%
 }%

I cannot test since lilypond is not working properly on my computer,
but I get the proper numbers.

Here's an excerpt from the log file (I changed lilypond to echo):

systems : begin file test1 at line 2
test1-lilypond-1.tmp
system(echo test1-lilypond-1.tmp)...executed.

system(epstopdf test1-lilypond-1.eps)...executed.

 (C:\Programi\MikTeX\tex\context\base\pdfr-ec.tex)
figures : figure test1-lilypond-1 can not be found
color   : mpcmyk color space is supported
color   : mpspot color space is supported
color   : system rgb is local activated
test1-lilypond-2.tmp
system(echo test1-lilypond-2.tmp)...executed.

system(epstopdf test1-lilypond-2.eps)...executed.


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


Re: [NTG-context] counting the words in a TeX document

2006-08-07 Thread Mojca Miklavec
On 8/6/06, Aditya Mahajan wrote:
 On Sun, 6 Aug 2006, Mojca Miklavec wrote:
  Base on those three answers I got a more clear idea of two (different,
  but complementary) methods that might be sensible:
 
  a) ctxtools --wordcount filename[tex|pdf]
  to do the wordcount for the whole document using pdftotext + ruby regexp
 
  b)
  \usemodule[wordcount]
 
  whatever
 
  \startstatistics[name][words|letters|lines]
  some more-or-less plain text
  \stopstatistics
 
  whatever
 
  and according to Aditya's idea, run a (ruby) regular expression
  (insead of detex) on it which would write the nicely formatted desired
  number to the output/log file. (I don't know if it's possible to use
  the first approach for the second problem, but it doesn't make sense
  to complicate things too much.)

 If you have a script that counts words in a Context document, the
 second approach is straight forward. Write everything to a buffer and
 run the script on the buffer. However, such a mechansim will never be
 perfect (or close to perfect) in the sense of parsing arbitrary input.

The most dummy solution that I could think of (using slightly modified
Hans's ruby script):

\unprotect

\def\startstatistics
  {\dodoubleempty\dostartstatistics}

\def\dostartstatistics[#1][#2]#3\stopstatistics
  {\setbuffer[#1]#3\endbuffer
\executesystemcommand{ruby wordcount.rb \jobname-#1.tmp}%
\getbuffer[#1]}

\protect \doifnotmode{demo}{\endinput}

... but a friend who asked me for a favour actually wants to use
abbreviations and bibliography as well, so only the first method (to
create PDF first) would work. He currently keeps copy-pasting the
resulting PDF to Word and uses Word's statistics to cound the words
and/or characters for him.

But I guess that his wishes will have to wait for some more time in this case.

 ftp://tug.ctan.org/pub/tex-archive/macros/plain/contrib/misc/xii.tex

 But of course, you will not write anything like this in an abstract
 :-)

Nevertheless, I love the story (and esp. the document which creates it)!

All the best,
Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] t-rsteps and starttyping

2005-09-22 Thread Christopher Creutzig
David Munger wrote:

 Unfortunately, the \StartLong macro is not meant only for producing
 line-wise content. In the general case, it contains something else than
 just \starttyping block.

 Please try this:

\bgroup

\catcode`\^^M=\active

\gdef\StartLong{\begingroup\obeylines\let^^M^^J\doStartLong}

\egroup

\def\doStartLong#1\StopLong{%
  \setbuffer[x]#1\endbuffer
  \endgroup
  \getbuffer[x]
}


\starttext
\StartLong
\starttyping
abcde
\stoptyping

and now
for something
completely different

\StopLong
\stoptext


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


Re: [NTG-context] t-rsteps and starttyping

2005-09-22 Thread David Munger
Hi Christopher,

This was the right way. Thanks a lot!

Still, I don't understand how the \starttyping macro gets to work if ^^M
is redefined as ^^J.

I will tell Patrick to update the module on the garden. Meanwhile, you
can get the updated version on my site:
http://cfd.homelinux.org/tex/


David

Le Jeudi 22 septembre 2005 à 08:56 +0200, Christopher Creutzig a écrit :
 David Munger wrote:
 
  Unfortunately, the \StartLong macro is not meant only for producing
  line-wise content. In the general case, it contains something else than
  just \starttyping block.
 
  Please try this:
 
 \bgroup
 
 \catcode`\^^M=\active
 
 \gdef\StartLong{\begingroup\obeylines\let^^M^^J\doStartLong}
 
 \egroup
 
 \def\doStartLong#1\StopLong{%
   \setbuffer[x]#1\endbuffer
   \endgroup
   \getbuffer[x]
 }
 
 
 \starttext
 \StartLong
 \starttyping
 abcde
 \stoptyping
 
 and now
 for something
 completely different
 
 \StopLong
 \stoptext
 
 
 Christopher
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context

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