Re: [NTG-context] Asymptote in Context

2014-12-28 Thread Mojca Miklavec
Dear Aditya,

On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote:
 On Wed, 24 Dec 2014, Context NTG wrote:

 Could anybody explain how to use Asymptote in ConTeXt with the filter
 module.

 Can you post a minimal asymptote file and how it shoud be processed via the
 command line?

I have no time to create a nice minimal example, but here's an ugly
non-minimal example which should at least enable you to test the
interaction with the filter module.

I also added one ConTeXt-specific command while trying to make math
fonts work properly, just replace lucidaot with another font in case
you don't have that one installed.

You can run the example with
asy -tex context cylinder.asy

(Maybe it's possible to set the tex engine inside the file as well.)


Bonus points if you can get PRC to work properly before TL 2015. Or if
you can make the file print properly from OS X without using Acrobat
or ghostscript/CUPS. Preview.app forgets to print the (smoothly
shaded) cylinder for example.

Mojca


cylinder.asy
Description: Binary data


cylinder.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Define a new type section with metafun

2014-12-28 Thread Fabrice

Thank you to Akira and Hans for these solutions.
How do now to the numbering and the title text are equidistant from the 
red line separation ?

Fabrice
___
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] fluctuating baseline of header text

2014-12-28 Thread j. van den hoff

On Sun, 28 Dec 2014 00:45:32 +0100, Hans Hagen pra...@wxs.nl wrote:


-- could such behaviour be achieved presently with some clever trick?

 \showstruts
 \setuppagenumbering[style=\bfd\setcharstrut{0123456789}\strut,strut=no]
 - no default strut
- calculate one based on to-be-used-characters (tight case)
- apply that one

 compare it with
 \setuppagenumbering[style=\bfd\setstrut\strut]



thanks a lot. that indeed fixes it.


 And then wikify it


can do. although things are not yet 100% clear to me (not much to be found  
in the documentation). so is this right:


-- I guess `\setstrut\strut' does set the strut to the maximum height of  
all the glyphs in the used font? the explanation in 4.6 of the ref. manual  
is not really telling me how the box height in the example comes about  
(i.e. what the mentioned `maximal height' actually is).


-- `\setcharstrut{0123456789}': the command seems to be completely  
undocumented (I could not find it in wiki and ref. manual), but it seems  
clear what it does. except what do you mean by tight case here?


-- why is it necessary to state `strut=no' to switch of the default on top  
of setting the strut explicitly?


joerg


 Hans




--
Using Opera's revolutionary email client: http://www.opera.com/mail/
___
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] handling HTML notes in ConTeXt

2014-12-28 Thread Pablo Rodriguez
Dear list,

I would like to be able to parse HTML output from pandoc with ConTeXt
XML parser (or whichever the right name is).

The only issue I cannot solve are footnotes. From markdown:

Text^[A footnote.]

pandoc parses into HTML as:

pTexta href=#fn1 class=footnoteRef
id=fnref1sup1/sup/a/p
div class=footnotes
hr /
ol
li id=fn1pA footnote.a href=#fnref1↩/a/p/li
/ol
/div

Is there a way that the environment file can make a footnote of this?

Sorry for the question, but I’m totally lost at this.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Define a new type section with metafun

2014-12-28 Thread Fabrice
Another worry: when the title is too long, there is a line break, which 
is normal, but what follows is under the dial.

Thanks,
Fabrice

% macros=mkvi
\setuppapersize[A4][A4]

\setuphead
[section]
[sectionstopper={},
conversion=Characters,
sectionsegments=section:section]

\setuphead
[subsection]
[sectionstopper={},
sectionsegments=subsection:subsection,
conversion=number,]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
 numeric h ; h := OverlayHeight ;
 pathp ; p := unitsquare xscaled \overlaywidth yscaled
\overlayheight superellipsed 0.9 ;
 pickup pencircle scaled \overlaylinewidth ;
 fill p withcolor \MPcolor{\overlaycolor} ;
 draw (20,-1)--(20,h+1) withcolor red ;
 clip currentpicture to p ;
 draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
   {\framed
  [background=funny,
   frame=off,
   width=fit,
   align={right},
   framecolor=mycolor,
   rulethickness=1.5pt,
   backgroundcolor=white,
   offset=6pt]
  {#1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{REPRÉSENTATION EN PERSPECTIVE CAVALIÈRE ET RÈGLES DE BASE}
\subsection{Représentation en perspective cavalière de solides}
___
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] OT: Asymptote in Context

2014-12-28 Thread Alan BRASLAU
Sorry, but I fail to see what the 3D aspect of this drawing brings to
anything, other than to impress the gallery and look spiffy.

I guess that we belong now to a society without any imagination,
requiring lots of colors, shadowing (and even animation) in order to
get an idea across...

(At least make use of the third dimension to describe SOMETHING if you
are going to include it.)


Alan
(who is being chastised by Hans for attempting to plot 100k data
points.)


P.S. the green y-axis looks really odd in your example.


On Sun, 28 Dec 2014 12:04:55 +0100
Mojca Miklavec mojca.miklavec.li...@gmail.com wrote:

 Dear Aditya,
 
 On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote:
  On Wed, 24 Dec 2014, Context NTG wrote:
 
  Could anybody explain how to use Asymptote in ConTeXt with the
  filter module.
 
  Can you post a minimal asymptote file and how it shoud be processed
  via the command line?
 
 I have no time to create a nice minimal example, but here's an ugly
 non-minimal example which should at least enable you to test the
 interaction with the filter module.
 
 I also added one ConTeXt-specific command while trying to make math
 fonts work properly, just replace lucidaot with another font in case
 you don't have that one installed.
 
 You can run the example with
 asy -tex context cylinder.asy
 
 (Maybe it's possible to set the tex engine inside the file as well.)
 
 
 Bonus points if you can get PRC to work properly before TL 2015. Or if
 you can make the file print properly from OS X without using Acrobat
 or ghostscript/CUPS. Preview.app forgets to print the (smoothly
 shaded) cylinder for example.
 
 Mojca
___
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] OT: Asymptote in Context

2014-12-28 Thread luigi scarso
On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU alan.bras...@cea.fr wrote:

 Sorry, but I fail to see what the 3D aspect of this drawing brings to
 anything, other than to impress the gallery and look spiffy.

 I guess that we belong now to a society without any imagination,
 requiring lots of colors, shadowing (and even animation) in order to
 get an idea across...

 (At least make use of the third dimension to describe SOMETHING if you
 are going to include it.)


 http://www.pdf3d.com/gallery.php
shows  other examples


-- 
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] Define a new type section with metafun

2014-12-28 Thread Hans Hagen

On 12/28/2014 1:00 PM, Fabrice wrote:


align={right},


align={flushright,lohi}

-
  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 HTML notes in ConTeXt

2014-12-28 Thread Hans Hagen

On 12/28/2014 12:55 PM, Pablo Rodriguez wrote:

Dear list,

I would like to be able to parse HTML output from pandoc with ConTeXt
XML parser (or whichever the right name is).

The only issue I cannot solve are footnotes. From markdown:

 Text^[A footnote.]

pandoc parses into HTML as:

 pTexta href=#fn1 class=footnoteRef
 id=fnref1sup1/sup/a/p
 div class=footnotes
 hr /
 ol
 li id=fn1pA footnote.a href=#fnref1↩/a/p/li
 /ol
 /div

Is there a way that the environment file can make a footnote of this?

Sorry for the question, but I’m totally lost at this.


\startbuffer[demo]
doc
pText
a href=#fn1 class=footnoteRef id=fnref1sup1/sup/a and
a href=#fn2 class=footnoteRef id=fnref2sup2/sup/a
/p
div class=footnotes
hr /
ol
li id=fn1pA footnote.a href=#fnref1↩/a/p/li
li id=fn2pA second footnote.a 
href=#fnref2↩/a/p/li

/ol
/div
/doc
\stopbuffer

\starttext

% variant 1:

\startxmlsetups xml:initialize
\xmlsetsetup{#1}{p|doc}{xml:*}
\xmlsetsetup{#1}{a[@class='footnoteRef']}{xml:footnote}
\xmlsetsetup{#1}{div[@class='footnotes']}{xml:nothing}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

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

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

\startxmlsetups xml:footnote

(1)\footnote{\xmlfirst{main}{div[@class='footnotes']/ol/li[@id=string.sub('\xmlatt{#1}{href}',2)]}}
\stopxmlsetups

\startxmlsetups xml:initialize
\xmlsetsetup{#1}{p|doc}{xml:*}
\xmlsetsetup{#1}{a[@class='footnoteRef']}{xml:footnote}
\xmlfilter{#1}{div[@class='footnotes']/ol/li/command(xml:collectnotes)}
\xmlsetsetup{#1}{div[@class='footnotes']}{}
\stopxmlsetups

\xmlregistersetup{xml:initialize}

\xmlprocessbuffer{main}{demo}{}

% variant 2:

\startxmlsetups xml:doc
variant 2:
\blank
\xmlflush{#1}
\blank
\stopxmlsetups

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

\startluacode
userdata.notes =  {}
\stopluacode

\startxmlsetups xml:collectnotes
\ctxlua{userdata.notes['\letterhash\xmlatt{#1}{id}'] = '#1'}
\stopxmlsetups

\startxmlsetups xml:footnote

(2)\footnote{\xmlflush{\cldcontext{userdata.notes['\xmlatt{#1}{href}']}}}
\stopxmlsetups

\xmlprocessbuffer{main}{demo}{}

\stoptext


-
  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] fluctuating baseline of header text

2014-12-28 Thread Hans Hagen

On 12/28/2014 12:39 PM, j. van den hoff wrote:

On Sun, 28 Dec 2014 00:45:32 +0100, Hans Hagen pra...@wxs.nl wrote:


-- could such behaviour be achieved presently with some clever trick?

 \showstruts
 \setuppagenumbering[style=\bfd\setcharstrut{0123456789}\strut,strut=no]
 - no default strut
- calculate one based on to-be-used-characters (tight case)
- apply that one

 compare it with
 \setuppagenumbering[style=\bfd\setstrut\strut]



thanks a lot. that indeed fixes it.


 And then wikify it


can do. although things are not yet 100% clear to me (not much to be
found in the documentation). so is this right:

-- I guess `\setstrut\strut' does set the strut to the maximum height of
all the glyphs in the used font? the explanation in 4.6 of the ref.
manual is not really telling me how the box height in the example comes
about (i.e. what the mentioned `maximal height' actually is).


\setstrut: ht and dp according to settings of lineheight which relates 
to the x height (font property)



-- `\setcharstrut{0123456789}': the command seems to be completely
undocumented (I could not find it in wiki and ref. manual), but it seems
clear what it does. except what do you mean by tight case here?


set the strut to match the given set of characters


-- why is it necessary to state `strut=no' to switch of the default on
top of setting the strut explicitly?


just try it ... i assume you don't want too much depth

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] fluctuating baseline of header text

2014-12-28 Thread j. van den hoff

On Sun, 28 Dec 2014 18:55:15 +0100, Hans Hagen pra...@wxs.nl wrote:


set the strut to match the given set of characters


so, I've tried to add a description to the wiki:

http://wiki.contextgarden.net/Command/setcharstrut

I'd appreciate if you would double-check and correct any  
errors/misconceptions.


joerg


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
___
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] OT: Asymptote in Context

2014-12-28 Thread Mojca Miklavec
On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU wrote:
 Sorry, but I fail to see what the 3D aspect of this drawing brings to
 anything, other than to impress the gallery and look spiffy.

Just to make it clear: this wasn't an example for the gallery, but
more or less the only asymptote example on my hard drive (excluding
examples from the manual), just to help Aditya and Jeroen play with
something.

 I guess that we belong now to a society without any imagination,
 requiring lots of colors, shadowing (and even animation) in order to
 get an idea across...

Well, if you want to be a purist: why do you need figures at all? One
can easily represent all the data in tables and describe images like
this one in pure mathematical formulation.

 P.S. the green y-axis looks really odd in your example.

I know, but I don't know the reason for that weirdness. I added the
axis just because I kept forgetting orientation of axes – the axes
themselves weren't part of the drawing, so I didn't try to search for
solution to make it look better.

Mojca
___
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 HTML notes in ConTeXt

2014-12-28 Thread Pablo Rodriguez
Hans,

many thanks for your sample.

It is really amazing.


Pablo


On 12/28/2014 06:53 PM, Hans Hagen wrote:
 \startbuffer[demo]
 doc
  pText
  a href=#fn1 class=footnoteRef id=fnref1sup1/sup/a and
  a href=#fn2 class=footnoteRef id=fnref2sup2/sup/a
  /p
  div class=footnotes
  hr /
  ol
  li id=fn1pA footnote.a href=#fnref1↩/a/p/li
  li id=fn2pA second footnote.a 
 href=#fnref2↩/a/p/li
  /ol
  /div
 /doc
 \stopbuffer
 
 \starttext
 
 % variant 1:
 
 \startxmlsetups xml:initialize
  \xmlsetsetup{#1}{p|doc}{xml:*}
  \xmlsetsetup{#1}{a[@class='footnoteRef']}{xml:footnote}
  \xmlsetsetup{#1}{div[@class='footnotes']}{xml:nothing}
 \stopxmlsetups
 
 \xmlregistersetup{xml:initialize}
 
 \startxmlsetups xml:doc
  variant 1:
  \blank
  \xmlflush{#1}
  \blank
 \stopxmlsetups
 
 \startxmlsetups xml:p
  \xmlflush{#1}
 \stopxmlsetups
 
 \startxmlsetups xml:footnote
  
 (1)\footnote{\xmlfirst{main}{div[@class='footnotes']/ol/li[@id=string.sub('\xmlatt{#1}{href}',2)]}}
 \stopxmlsetups
 
 \startxmlsetups xml:initialize
  \xmlsetsetup{#1}{p|doc}{xml:*}
  \xmlsetsetup{#1}{a[@class='footnoteRef']}{xml:footnote}
  \xmlfilter{#1}{div[@class='footnotes']/ol/li/command(xml:collectnotes)}
  \xmlsetsetup{#1}{div[@class='footnotes']}{}
 \stopxmlsetups
 
 \xmlregistersetup{xml:initialize}
 
 \xmlprocessbuffer{main}{demo}{}
 
 % variant 2:
 
 \startxmlsetups xml:doc
  variant 2:
  \blank
  \xmlflush{#1}
  \blank
 \stopxmlsetups
 
 \startxmlsetups xml:p
  \xmlflush{#1}
 \stopxmlsetups
 
 \startluacode
  userdata.notes =  {}
 \stopluacode
 
 \startxmlsetups xml:collectnotes
  \ctxlua{userdata.notes['\letterhash\xmlatt{#1}{id}'] = '#1'}
 \stopxmlsetups
 
 \startxmlsetups xml:footnote
  
 (2)\footnote{\xmlflush{\cldcontext{userdata.notes['\xmlatt{#1}{href}']}}}
 \stopxmlsetups
 
 \xmlprocessbuffer{main}{demo}{}
 
 \stoptext


-- 
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___