Re: [NTG-context] Unable to switch math fonts

2017-07-24 Thread Hans Hagen

On 7/24/2017 11:41 PM, Sebastian L. wrote:
Yes it helps, thanks; it explains why there was so little response to 
this. ;)
After some search I found regular style pictures of it. I was sure, that 
it was italic as standard, because that's what "modern" suggests: 
compability for current regulations (i.e. regular constants, italic 
variables) as well as an attractive style overall. But since Neo Euler 
seems to have no italic style, it is of no use for academic purposes, 
like in my case.


originally "euler" is a math companion font to "concrete" and it's not 
trivial to make en euler with all text styles (maybe some day the tex 
gyre project will give it a try) .. btw, the same is true for sans 
fonts: at some point one runs out of distinctive features


btw, it also fits with pagella (see type-imp-euler)

The story, to add to the subject of the mail, in case somebody searches 
the archive for this, is that I wasn't able to find out is how to change 
the math font only, as i like the standard font with 
\setupbodyfont[sans] as global setup but not the style of (non-modern) 
Euler.

I tried

\definefontfamily [mainface] [mm] [Xits Math]


most users who mess with fonts either use the selectfont mechanism or 
peek into the type-imp files to see how to set up a combination



but this changes the whole typeface; not what I want.
So the trick is to define the standard font for the rest of the font 
variations. The standard font can be found out with \showbodyfont. At 
least that's what it suggests. But it gives you "modern-design" as font. 
When you use this within \definefontfamily then it gives you nothing, 
because the real id of the standard font is "modern". So to change the 
math font only and keep the main font standard, you have to use this 
command group (just in case somebody looks for it):


\definefontfamily [mainface] [rm] [Modern] % = serif
\definefontfamily [mainface] [ss] [Modern] % = sans
\definefontfamily [mainface] [tt] [Modern] % = mono (teletype)
\definefontfamily [mainface] [mm] [Xits Math] [rscale=1.03] % = math

But as this seems to be so trivial, that few people care, I really have 
to wonder why people who test CTX criticise the lack of documentation. 
We (especially who haven't been through LaTeX or even TeX) seem to be a 
minority.


In what sense?

Anyway, there is quite some documentation (also about fonts) available 
(and the context distribution documentation section has examples).



Cheers and thanks, S.
On 23/07/2017 21:22, Pablo Rodriguez wrote:

On 07/22/2017 03:16 AM, Sebastian L. wrote:

Hi, I have trouble with Neo Euler font after playing around with those
options.
[...]
I am pretty sure that before I started mixing the fonts in one single
document, Neo Euler was italic.

Does anybody have a clue what might have went wrong?

Hi Sebastian,

as far as I remember, Neo Euler is a regular font only
(https://github.com/khaledhosny/euler-otf).

Euler is an italic font and it might have the other regular, bold, bold
italic typefaces (I don’t know).

I hope it helps,

Pablo




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

Re: [NTG-context] Unable to switch math fonts

2017-07-24 Thread Sebastian L.
Yes it helps, thanks; it explains why there was so little response to 
this. ;)
After some search I found regular style pictures of it. I was sure, that 
it was italic as standard, because that's what "modern" suggests: 
compability for current regulations (i.e. regular constants, italic 
variables) as well as an attractive style overall. But since Neo Euler 
seems to have no italic style, it is of no use for academic purposes, 
like in my case.


The story, to add to the subject of the mail, in case somebody searches 
the archive for this, is that I wasn't able to find out is how to change 
the math font only, as i like the standard font with 
\setupbodyfont[sans] as global setup but not the style of (non-modern) 
Euler.

I tried

\definefontfamily [mainface] [mm] [Xits Math]

but this changes the whole typeface; not what I want.
So the trick is to define the standard font for the rest of the font 
variations. The standard font can be found out with \showbodyfont. At 
least that's what it suggests. But it gives you "modern-design" as font. 
When you use this within \definefontfamily then it gives you nothing, 
because the real id of the standard font is "modern". So to change the 
math font only and keep the main font standard, you have to use this 
command group (just in case somebody looks for it):


\definefontfamily [mainface] [rm] [Modern] % = serif
\definefontfamily [mainface] [ss] [Modern] % = sans
\definefontfamily [mainface] [tt] [Modern] % = mono (teletype)
\definefontfamily [mainface] [mm] [Xits Math] [rscale=1.03] % = math

But as this seems to be so trivial, that few people care, I really have 
to wonder why people who test CTX criticise the lack of documentation. 
We (especially who haven't been through LaTeX or even TeX) seem to be a 
minority.


Cheers and thanks, S.
On 23/07/2017 21:22, Pablo Rodriguez wrote:

On 07/22/2017 03:16 AM, Sebastian L. wrote:

Hi, I have trouble with Neo Euler font after playing around with those
options.
[...]
I am pretty sure that before I started mixing the fonts in one single
document, Neo Euler was italic.

Does anybody have a clue what might have went wrong?

Hi Sebastian,

as far as I remember, Neo Euler is a regular font only
(https://github.com/khaledhosny/euler-otf).

Euler is an italic font and it might have the other regular, bold, bold
italic typefaces (I don’t know).

I hope it helps,

Pablo


___
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] Bug in wiki \doifsamestringselse vs \doifsamestringelse

2017-07-24 Thread Henri
On Mon, 2017-07-24 at 16:54 +, Jaroslav Hajtmar wrote:
> Hello ConTeXist
>  
> I add wiki information. In wiki on page 
> http://wiki.contextgarden.net/System_Macros/Branches_and_D
> ecisions is bug (I think) in caption 
> \doifsamestringselse,\doifsamestring,\doifnotsamestring.
>  
> Right information is \doifsamestringelse,\doifsamestring,\doifnotsamestring 
> (without s in first
> keyword).
> Macro \doifsamestringselse not work.
>  
> Is there anybody, that fix this bug?

It's just a simple typo.  I fixed it for you.  You can also fix things like 
this yourself by making
an account on the wiki and editing the page.

>  
> Jaroslav Hajtmar
>  
>  
>  
> ___
> 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] handling code in XML

2017-07-24 Thread Pablo Rodriguez
On 07/24/2017 10:48 AM, Hans Hagen wrote:
> On 7/23/2017 9:28 PM, Pablo Rodriguez wrote:
>> [...]
>> Which is the way to get this expanded \xmlprettyprint?
> The xml that we see is getting more weird every day .. anyway
> 
> \startluacode
> 
>  function lxml.tobufferX(id,pattern,name)
>  local collected = xml.applylpath(lxml.getid(id),pattern)
>  if collected then
>  local t = { }
>  xml.string(collected[1],function(s) t[#t+1] = s end)
>  buffers.assign(name,table.concat(t))
>  else
>  buffers.erase(name)
>  end
>  end
> 
> \stopluacode
> 
> \unprotect
> 
>  \unexpanded\def\xmlprettyprinttext#1#2%
>{\ctxlua{lxml.tobufferX("#1",".","xml-temp")}%
> \ifdefined\scitebuffer
>   \scitebuffer[#2][xml-temp]%
> \else
>   \typebuffer[xml-temp][\c!option=#2]%
> \fi}
> 
> \protect
> 
> I'll add \xmlprettyprinttext to the core (somewhat different 
> implementation) [...]

Many thanks for your reply and the new \xmlprettyprinttext, Hans.

Yesterday, I totally forgot about inline code, such as in the sample below.

Which would be the \xmlprettyprinttext command for inline code?

\startluacode
 function lxml.tobufferX(id,pattern,name)
 local collected = xml.applylpath(lxml.getid(id),pattern)
 if collected then
 local t = { }
 xml.string(collected[1],function(s) t[#t+1] = s end)
 buffers.assign(name,table.concat(t))
 else
 buffers.erase(name)
 end
 end
\stopluacode

\unprotect

 \unexpanded\def\xmlprettyprinttext#1#2%
   {\ctxlua{lxml.tobufferX("#1",".","xml-temp")}%
\ifdefined\scitebuffer
  \scitebuffer[#2][xml-temp]%
\else
  \typebuffer[xml-temp][\c!option=#2]%
\fi}

\protect

\startbuffer[demo]


\command[option=value]{text "<&}


This is inline code \command[option=value]{text "<&}.

\stopbuffer

\startxmlsetups xml:initialize
\xmlsetsetup{#1}{doc|source|div}{xml:*}
\xmlsetsetup{#1}
{code[contains(@class,'latex')]}
{xml:code}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

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

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

\startxmlsetups xml:source
\xmlprettyprint{#1}{tex}
\stopxmlsetups

\startxmlsetups xml:code
\xmlprettyprinttext{#1}{tex}
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{demo}{}
\stoptext

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] Metafun: setting pen size in properties

2017-07-24 Thread Alan Braslau
On Mon, 24 Jul 2017 10:26:25 +0200
Hans Hagen  wrote:

> On 7/24/2017 1:40 AM, Aditya Mahajan wrote:
> > Hi,
> > 
> > Is it possible to set pen width using properties(...)? The
> > following does not work (the color is set, but not the pen width):
> > 
> > \starttext
> > \startMPcode
> > property p[] ;
> > p[1] := properties(withcolor red  withpen pencircle scaled 1bp);
> > p[2] := properties(withcolor blue withpen pencircle scaled 10bp);
> > 
> > draw fullcircle scaled 1cm withproperties p[1];
> > draw fullcircle scaled 2cm withproperties p[2];
> > \stopMPcode
> > \stoptext  
> 
> def withproperties expr p =
>  if colormodel p = 3 :
>  withcolor greypart p
>  elseif colormodel p = 5 :
>  withcolor (redpart p,greenpart p,bluepart p)
>  elseif colormodel p = 7 :
>  withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p)
>  fi
>  withpen penpart p

   if dashpart p <> nullpicture :
 dashed dashpart p
   fi

>  withprescript prescriptpart p
>  withpostscript postscriptpart p
> enddef ;
> 
> 
> 
> > Also, what is the advantage of using properties over a simple def? 
> > (except that I cannot def a suffixed variable). For example:
> > 
> > \starttext
> > \startMPcode
> > def qA = withcolor red  withpen pencircle scaled 1bp enddef;
> > def qB = withcolor blue withpen pencircle scaled 10bp enddef;
> > 
> > draw fullcircle scaled 1cm qA;
> > draw fullcircle scaled 2cm qB;
> > 
> > \stopMPcode
> > \stoptext  
> abstraction ..
> 
> -
>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
> ___
___
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] Bug in wiki \doifsamestringselse vs \doifsamestringelse

2017-07-24 Thread Jaroslav Hajtmar
Hello ConTeXist

I add wiki information. In wiki on page 
http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions is bug (I 
think) in caption \doifsamestringselse,\doifsamestring,\doifnotsamestring.

Right information is \doifsamestringelse,\doifsamestring,\doifnotsamestring 
(without s in first keyword).
Macro \doifsamestringselse not work.

Is there anybody, that fix this bug?

Jaroslav Hajtmar



___
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] Hyphens missing (again) with setupbackend[export

2017-07-24 Thread Hans Hagen

On 7/24/2017 1:54 PM, Rik wrote:

On 2017-07-24 05:51, Hans Hagen wrote:

On 7/24/2017 3:51 AM, Rik Kabel wrote:
Aditya came across this in 2011 ([NTG-context] export kills hyphen 
symbol 
)[1] 
with the Fontin font. It wasn’t answered then. It is back if it ever 
left.


Here is an example:

\definefontfamily
 [TestFont]
 [rm]
 [Antykwa Torunska Cond]
\setupbodyfont
 [TestFont]
\setupbackend
 [export=maybe]% or yes, or no, or ...
\setuppapersize
 [A7]
\starttext
\input ward
\stoptext

If the \setupbackend statement is removed, or an invalid key is used, 
all is well. It fails with a valid key and any value for that key.


I am experiencing the problem of missing hyphens with this font even 
without \setupbackend, but cannot yet construct a working example.

wipe your font cache, add this to the top of your file

\enabledirectives[otf.checksofthyphen]


Thank you. That resolves it.

Is this an issue for all fonts that are missing a soft hyphen glyph at 
x00A0?

yes but most have it

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] dead link in wiki

2017-07-24 Thread Taco Hoekwater
Hi,

Fixed the links, thank you.

> On 24 Jul 2017, at 13:52, Damien Thiriet  wrote:
> 
> Hi,
> 
> 
> There may be an error in contextgarden's link to NTG MAPS "search the
> articles" link. It points to http://www.ntg.nl/maps/search.html which
> seems to be a dead link.
> I could reach the english version typing 
> http://www.ntg.nl/maps/mapssearch-en.html 
> The proper link for dutch version is 
> http://www.ntg.nl/maps/mapssearch-nl.html.
> 
> Best regards,
> 
> 
> Damien Thiriet
> ___
> 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 
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] Hyphens missing (again) with setupbackend[export

2017-07-24 Thread Rik

On 2017-07-24 05:51, Hans Hagen wrote:

On 7/24/2017 3:51 AM, Rik Kabel wrote:
Aditya came across this in 2011 ([NTG-context] export kills hyphen 
symbol 
)[1] 
with the Fontin font. It wasn’t answered then. It is back if it ever 
left.


Here is an example:

\definefontfamily
 [TestFont]
 [rm]
 [Antykwa Torunska Cond]
\setupbodyfont
 [TestFont]
\setupbackend
 [export=maybe]% or yes, or no, or ...
\setuppapersize
 [A7]
\starttext
\input ward
\stoptext

If the \setupbackend statement is removed, or an invalid key is used, 
all is well. It fails with a valid key and any value for that key.


I am experiencing the problem of missing hyphens with this font even 
without \setupbackend, but cannot yet construct a working example.

wipe your font cache, add this to the top of your file

\enabledirectives[otf.checksofthyphen]


Thank you. That resolves it.

Is this an issue for all fonts that are missing a soft hyphen glyph at 
x00A0?


--
Rik
___
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] dead link in wiki

2017-07-24 Thread Damien Thiriet
Hi,


There may be an error in contextgarden's link to NTG MAPS "search the
articles" link. It points to http://www.ntg.nl/maps/search.html which
seems to be a dead link.
I could reach the english version typing 
http://www.ntg.nl/maps/mapssearch-en.html 
The proper link for dutch version is http://www.ntg.nl/maps/mapssearch-nl.html.

Best regards,


Damien Thiriet
___
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] Hyphens missing (again) with setupbackend[export

2017-07-24 Thread Hans Hagen

On 7/24/2017 3:51 AM, Rik Kabel wrote:
Aditya came across this in 2011 ([NTG-context] export kills hyphen 
symbol 
)[1] with 
the Fontin font. It wasn’t answered then. It is back if it ever left.


Here is an example:

\definefontfamily
 [TestFont]
 [rm]
 [Antykwa Torunska Cond]
\setupbodyfont
 [TestFont]
\setupbackend
 [export=maybe]% or yes, or no, or ...
\setuppapersize
 [A7]
\starttext
\input ward
\stoptext

If the \setupbackend statement is removed, or an invalid key is used, 
all is well. It fails with a valid key and any value for that key.


I am experiencing the problem of missing hyphens with this font even 
without \setupbackend, but cannot yet construct a working example.

wipe your font cache, add this to the top of your file

\enabledirectives[otf.checksofthyphen]




-
  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] handling code in XML

2017-07-24 Thread Hans Hagen

On 7/23/2017 9:28 PM, Pablo Rodriguez wrote:

 \xmlsetsetup{#1}{doc|source|div|span}{xml:*}

also use #1 here:

 \xmlsetsetup{\xmldocument}

>  \xmlsetsetup{#1}

-
  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] handling code in XML

2017-07-24 Thread Hans Hagen

On 7/23/2017 9:28 PM, Pablo Rodriguez wrote:

Hans,

I have the following sample:

 \startbuffer[demo]
 
 
 \command[option=value]{text "<&>"}
 

 
 
 
 \command[option=value]{text
"<&>"}
 
 
 
 
 \stopbuffer

 \startxmlsetups xml:initialize
 \xmlsetsetup{#1}{doc|source|div|span}{xml:*}
 \xmlsetsetup{\xmldocument}
 {pre[contains(@class,'sourceCode')]/
 code[contains(@class,'sourceCode')]}
 {xml:pre:code}
 \stopxmlsetups

 \xmlregistersetup{xml:initialize}

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

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

 \startxmlsetups xml:source
 \xmlprettyprint{#1}{tex}
 \stopxmlsetups

 \startxmlsetups xml:pre:code
 \xmlflushspacewise{#1}
 \stopxmlsetups

 \startxmlsetups xml:span
 \bgroup\xmlflush{#1}\egroup
 \stopxmlsetups

The .sourceCode elements are the standard way in which pandoc serves
colored code. I have to deal with them.

In the sample above, for xml:pre:code, I would need and expanded
\xmlprettyprint that also ignores tags inside (anything between < and >,
but not the entities).

Which is the way to get this expanded \xmlprettyprint?

The xml that we see is getting more weird every day .. anyway

\startluacode

function lxml.tobufferX(id,pattern,name)
local collected = xml.applylpath(lxml.getid(id),pattern)
if collected then
local t = { }
xml.string(collected[1],function(s) t[#t+1] = s end)
buffers.assign(name,table.concat(t))
else
buffers.erase(name)
end
end

\stopluacode

\unprotect

\unexpanded\def\xmlprettyprinttext#1#2%
  {\ctxlua{lxml.tobufferX("#1",".","xml-temp")}%
   \ifdefined\scitebuffer
 \scitebuffer[#2][xml-temp]%
   \else
 \typebuffer[xml-temp][\c!option=#2]%
   \fi}

\protect

I'll add \xmlprettyprinttext to the core (somewhat different 
implementation) so that you can do


\startxmlsetups xml:source
\xmlprettyprinttext{#1}{tex}
\stopxmlsetups

\startxmlsetups xml:pre:code
\xmlprettyprinttext{#1}{tex}
\stopxmlsetups


-
  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] Metafun: setting pen size in properties

2017-07-24 Thread Hans Hagen

On 7/24/2017 1:40 AM, Aditya Mahajan wrote:

Hi,

Is it possible to set pen width using properties(...)? The following 
does not work (the color is set, but not the pen width):


\starttext
\startMPcode
property p[] ;
p[1] := properties(withcolor red  withpen pencircle scaled 1bp);
p[2] := properties(withcolor blue withpen pencircle scaled 10bp);

draw fullcircle scaled 1cm withproperties p[1];
draw fullcircle scaled 2cm withproperties p[2];
\stopMPcode
\stoptext


def withproperties expr p =
if colormodel p = 3 :
withcolor greypart p
elseif colormodel p = 5 :
withcolor (redpart p,greenpart p,bluepart p)
elseif colormodel p = 7 :
withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p)
fi
withpen penpart p
withprescript prescriptpart p
withpostscript postscriptpart p
enddef ;



Also, what is the advantage of using properties over a simple def? 
(except that I cannot def a suffixed variable). For example:


\starttext
\startMPcode
def qA = withcolor red  withpen pencircle scaled 1bp enddef;
def qB = withcolor blue withpen pencircle scaled 10bp enddef;

draw fullcircle scaled 1cm qA;
draw fullcircle scaled 2cm qB;

\stopMPcode
\stoptext

abstraction ..

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