Re: [NTG-context] Float positioning

2020-04-09 Thread Alexey Kryukov
On Thu, 9 Apr 2020 20:44:16 +0200
Geert Dobbels wrote:

> Hello,
> 
> Maybe I did not understand the problem, but doesn't the code below
> give you the expected result?:

Hmm, unfortunately no. Using [top,force] just causes context to 
break the text flow at the place where the image is specified.
You can see that both the first and second pages in your example
are underfilled, although I would expect the free space to be filled
with the text.

Also it seems the [force] flag causes the [page] flag to be ignored:
here the second and third images are positioned as if [top] has been
specified, but, again, there is no text under the second image, as
in the file is followed by the third image, which goes to the next page.

-- 
Regards,
Alexey Kryukov 

Moscow State University
Faculty of History
___
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] Float positioning

2020-04-09 Thread Geert Dobbels
Hello,

Maybe I did not understand the problem, but doesn't the code below give
you the expected result?:

\setupexternalfigures[location={local,default}]

\starttext

\dorecurse{3}{\input{knuth}}

\placefigure[force]{cow}{\externalfigure[cow][width=150mm]}

\input{knuth}

\placefigure[force,page]{one more cow}{\externalfigure[cow][width=150mm]}

\placefigure[force,page]{cow again}{\externalfigure[cow][width=150mm]}

\dorecurse{10}{\input{knuth}}

\stoptext


Geert

On 06/04/2020 13:15, Alexey Kryukov wrote:
> Hi all,
>
> Suppose I have the following document:
>
> \setupexternalfigures[location={local,default}]
> \starttext
>
> \dorecurse{3}{\input{knuth}}
> \placefigure[top]{cow}{\externalfigure[cow][width=150mm]}
> \input{knuth}
> \placefigure[page]{one more cow}{\externalfigure[cow][width=150mm]}
> \placefigure[page]{cow again}{\externalfigure[cow][width=150mm]}
> \dorecurse{10}{\input{knuth}}
> \stoptext
>
> Here I would expect the text flow to continue below the first image,
> and then two more images to be positioned on separate pages. Instead I
> get no text at all at the page with the Figure 1 and one more
> blank page after it. Only after the last image the text flow continues.
>
> Since similar situations are very common for documents which contain
> several large illustrations, I would like to know if there are any
> workarounds for the problem.
>

___
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] METAPOST/MetaFun withtransparency doesn't accept my pair primary argument, what am I doing wrong?

2020-04-09 Thread Hans Hagen

On 4/9/2020 4:58 PM, Gerben Wierda wrote:

\starttext
\startMPpage[instance=doublefun]

vardef Foo( expr w, h, fillColor, fillTransparency) =
   show "FOO:", w, h, fillColor, fillTransparency;
   save pic; picture pic;
   save circ; path circ;
   circ := (fullcircle xyscaled (h,h));
   pic := image (
     fill (circ shifted (w-h/2,-h/2)) withcolor fillColor 
withtransparency fillTransparency;

   );
   pic
enddef;

pic := Foo( 150, 50, (0.686,1.000,1.000), (1,1.000));
draw pic;
\stopMPpage
\stoptext


Maybe this definition is better then but I need to test it more

\starttext
\startMPpage[instance=doublefun]

def withtransparency expr t =
if pair t :
withprescript "tr_alternative="  & decimal 
transparency_alternative_to_number(xpart t)

withprescript "tr_transparency=" & decimal ypart t
else :
mfun_with_transparency (transparency_alternative_to_number(t))
fi
enddef ;

def mfun_with_transparency (expr a) expr t =
withprescript "tr_alternative="  & decimal a
withprescript "tr_transparency=" & decimal t
enddef ;

vardef Foo ( expr w, h, fillColor, fillTransparency) =
  image (
fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2)
withcolor fillColor
withtransparency fillTransparency
;
  )
enddef;

vardef FooX ( expr w, h, fillColor) =
  image (
fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2)
withcolor fillColor
withtransparency (normaltransparent, .5)
;
  )
enddef;

vardef FooY ( expr w, h, fillColor) =
  image (
fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2)
withcolor fillColor
withtransparency normaltransparent .5
;
  )
enddef;

draw Foo  ( 350, 50, (0.5,1,0), (1,.5));
draw FooX ( 250, 50, (1,0.5,1));
draw FooY ( 150, 50, (1,1,0.5));

\stopMPpage
\stoptext


--

-
  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] METAPOST/MetaFun withtransparency doesn't accept my pair primary argument, what am I doing wrong?

2020-04-09 Thread Gerben Wierda
I have refactored my code to use withtransparency and separate parameters for 
colors, sizes, transparency, etc. But I’m running into a problem. The 
fillTransparency parameter is a pair primary (as can be seen from the show 
command)

Here is a pretty minimum example (in reality there are multiple colors and 
transparencies passed on):

\starttext
\startMPpage[instance=doublefun]

vardef Foo( expr w, h, fillColor, fillTransparency) =
  show "FOO:", w, h, fillColor, fillTransparency;
  save pic; picture pic;
  save circ; path circ;
  circ := (fullcircle xyscaled (h,h));
  pic := image (
fill (circ shifted (w-h/2,-h/2)) withcolor fillColor withtransparency 
fillTransparency;
  );
  pic
enddef;

pic := Foo( 150, 50, (0.686,1.000,1.000), (1,1.000));
draw pic;
\stopMPpage
\stoptext

and the result is:

metapost log> >> "FOO:"
metapost log> >> 150
metapost log> >> 50
metapost log> >> (0.68605,1,1)
metapost log> >> (1,1)
metapost log> ! Missing argument to withtransparency.
metapost log>  
metapost log>((1,1))
metapost log>  ...005,1,1))withtransparency((1,1))
metapost log>   ;
metapost log> image->...ture;currentpicture:=nullpicture;(TEXT3)
metapost log>   
;currentpicture.if.str(SUF...
metapost log> 
metapost log> Foo->...)withcolor(EXPR4)withtransparency(EXPR5);)
metapost log>   
;pic.endgroup
metapost log> <*> ...o( 150, 50, (0.686,1.000,1.000), (1,1.000))
metapost log>   ; draw pic; 
;

What am I doing wrong here?

Thanks,

G

PS. Given the complaint about asking both here and on tex.stackexchange, which 
of the two is the best place?___
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] using realpagenumber for /PageLabels

2020-04-09 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\setupuserpagenumber[way=chapter]
\starttext
\dorecurse{5}{\chapter{Chapter}}
\stoptext

I need to restart user page numbers in each part (I use real page to
number the complete document).

But the main problem is this way also restarts pages in the final PDF
document (/PageLabels).

Is there any way that I can use real pages instead of user pages for
/PageLabels in the PDF document?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Henri Menke
It would be really great if you'd stop wasting people's time by not
crossposting.

Cheers, Henri

On 09/04/20, 09:04, Gerben Wierda wrote:
> Nobody?
> 
> > On 8 Apr 2020, at 12:20, Gerben Wierda  wrote:
> > 
> > I would like to use the result of transparent() straight in my macros, so I 
> > can pass the colors with transparency using a single parameter. That should 
> > be possible if I understand the MetaFun manual (where I’ve copy-pasted this 
> > example from):
> > 
> > \starttext
> > \startMPpage[instance=doublefun]
> > 
> > vardef SampleText (expr t, c) =
> >   save p ; picture p ;
> >   p := image (draw t infont "\truefontname{Regular}") ;
> >   draw (p shifted (- xpart center p,0)) scaled 5 withcolor c;
> > enddef ;
> > SampleText ("Much Of This"   , transparent(1, .5, red  )) ;
> > SampleText ("Functionality"  , transparent(1, .5, green)) ;
> > SampleText ("Was Written", transparent(1, .5, blue )) ;
> > SampleText ("While Listening", transparent(1, .5, cmyk(1,0,0,0))) ;
> > SampleText ("To the CD's Of" , transparent(1, .5, cmyk(0,1,0,0))) ;
> > SampleText ("Tori Amos"  , transparent(1, .5, cmyk(0,0,1,0))) ;
> > 
> > \stopMPpage
> > \stoptext
> > 
> > But it results in:
> > 
> > system  > files > jobname 'testcolor', input './testcolor', result 
> > 'testcolor'
> > fonts   > latin modern fonts are not preloaded
> > languages   > language 'en' is active
> > open source > level 2, order 3, name './testcolor.tex'
> > fonts   > preloading latin modern fonts (second stage)
> > fonts   > 'fallback modern-designsize rm 12pt' is loaded
> > metapost> initializing instance 'doublefun:1' using format 
> > 'metafun' and method 'double'
> > metapost> loading 'metafun' as 
> > '/usr/local/context-osx-64/tex/texmf-context/metapost/context/base/mpiv/metafun.mpxl'
> >  using method 'double'
> > metapost> initializing number mode 'double'
> > metapost log> 
> > metapost log> loading metafun, including plain.mp version 1.004 for 
> > metafun iv and xl
> > metapost log> 
> > metapost log> ! Missing ')' has been inserted.
> > metapost log>  
> > metapost log>withprescript
> > metapost log> transparent->(1)withprescript
> > metapost log>  
> > "tr_alternative="_alternat...
> > metapost log> <*> ... ("Much Of This" , transparent(1, .5, red )
> > metapost log>   ) ; 
> > SampleText ("Functiona...
> > metapost log> 
> > backend > xmp > using file 
> > '/usr/local/context-osx-64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
> > pages   > flushing realpage 1, userpage 1, subpage 1
> > close source> level 2, order 3, name './testcolor.tex'
> > close source> level 1, order 3, name 'cont-yes.mkiv'
> > 
> > For me, it is not about passing colour on to ConTeXt to typeset text, these 
> > are colors that normally would be drawn with “withcolor ca withtransparency 
> > (method,factor)” but that requires the passing of many more parameters and 
> > a lot more work in coding.
> > 
> > Does transparent() maybe produce a string that looks like “ca 
> > withtransparency (method,factor)” so something only usable in draw/fill/etc 
> > statements? But in that case how does that work without scantokens to parse 
> > the string?
> > 
> > Is there a way I can do this without having twice the parameters (and I 
> > have to pass multiple colours)  in my macros everywhere?
> > 
> > Thanks,
> > 
> > G
> > ___
> > 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
> ___

___
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   

Re: [NTG-context] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Hans Hagen

On 4/9/2020 11:01 AM, Taco Hoekwater wrote:

Hi,

Using multiple (text ) arguments in macros doesn’t work, you would
need to convert all but the last argument into (expr ) somehow.

That means that you probably cannot do a call like the one below at all.
(I, at least, do not see how you could convert one of those transparent
colours into an expr  argument)



SampleText ("Much Of This", transparent(1, .5, red  ) , transparent(1, .5, 
green  )) ;


The situation may get even trickier because withtransparency() and
transparent() both use a  (text ) argument internally as well,
and I am not quite sure why.

At this point, I think you may need Hans for advice, sorry.
Taco is right (of course). Indeed, one can end up in conflicts (mp has 
no transparency so it's all implemented using trickery). Anyway, using 
'infont' has no real benefits as it maps onto textext, so one can just 
use that one (also because it supports the anchoring suffixes which 
saves you the shift):


\starttext
\startMPpage[instance=doublefun]

draw textext("more recent") withcolor red withtransparency 
(1, .5) ;
draw textext("functionality"  ) withcolor green   withtransparency 
(1, .5) ;
draw textext("was written") withcolor bluewithtransparency 
(1, .5) ;
draw textext("while listening") withcolor magenta withtransparency 
(1, .5) ;
draw textext("to superb covers by") withcolor cyanwithtransparency 
(1, .5) ;
draw textext("Alyona Yarushina"   ) withcolor yellow  withtransparency 
(1, .5) ;


\stopMPpage
\stoptext

If something like "withcolor ... " is passed to a macro it has to be a 
text argument, not an expression (the transparent macro actually passed 
some abstraction); also, when making vardef's one need to omit the final 
semi colon in order to apply more properties to the 'return value'.


At some point I will update the metafun manual which means: remove old 
methods and exclusively use the new ones (currently the manual also 
discusses mpii while in context mkiv/lmtx we use mpiv macros).


For instance, when using colors one can best use named colors as these 
are consistent with the tex end, so often


  withcolor "red"

is better than

  withcolor red

etc etc etc etc

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] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Taco Hoekwater
Hi,

Using multiple (text ) arguments in macros doesn’t work, you would 
need to convert all but the last argument into (expr ) somehow.

That means that you probably cannot do a call like the one below at all.
(I, at least, do not see how you could convert one of those transparent 
colours into an expr  argument)

> 
> SampleText ("Much Of This", transparent(1, .5, red  ) , transparent(1, .5, 
> green  )) ;

The situation may get even trickier because withtransparency() and
transparent() both use a  (text ) argument internally as well,
and I am not quite sure why.

At this point, I think you may need Hans for advice, sorry.

Taco

___
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] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Gerben Wierda
Thank you.


> On 9 Apr 2020, at 10:01, Taco Hoekwater  wrote:
> 
> Hi Gerben,
> 
> Changing the macro header to this will work:
> 
>   vardef SampleText (expr t)(text c) =
> 
> or you can use the answer from stackexchange, same approach.

> BTW Hans would like people to use “withtransparency” instead as that is a 
> newer, more flexible approach (but that would also need the above change,
> or a split into multiple parameters).

Oh, wait, I think I understand it. I would still do

vardef SampleText (expr t)(text c) =

and the call is SampleText( t, somecolor withtransparency sometransparency)

So, use withtrapsparency in the call?

I tried

\starttext
\startMPpage[instance=doublefun]

vardef SampleText (expr t)(text c)(text d) =
  save p ; picture p ;
  p := image (draw t infont "\truefontname{Regular}") ;
  draw (p shifted (- xpart center p,0)) scaled 5 withcolor c;
  draw (p shifted (- ypart center p,0)) scaled 5 withcolor d;
enddef;

SampleText ("Much Of This", transparent(1, .5, red  ) , transparent(1, .5, 
green  )) ;

\stopMPpage
\stoptext

But that does not work. Mmm. Maybe I need another approach to pass 4 values 
(r,g,b,t) as one parameter.

G 

> 
> Taco
> 
> 
>> On 9 Apr 2020, at 09:04, Gerben Wierda  wrote:
>> 
>> Nobody?
>> 
>>> On 8 Apr 2020, at 12:20, Gerben Wierda  wrote:
>>> 
>>> I would like to use the result of transparent() straight in my macros, so I 
>>> can pass the colors with transparency using a single parameter. That should 
>>> be possible if I understand the MetaFun manual (where I’ve copy-pasted this 
>>> example from):
>>> 
>>> \starttext
>>> \startMPpage[instance=doublefun]
>>> 
>>> vardef SampleText (expr t, c) =
>>>  save p ; picture p ;
>>>  p := image (draw t infont "\truefontname{Regular}") ;
>>>  draw (p shifted (- xpart center p,0)) scaled 5 withcolor c;
>>> enddef ;
>>> SampleText ("Much Of This"   , transparent(1, .5, red  )) ;
>>> SampleText ("Functionality"  , transparent(1, .5, green)) ;
>>> SampleText ("Was Written", transparent(1, .5, blue )) ;
>>> SampleText ("While Listening", transparent(1, .5, cmyk(1,0,0,0))) ;
>>> SampleText ("To the CD's Of" , transparent(1, .5, cmyk(0,1,0,0))) ;
>>> SampleText ("Tori Amos"  , transparent(1, .5, cmyk(0,0,1,0))) ;
>>> 
>>> \stopMPpage
>>> \stoptext
>>> 
>>> But it results in:
>>> 
>>> system  > files > jobname 'testcolor', input './testcolor', result 
>>> 'testcolor'
>>> fonts   > latin modern fonts are not preloaded
>>> languages   > language 'en' is active
>>> open source > level 2, order 3, name './testcolor.tex'
>>> fonts   > preloading latin modern fonts (second stage)
>>> fonts   > 'fallback modern-designsize rm 12pt' is loaded
>>> metapost> initializing instance 'doublefun:1' using format 
>>> 'metafun' and method 'double'
>>> metapost> loading 'metafun' as 
>>> '/usr/local/context-osx-64/tex/texmf-context/metapost/context/base/mpiv/metafun.mpxl'
>>>  using method 'double'
>>> metapost> initializing number mode 'double'
>>> metapost log> 
>>> metapost log> loading metafun, including plain.mp version 1.004 for 
>>> metafun iv and xl
>>> metapost log> 
>>> metapost log> ! Missing ')' has been inserted.
>>> metapost log>  
>>> metapost log>withprescript
>>> metapost log> transparent->(1)withprescript
>>> metapost log>  
>>> "tr_alternative="_alternat...
>>> metapost log> <*> ... ("Much Of This" , transparent(1, .5, red )
>>> metapost log>   ) ; 
>>> SampleText ("Functiona...
>>> metapost log> 
>>> backend > xmp > using file 
>>> '/usr/local/context-osx-64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
>>> pages   > flushing realpage 1, userpage 1, subpage 1
>>> close source> level 2, order 3, name './testcolor.tex'
>>> close source> level 1, order 3, name 'cont-yes.mkiv'
>>> 
>>> For me, it is not about passing colour on to ConTeXt to typeset text, these 
>>> are colors that normally would be drawn with “withcolor ca withtransparency 
>>> (method,factor)” but that requires the passing of many more parameters and 
>>> a lot more work in coding.
>>> 
>>> Does transparent() maybe produce a string that looks like “ca 
>>> withtransparency (method,factor)” so something only usable in draw/fill/etc 
>>> statements? But in that case how does that work without scantokens to parse 
>>> the string?
>>> 
>>> Is there a way I can do this without having twice the parameters (and I 
>>> have to pass multiple colours)  in my macros everywhere?
>>> 
>>> Thanks,
>>> 
>>> G
>>> ___
>>> 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 / 

Re: [NTG-context] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Taco Hoekwater
Hi Gerben,

Changing the macro header to this will work:

   vardef SampleText (expr t)(text c) =

or you can use the answer from stackexchange, same approach.

BTW Hans would like people to use “withtransparency” instead as that is a 
newer, more flexible approach (but that would also need the above change,
or a split into multiple parameters).

Taco


> On 9 Apr 2020, at 09:04, Gerben Wierda  wrote:
> 
> Nobody?
> 
>> On 8 Apr 2020, at 12:20, Gerben Wierda  wrote:
>> 
>> I would like to use the result of transparent() straight in my macros, so I 
>> can pass the colors with transparency using a single parameter. That should 
>> be possible if I understand the MetaFun manual (where I’ve copy-pasted this 
>> example from):
>> 
>> \starttext
>> \startMPpage[instance=doublefun]
>> 
>> vardef SampleText (expr t, c) =
>>   save p ; picture p ;
>>   p := image (draw t infont "\truefontname{Regular}") ;
>>   draw (p shifted (- xpart center p,0)) scaled 5 withcolor c;
>> enddef ;
>> SampleText ("Much Of This"   , transparent(1, .5, red  )) ;
>> SampleText ("Functionality"  , transparent(1, .5, green)) ;
>> SampleText ("Was Written", transparent(1, .5, blue )) ;
>> SampleText ("While Listening", transparent(1, .5, cmyk(1,0,0,0))) ;
>> SampleText ("To the CD's Of" , transparent(1, .5, cmyk(0,1,0,0))) ;
>> SampleText ("Tori Amos"  , transparent(1, .5, cmyk(0,0,1,0))) ;
>> 
>> \stopMPpage
>> \stoptext
>> 
>> But it results in:
>> 
>> system  > files > jobname 'testcolor', input './testcolor', result 
>> 'testcolor'
>> fonts   > latin modern fonts are not preloaded
>> languages   > language 'en' is active
>> open source > level 2, order 3, name './testcolor.tex'
>> fonts   > preloading latin modern fonts (second stage)
>> fonts   > 'fallback modern-designsize rm 12pt' is loaded
>> metapost> initializing instance 'doublefun:1' using format 'metafun' 
>> and method 'double'
>> metapost> loading 'metafun' as 
>> '/usr/local/context-osx-64/tex/texmf-context/metapost/context/base/mpiv/metafun.mpxl'
>>  using method 'double'
>> metapost> initializing number mode 'double'
>> metapost log> 
>> metapost log> loading metafun, including plain.mp version 1.004 for 
>> metafun iv and xl
>> metapost log> 
>> metapost log> ! Missing ')' has been inserted.
>> metapost log>  
>> metapost log>withprescript
>> metapost log> transparent->(1)withprescript
>> metapost log>  
>> "tr_alternative="_alternat...
>> metapost log> <*> ... ("Much Of This" , transparent(1, .5, red )
>> metapost log>   ) ; 
>> SampleText ("Functiona...
>> metapost log> 
>> backend > xmp > using file 
>> '/usr/local/context-osx-64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
>> pages   > flushing realpage 1, userpage 1, subpage 1
>> close source> level 2, order 3, name './testcolor.tex'
>> close source> level 1, order 3, name 'cont-yes.mkiv'
>> 
>> For me, it is not about passing colour on to ConTeXt to typeset text, these 
>> are colors that normally would be drawn with “withcolor ca withtransparency 
>> (method,factor)” but that requires the passing of many more parameters and a 
>> lot more work in coding.
>> 
>> Does transparent() maybe produce a string that looks like “ca 
>> withtransparency (method,factor)” so something only usable in draw/fill/etc 
>> statements? But in that case how does that work without scantokens to parse 
>> the string?
>> 
>> Is there a way I can do this without having twice the parameters (and I have 
>> to pass multiple colours)  in my macros everywhere?
>> 
>> Thanks,
>> 
>> G
>> ___
>> 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
> ___

Taco Hoekwater
Elvenkind BV




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

Re: [NTG-context] Why does this example from the MetaFun manual not work?

2020-04-09 Thread Gerben Wierda
Nobody?

> On 8 Apr 2020, at 12:20, Gerben Wierda  wrote:
> 
> I would like to use the result of transparent() straight in my macros, so I 
> can pass the colors with transparency using a single parameter. That should 
> be possible if I understand the MetaFun manual (where I’ve copy-pasted this 
> example from):
> 
> \starttext
> \startMPpage[instance=doublefun]
> 
> vardef SampleText (expr t, c) =
>   save p ; picture p ;
>   p := image (draw t infont "\truefontname{Regular}") ;
>   draw (p shifted (- xpart center p,0)) scaled 5 withcolor c;
> enddef ;
> SampleText ("Much Of This"   , transparent(1, .5, red  )) ;
> SampleText ("Functionality"  , transparent(1, .5, green)) ;
> SampleText ("Was Written", transparent(1, .5, blue )) ;
> SampleText ("While Listening", transparent(1, .5, cmyk(1,0,0,0))) ;
> SampleText ("To the CD's Of" , transparent(1, .5, cmyk(0,1,0,0))) ;
> SampleText ("Tori Amos"  , transparent(1, .5, cmyk(0,0,1,0))) ;
> 
> \stopMPpage
> \stoptext
> 
> But it results in:
> 
> system  > files > jobname 'testcolor', input './testcolor', result 
> 'testcolor'
> fonts   > latin modern fonts are not preloaded
> languages   > language 'en' is active
> open source > level 2, order 3, name './testcolor.tex'
> fonts   > preloading latin modern fonts (second stage)
> fonts   > 'fallback modern-designsize rm 12pt' is loaded
> metapost> initializing instance 'doublefun:1' using format 'metafun' 
> and method 'double'
> metapost> loading 'metafun' as 
> '/usr/local/context-osx-64/tex/texmf-context/metapost/context/base/mpiv/metafun.mpxl'
>  using method 'double'
> metapost> initializing number mode 'double'
> metapost log> 
> metapost log> loading metafun, including plain.mp version 1.004 for 
> metafun iv and xl
> metapost log> 
> metapost log> ! Missing ')' has been inserted.
> metapost log>  
> metapost log>withprescript
> metapost log> transparent->(1)withprescript
> metapost log>  
> "tr_alternative="_alternat...
> metapost log> <*> ... ("Much Of This" , transparent(1, .5, red )
> metapost log>   ) ; 
> SampleText ("Functiona...
> metapost log> 
> backend > xmp > using file 
> '/usr/local/context-osx-64/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
> pages   > flushing realpage 1, userpage 1, subpage 1
> close source> level 2, order 3, name './testcolor.tex'
> close source> level 1, order 3, name 'cont-yes.mkiv'
> 
> For me, it is not about passing colour on to ConTeXt to typeset text, these 
> are colors that normally would be drawn with “withcolor ca withtransparency 
> (method,factor)” but that requires the passing of many more parameters and a 
> lot more work in coding.
> 
> Does transparent() maybe produce a string that looks like “ca 
> withtransparency (method,factor)” so something only usable in draw/fill/etc 
> statements? But in that case how does that work without scantokens to parse 
> the string?
> 
> Is there a way I can do this without having twice the parameters (and I have 
> to pass multiple colours)  in my macros everywhere?
> 
> Thanks,
> 
> G
> ___
> 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
___