[NTG-context] directlua question

2018-12-04 Thread Hans van der Meer
I am trying to extract something from a string with a \directlua call, the last 
word of a string in case:

\directlua{tex.print(string.match(“This is a string","%s%a$"))}

However, the %s%a are not working with the TeX-error “unfinished string near 
eof”. Obviously caused by the %’s.
How to get this working? \textpercent will not do, off course within Luacode.

dr. 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] directlua question

2018-12-04 Thread Hans van der Meer


On 4 Dec 2018, at 13:29, Hans van der Meer  wrote:

> I am trying to extract something from a string with a \directlua call, the 
> last word of a string in case:
> 
>   \directlua{tex.print(string.match(“This is a string","%s%a$"))}
> 
> However, the %s%a are not working with the TeX-error “unfinished string near 
> eof”. Obviously caused by the %’s.
> How to get this working? \textpercent will not do, off course within Luacode.

Also I tried to no avail

\begingroup\catcode`\%=12\relax\directlua{tex.print(string.match(“This is a 
string","%s%a$"))}\endgroup

dr. 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] directlua question

2018-12-04 Thread Wolfgang Schuster

Hans van der Meer schrieb am 04.12.18 um 13:29:
I am trying to extract something from a string with a \directlua call, 
the last word of a string in case:


\directlua{tex.print(string.match(“This is a string","%s%a$"))}

However, the %s%a are not working with the TeX-error “unfinished string 
near eof”. Obviously caused by the %’s.
How to get this working? \textpercent will not do, off course within 
Luacode.


% = \letterpercent
$ = \letterdollar

You can also replace

  \directlua{tex.print(...)}

with

  \ctxlua{context(...)}

or

  \cldcontext{...}

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] graphics

2018-12-04 Thread Alan Braslau
On Tue, 4 Dec 2018 18:03:14 +0100
Hans Hagen  wrote:

> Hi,
> 
> As most mechanism are reasonable okay now we can look into what
> future versions of ConteXt should provide in terms of functionality.
> The (luatex) engine is also more of less finished or at least stable
> in terms of functionality.
> 
> One possible area of further development is graphics so I'd like to
> know if there are (reasonable) demands for more graphics support
> using metapost. Alan and I are on-and-off working on some extensions
> and one of the things we discuss is visualization of data. The
> question is of course what should be done in the lua/mp/tex
> combination and what externally but the combination has some
> advantages. There has been presentations and discussions at the last
> meeting and graphics is always a nice topic, and also kind of
> rewarding in terms of development.
> 
> Of course other demands can be formulated too, but these then need to 
> come with well defined descriptions (or mockup examples).

Hans is alluding to work that we are doing to explore the possibilities
of lua + MetaPost in the treatment and visualization of data,
efficiently, with the possibility of handling large quantities of data.
Lua does this particularly well.

My first exercise has been a complete rewrite of the John Hobby graph
macros. It was/is an exercise in recreating the functionality "from
scratch", trying to use lua effectively when needed. The code and
approach is entirely new. My use case was the analysis of a large set
of data - entirely ridiculous for graphical display but containing
"outliers" or instances that are significant, and it works! I am
trying to generalize, and am doing this in my "free time".

So the aim is two-fold:

1) to efficiently handle large datasets through the use of lua

2) to generalize the notion of user data space from the
two-dimensional drawing space of MetaPost (and the represented page),
and affine transformations of this 2D space to other coordinate
systems and dimensions. We are not thinking about 3D rendering or
raytracing, but rather simple projections and other transformations
such as polar coordinates. (Of course, log scales, for example are a
"simple" non-linear transformation.) 

I guess that Hans would like to expand the discussion to the future of
graphics in general, inviting input from everybody.

Alan
___
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] Macro to write a vector with Metafun (again)

2018-12-04 Thread Hans Hagen

On 12/4/2018 4:38 PM, Fabrice Couvreur wrote:

Hello Hans,
The macro to draw a vector does not work even with the latest version of 
context standalone.

Thank you
Fabrice

\useMPlibrary[mat]

% will be in meta-imp-mat.mkiv
just watch in there .. we redid these stackers with more control (and 
they also live in their own instance now) ...


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
___

[NTG-context] Macro to write a vector with Metafun (again)

2018-12-04 Thread Fabrice Couvreur
Hello Hans,The macro to draw a vector does not work even with the
latest version of context standalone.
Thank you
Fabrice

\useMPlibrary[mat]

% will be in meta-imp-mat.mkiv

\startMPextensions
 vardef math_stacker_arrow_shape =
 image (
 drawarrow
 (OverlayWidth,OverlayOffset) -- (0,OverlayOffset)
 withcolor
 OverlayLineColor ;
 setbounds currentpicture to boundingbox currentpicture
bottomenlarged (OverlayOffset/2) topenlarged (OverlayOffset/2) ;
 )
 enddef ;
 vardef math_stacker_leftarrow_shape =
 math_stacker_arrow_shape
 enddef ;
 vardef math_stacker_rightarrow_shape =
 math_stacker_arrow_shape rotated 180
 enddef ;
\stopMPextensions

\startuniqueMPgraphic{math:stacker:\number"2190}
 math_stacker_draw(math_stacker_leftarrow_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"2192}
 math_stacker_draw(math_stacker_rightarrow_shape) ;
\stopuniqueMPgraphic

% so far

\setupmathstackers
   [both] % vfenced]
   [color=darkred,
alternative=mp]

\setupmathstackers
   [top]
   [color=darkred,
alternative=mp]

\setupmathstackers
   [bottom]
   [color=darkred,
alternative=mp]

\starttext

$\overbracket   {a+b+c+d} \quad \underbracket{a+b+c+d} \quad
\doublebracket{a+b+c+d}$ \blank
$\overparent{a+b+c+d} \quad \underparent {a+b+c+d} \quad
\doubleparent {a+b+c+d}$ \blank
$\overbrace {a+b+c+d} \quad \underbrace  {a+b+c+d} \quad
\doublebrace  {a+b+c+d}$ \blank
$\overbar   {a+b+c+d} \quad \underbar{a+b+c+d} \quad
\doublebar{a+b+c+d}$ \blank

$\overleftarrow  {a+b+c+d} \quad \overrightarrow  {a+b+c+d} $ \blank
$\underleftarrow {a+b+c+d} \quad \underrightarrow {a+b+c+d} $ \blank

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

2018-12-04 Thread Hans Hagen

Hi,

As most mechanism are reasonable okay now we can look into what future 
versions of ConteXt should provide in terms of functionality. The 
(luatex) engine is also more of less finished or at least stable in 
terms of functionality.


One possible area of further development is graphics so I'd like to know 
if there are (reasonable) demands for more graphics support using 
metapost. Alan and I are on-and-off working on some extensions and one 
of the things we discuss is visualization of data. The question is of 
course what should be done in the lua/mp/tex combination and what 
externally but the combination has some advantages. There has been 
presentations and discussions at the last meeting and graphics is always 
a nice topic, and also kind of rewarding in terms of development.


Of course other demands can be formulated too, but these then need to 
come with well defined descriptions (or mockup examples).


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
___