[NTG-context] special buttons in interactions (AcroJS)

2019-10-04 Thread Pablo Rodriguez
Dear list,

on http://www.pragma-ade.com/general/manuals/interaction.pdf#page=40, it
is announced that there are buttons that change once clicked (using
AcroJS, I guess).

There are to be explained on chapter “13. Widgets“
(www.pragma-ade.com/general/manuals/interaction.pdf#page=46), but it has
to be composed yet.

If I have the following two buttons:

\goto{0}[JS(Play{})]%
\goto{1}[JS(Pause{})]%

How could I merge them into one, so that pressing on it switches between
0 and 1?

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] new (lmtx) beta

2019-10-04 Thread Mikael P. Sundqvist
On Fri, Oct 4, 2019 at 6:11 PM Hans Hagen  wrote:

> Hi,
>
> I uploaded a new lmtx beta. Again some more metafun trickery (see
> luametafun manual). I attached an (lmtx only) example of some experiment
> code, dedicated to Alan Braslau (teacher among other things).
>
> 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
>
> ___
>


Hi,

I read the new manual with a great joy! This is really nice improvements of
MetaFun! I also like the 3D plots!

I had the possibility to try out some contour graphics on a freshly updated
system. I have two questions:

1) I think the first (blue) plot looks fine and it looks like it could be
the same curve as the blue one in the Mathematica plot (page 3). Why does
my second example (orange) not match with the result from Mathematica
(orange)? (I think I do something wrong)
2) Is there a way to combine the two contour plots in one MetaFun drawing?
If I add them both to the same, only the last one shows. If I try
functions={"-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4","-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5"}
it does not show both either.

/Mikael

Test document (output was too big to attach (sorry if it came through to
someone), so I put it at http://www.maths.lth.se/~mickep/polynomnoll.pdf )

\starttext
\startMPpage[offset=3bp,instance=doublefun]
draw lmt_contour [
xmin=-5,
xmax=5,
ymin=-5,
ymax=5,
xstep=0.01,
ystep=0.01,
range={0},
levels=1,
function="-4+x^2+x^5+15*y-y^2-10*x^3*y^2+5*x*y^4",
linecolor="darkblue",
linewidth=1,
legend=false,
cache=true,
]  xsized 10cm ;
\stopMPpage

\startMPpage[offset=3bp,instance=doublefun]
draw lmt_contour [
xmin=-5,
xmax=5,
ymin=-5,
ymax=5,
xstep=0.01,
ystep=0.01,
range={0},
levels=1,
function="-15*x+2*x*y+5*x^4*y-10*x^2*y^3+y^5",
linecolor="orange",
linewidth=1,
legend=false,
cache=true,
]  xsized 10cm ;
\stopMPpage

\startbuffer[mmainput]
ContourPlot[
 {-4+x^2+x^5+15y-y^2-10x^3y^2+5x*y^4 == 0,
  -15x+2x*y+5*x^4*y-10x^2*y^3+y^5 == 0},
  {x, -5, 5}, {y, -5, 5}, Frame -> False]
\stopbuffer
\startTEXpage[offset=2bp]
\typebuffer[mmainput]

\externalfigure[mathematicaplot][width=10cm]
\stopTEXpage
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] new (lmtx) beta

2019-10-04 Thread Hans Hagen

Hi,

I uploaded a new lmtx beta. Again some more metafun trickery (see 
luametafun manual). I attached an (lmtx only) example of some experiment 
code, dedicated to Alan Braslau (teacher among other things).


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
-


kindergarten.pdf
Description: Adobe PDF document
\startMPcalculation{simplefun}

pen KindergartenPen ; KindergartenPen := pencircle scaled 1 ;

% 10 x 10 grid

vardef KindergartenEqual =
draw image
(
draw (2,6) -- (9,5) ;
draw (2,4) -- (8,3) ;
)
shifted (0,-2)
withpen KindergartenPen
withcolor "KindergartenEqual"
enddef ;
vardef KindergartenPlus =
draw image
(
draw (1,4) -- (9,5) ;
draw (4,1) -- (5,8) ;
)
shifted (0,-2)
withpen KindergartenPen
withcolor "KindergartenPlus"
enddef ;
vardef KindergartenMinus =
draw image
(
draw (1,5) -- (9,4) ;
)
shifted (0,-2)
withpen KindergartenPen
withcolor "KindergartenMinus"
enddef ;
vardef KindergartenTimes =
draw image
(
draw (2,1) -- (9,8) ;
draw (8,1) -- (2,8) ;
)
shifted (0,-2)
withpen KindergartenPen
withcolor "KindergartenTimes"
enddef ;
vardef KindergartenDivided =
draw image
(
draw (2,1) -- (8,9) ;
)
shifted (0,-2)
withpen KindergartenPen
withcolor "KindergartenDivided"
enddef ;

lmt_registerglyphs [
name = "kindergarten",
units= 10,
  % usecolor = true,
width= 10,
height   = 8,
depth= 2,
] ;

lmt_registerglyph [ category = "kindergarten", unicode = "0x003D",
code = "KindergartenEqual"
] ;
lmt_registerglyph [ category = "kindergarten", unicode = "0x002B",
code = "KindergartenPlus"
] ;
lmt_registerglyph [ category = "kindergarten", unicode = "0x2212",
code = "KindergartenMinus"
] ;
lmt_registerglyph [ category = "kindergarten", unicode = "0x00D7",
code = "KindergartenTimes"
] ;
lmt_registerglyph [ category = "kindergarten", unicode = "0x002F",
code = "KindergartenDivided"
] ;

\stopMPcalculation

\definecolor[KindergartenEqual]  [darkgreen]
\definecolor[KindergartenPlus]   [darkred]
\definecolor[KindergartenMinus]  [darkred]
\definecolor[KindergartenTimes]  [darkblue]
\definecolor[KindergartenDivided][darkblue]

\definefontfeature
  [mathextra]
  [metapost=kindergarten]

\setupbodyfont[dejavu]

\startTEXpage[offset=10pt]
$ y = 2 \times x + a - b / 3 $ \par
\hfill \infofont{kindergarten math}
\stopTEXpage
___
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] notes in the margin

2019-10-04 Thread Henning Hraban Ramm
Hi Andres,
I have a working solution and another approach by Wolfgang:

This is not a MWE, and it contains probably a lot of unnecessary stuff.
Since Hans fixed some problems since, it might have become much easier.
E.g. I seldom need my FNVOffset correction any more.


% I thought I could setup those two together, but it didn’t work
\setupmargindata[inmargin][
  location=right,
  stack=continue,
  align=flushright,
  style={\switchtobodyfont[6pt]},
]
\setupmargindata[inouter][
  location=right,
  stack=continue,
  align=flushright,
  style={\switchtobodyfont[6pt]},
]

\def\FNVOffset{0} % Negative vertical offset of footnotes in lines
% Redefine this as necessary (e.g. if long footnotes overflow into the footer)

\def\MarginNote#1{%
\inmargin[
  voffset=\dimexpr-\FNVOffset\lineheight\relax,
  width=\ColWidth,
  align=flushleft,
]{%
  \inframed[
width=\ColWidth,
align=right,
frame=off,
offset=overlay,
strut=yes,
]{#1}%
  }%
}

\define\PlaceFootnote{%
\inmargin[
  voffset=\dimexpr-\FNVOffset\lineheight\relax,
  width=\ColWidth,
]{%
  \vtop{\switchtobodyfont[6pt]\placelocalnotes[footnote][before=,after=]}}%
}

\def\FNo#1{{#1~}} %\crlf\gobblespacetokens}}
% Distance/glue after number or before note text never disappears :(

\setupnote[footnote][
  location=text,
  bodyfont=,
  indenting=no,
  before={\noindentation},
  next=\PlaceFootnote,
]

\setupnotation[footnote][
way=bychapter,
align=flushleft,
  indenting=no,
  location=serried,
  alternative=serried,
  width=broad,
  numbercommand=\FNo,
] % footnote text

\setuptexttexts[margin][][%
  {\framed[
align={flushright,bottom},
frame=off,
height=\textheight,
width=\ColWidth,
  ]{%
\strut\vfill\switchtobodyfont[6pt]}}%
]


% different approach:
\definecounter[Mnote][way=bychapter,prefix=no]
\def\mnote#1{%
  \incrementcounter[Mnote]%
  \high{\color[mnotemark]{\convertedcounter[Mnote]}}%
  \inouter{{%
\FootnoteFont%
\color[mnotemark]{\convertedcounter[Mnote]}\crlf #1\blank[yes]}}%
}
%

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD


> Am 2019-10-04 um 03:32 schrieb Andres Conrado Montoya 
> :
> 
> I've been tinkering with this problem. It's kind of frustrating not having a 
> right solution for this. 
> After trying and failing to the last solution published by Hraban on 
> 2018-02-12, I tried to implement my own approach, from the other way around, 
> I mean: not trying to implement notes as marginal material, but to implement 
> the marginalia as some type of notes. A different type, apart from footnotes, 
> with their own counter, etc.
> 
> Below, a MWE, with some caveats:. 
> 1. This is a poor quality hack. I'm not a developer.
> 2. If notes are too long, they clash with each other. I tried to understand 
> the options that would allow me to move them up or down, according to the 
> Wiki (https://wiki.contextgarden.net/Command/inmargin), but they don't seem 
> to do anything, or I don't understand how to work with them. But if there is 
> actually a way to manually instruct \inmargin to move up or down, it should 
> be easy to make it work as an optional third argument, for example. 
> 3. The counter introduces some horizontal space that I cant manage to remove 
> except by introducing manual negative \hspace. The MWE doesn't include that 
> space, to display the isse. 
> 4.  There are probably a ton of issues I have not thought about, but this 
> seems to work for this project I'm working on, at least. 
> 
> %%% Start MWE
> 
> \setuplayout[
> topspace=0.722in,
> header=0.311in,
> footer=0.622in,
> width=4.211in,
> height=9.622in,
> backspace=1.311in,
> rightmargin=1.8in,
> margindistance=24pt
> ]
> \definecounter[marginales][way=bytext,prefix=no]
> \def\romanMarginales{\convertnumber{r}{\rawcountervalue[marginales]}}
> \def\marginal{\dosingleempty\doMarginal}
> \def\doMarginal[#1]#2{%
>   \incrementnumber[marginales]
>   \iffirstargument
> \high{\romanMarginales}\inouter[#1]{\romanMarginales.\ #2}
>   \else
> \high{\romanMarginales}\inouter{\romanMarginales.\ #2}
>   \fi
> }
> 
> \starttext
> \dorecurse{6}{\input weisman And so on, and so on\marginal{This is a test, 
> with some words and some more words.}.\par \input thuan\par}
> \stoptext
> 
> %%% Stop MWE
> 
> Andrés Conrado Montoya
> Andi Kú
> andresconr...@gmail.com
> http://sesentaycuatro.com
> http://messier87.com
> http://chiquitico.org
> 
> Los fines no justifican los medios, porque la medida verdadera de nuestro 
> carácter está dada por los medios que estamos dispuestos a utilizar, no por 
> los fines que proclamamos.
> 
> “You develop an instant global consciousness, a people orientation, an 
> intense dissatisfaction with the state of the world, and a compulsion to do 
> something about it. From out there