Re: [NTG-context] new upload

2022-10-16 Thread Aditya Mahajan via ntg-context
On Sun, 16 Oct 2022, Mikael Sundqvist via ntg-context wrote:

> Hi,
> 
> On Sun, Oct 16, 2022 at 6:07 PM Aditya Mahajan via ntg-context
>  wrote:
> >
> > On Fri, 14 Oct 2022, Hans Hagen via ntg-context wrote:
> >
> > > Hi,
> > >
> > > I uploaded a new version. Apart from a few fixes / extensions already
> > > mentioned here (or known to those who wanted it) the main changes are in
> > > the math goodie files (work in progress, we will clean them up later) as
> > > part of improving the rendering of math.
> >
> > Something is wrong with the placement of limits around an integral with 
> > NeoEuler:
> >
> > \usetypescriptfile[euler]
> >
> > \definetypeface[mainfont][rm][specserif][CharisSil][default]
> > \definetypeface[mainfont][mm][math] [eulernova][default]
> > \definetypeface[mainfont][tt][mono] [dejavu][default] [rscale=0.8, 
> > features=none]
> > \setupbodyfont[mainfont,10pt]
> >
> > \starttext
> > \startTEXpage[offset=1mm]
> >   $\displaystyle \int_{0}^{1} f(x) dx$
> > \stopTEXpage
> > \stoptext
> >
> > gives the attached result.
> 
> This is because the integral "sits wrong" in its boundingbox. Almost
> all fonts have the glyph centered around the math axis, but there are
> a few that doesn't. In euler-math.lfg, add the tweak
> 
> {
> tweak = "fixoldschool",
> },

This fixes the issue with eulernova, but not with pagellaovereuler. 
pagellaovereuler uses euler-with-pagella-math as a goodie file, but that is 
missing from the distribution. (I simply copied euler-math.lfg for my use 
case). 

With tweak=fixoldschool, \startcases doesn't work correctly (see attached):

\usetypescriptfile[euler]

\definetypeface[mainfont][rm][specserif][CharisSil][default]
\definetypeface[mainfont][mm][math] [eulernova][default]
\definetypeface[mainfont][tt][mono] [dejavu][default] [rscale=0.8, 
features=none]
\setupbodyfont[mainfont,10pt]

\starttext
\startTEXpage[offset=1mm]
  \startformula
\startcases
  \NC A \NC B \NR
  \NC C \NC D \NR
\stopcases
  \stopformula
\stopTEXpage
\stoptext


Aditya

test.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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Perceptrons

2022-10-16 Thread Thangalin via ntg-context
Okay, they aren't _real_ perceptrons, but fancy parameterized trees
connected on a hex grid, coded with MetaFun and Lua.

Big version: https://pdfhost.io/v/piuN04dSq_perceptron

If anyone is interested in the full source code, let me know.

I couldn't get "angle" to work properly. Hans, your simplifications on
the atantwo function also didn't work for all cases. There was a
single edge case that didn't determine the correct angle. Don't know
why.

Cheers!


perceptron-01.pdf
Description: Adobe PDF document


perceptron-02.pdf
Description: Adobe PDF document
\definecolor[HexGridBase][h=E0E0E0]
\definecolor[HexGridNode][h=202020]
\definecolor[HexGridEdge][h=808080]

%\definecolor[HexGridBase][h=1f50da]
%\definecolor[HexGridNode][h=00d687]
%\definecolor[HexGridEdge][h=00d687]

\startluacode
  require "Graph"

  -- Try to generate a different tree each run.
  math.randomseed( math.modf( os.clock() * 1000 ), os.time() )

  userdata = userdata or {}
  ud = userdata

  -- Create a minimally spanning acyclic graph that's mostly connected.
  --
  -- @param r - numeric - The number of rows
  -- @param c - numeric - The number of columns
  -- @param m - numeric The number of edges
  --
  -- @return A handle to the tree instance.
  function tree( r, c, m )
local graph = Graph:new()
local edges = graph:connected( r, c, m )
local source = edges[ math.random( #edges ) ]
local tree = graph:compute( source )

return tree
  end

  -- Extract the first pair of a vertex at the given index inside the tree.
  -- No error checking is performed.
  --
  -- @param graph - object - The tree containing numerous edges.
  -- @param index - non-negative integer - The index for the vertex pair.
  --
  -- @return The (x, y) pair for the first vertex comprising an edge.
  function ud.vertex_a( graph, index )
u = graph[ index ].u
return { u.x, u.y }
  end
  
  -- Extract the second pair of a vertex at the given index inside the tree.
  -- No error checking is performed.
  --
  -- @param graph - object - The tree containing numerous edges.
  -- @param index - non-negative integer - The index for the vertex pair.
  --
  -- @return The (x, y) pair for the second vertex comprising an edge.
  function ud.vertex_b( graph, index )
v = graph[ index ].v
return { v.x, v.y }
  end
  
  -- Return the number of edges in the tree.
  --
  -- @param graph - object - The tree containing numerous nodes.
  --
  -- @return The number of vertex pairs in the tree.
  function ud.count( graph )
return #graph
  end
\stopluacode

\startuseMPgraphic{HexGridBaseGraphic}{side}
  % Set the random seed to the current second.
  randomseed := lua( "os.time()" );

  vardef atantwo( expr ax, ay, bx, by ) =
save theta;

dx := bx - ax;
dy := by - ay;
theta := 0;

if (dx > 0):
  theta := atan( dy / dx );
elseif (dx < 0) and (dy >= 0):
  theta := atan( dy / dx ) + pi;
elseif (dx < 0) and (dy < 0):
  theta := atan( dy / dx ) - pi;
elseif (dx == 0) and (dy > 0):
  theta := pi / 2;
elseif (dx == 0) and (dy < 0):
  theta := -pi / 2;
fi;

theta
  enddef;

  vardef degrees( expr rad ) =
rad * 180 / pi
  enddef;

  vardef distance( expr ax, ay, bx, by ) =
sqrt( ((bx - ax)^2) + ((by - ay)^2) )
  enddef;

  % Set the number of hexagons from top to bottom.
  GRID_C = 124;

  % Set the number of hexagons from left to right.
  GRID_R = 120;

  % Set the number of pathways between nodes (higher is more complexity).
  PATHWAYS = 235;

  % Grid zoom level (smaller is further away).
  SCALE = 5;

  % Hexagon dimensions.
  HEIGHT  = sqrt( 3 );
  HHEIGHT = HEIGHT / 2;
  WIDTH   = 2;

  color colour_base;
  color colour_node;
  color colour_edge;

  colour_base = \MPcolor{HexGridBase};
  colour_node = \MPcolor{HexGridNode};
  colour_edge = \MPcolor{HexGridEdge};

  % Vertex diameters proportional to the hexagon height.
  vertex_sm := HEIGHT / 12;
  vertex_lg := HEIGHT / 5;

  path path_ul;
  path path_ur;
  path path_tp;

  path_ur := dir( 60 * 0 ) -- dir( 60 * 1 );
  path_tp := dir( 60 * 1 ) -- dir( 60 * 2 );
  path_ul := dir( 60 * 2 ) -- dir( 60 * 3 );

  picture hexgrid;
  picture vertices;
  picture perceptrons;
  picture connections;

  hexgrid := nullpicture;
  vertices := nullpicture;
  perceptrons := nullpicture;
  connections := nullpicture;

  % Line width.
  pickup pencircle scaled .05bp;

  addto hexgrid also image(
for c = 1 upto GRID_C:
  for r = 1 upto GRID_R:
offset_c := c * 3 / WIDTH;
offset_r := r * HEIGHT - (c mod 2 * HHEIGHT);

draw path_ul shifted (offset_c, offset_r) withcolor colour_base;
draw path_tp shifted (offset_c, offset_r) withcolor colour_base;
draw path_ur shifted (offset_c, offset_r) withcolor colour_base;

for i = 0 upto 2:
  addto vertices also image(
draw
  point i of path_tp
  shifted (offset_c, offset_r)
  withcolor colour_base

Re: [NTG-context] debugging lmtx and firefox (was: TeXGyre Heros on Firefox)

2022-10-16 Thread Pablo Rodriguez via ntg-context
On 7/25/22 14:00, juh+ntg-context--- via ntg-context wrote:
> [...]
> They hint to LuaMetaTex as the cause of the problem. You can follow the
> discussion here.
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=1781022

Hi juh,

this should have been fixed in current latest. So I think it may be safe
to close the issue.

Sorry, but I cannot access to my Mozilla account temporarily (and I
think you may close your issue without having to ask administrators).

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] new upload

2022-10-16 Thread Mikael Sundqvist via ntg-context
Hi,

On Sun, Oct 16, 2022 at 6:07 PM Aditya Mahajan via ntg-context
 wrote:
>
> On Fri, 14 Oct 2022, Hans Hagen via ntg-context wrote:
>
> > Hi,
> >
> > I uploaded a new version. Apart from a few fixes / extensions already
> > mentioned here (or known to those who wanted it) the main changes are in
> > the math goodie files (work in progress, we will clean them up later) as
> > part of improving the rendering of math.
>
> Something is wrong with the placement of limits around an integral with 
> NeoEuler:
>
> \usetypescriptfile[euler]
>
> \definetypeface[mainfont][rm][specserif][CharisSil][default]
> \definetypeface[mainfont][mm][math] [eulernova][default]
> \definetypeface[mainfont][tt][mono] [dejavu][default] [rscale=0.8, 
> features=none]
> \setupbodyfont[mainfont,10pt]
>
> \starttext
> \startTEXpage[offset=1mm]
>   $\displaystyle \int_{0}^{1} f(x) dx$
> \stopTEXpage
> \stoptext
>
> gives the attached result.

This is because the integral "sits wrong" in its boundingbox. Almost
all fonts have the glyph centered around the math axis, but there are
a few that doesn't. In euler-math.lfg, add the tweak

{
tweak = "fixoldschool",
},

In fact, we have not updated the euler goodie file for a while it
seems. I think there are more things that can be improved. Hopefully
before next release.

It can also be mentioned that some fonts (Daniel Flipo was quick to
fix concrete, erewhon and kpfonts) was fixed recently regarding this,
and it is reported on and fixed in development of Lucida.

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] new upload

2022-10-16 Thread Aditya Mahajan via ntg-context
On Fri, 14 Oct 2022, Hans Hagen via ntg-context wrote:

> Hi,
> 
> I uploaded a new version. Apart from a few fixes / extensions already 
> mentioned here (or known to those who wanted it) the main changes are in 
> the math goodie files (work in progress, we will clean them up later) as 
> part of improving the rendering of math.

Something is wrong with the placement of limits around an integral with 
NeoEuler:

\usetypescriptfile[euler]

\definetypeface[mainfont][rm][specserif][CharisSil][default]
\definetypeface[mainfont][mm][math] [eulernova][default]
\definetypeface[mainfont][tt][mono] [dejavu][default] [rscale=0.8, 
features=none]
\setupbodyfont[mainfont,10pt]

\starttext
\startTEXpage[offset=1mm]
  $\displaystyle \int_{0}^{1} f(x) dx$
\stopTEXpage
\stoptext

gives the attached result.

Thanks,
Aditya

test.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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] list not following "focus=standard"

2022-10-16 Thread Pablo Rodriguez via ntg-context
On 10/16/22 13:28, Pablo Rodriguez via ntg-context wrote:
> [...]
> So, line 40 of that file ("local cheat = true") needs a conditional that
> I’m not able to provide (I have no idea how it would read).
>
> Basically, if \setupinteraction[focus=standard], please don’t cheat .

Or even more accurate, cheat only if focus in \setupinteraction is fit
or tight (other options include positions inside pages).

Pab

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] list not following "focus=standard"

2022-10-16 Thread Pablo Rodriguez via ntg-context
On 10/14/22 23:24, Pablo Rodriguez via ntg-context wrote:
> Hi Hans,
>
> I have the following sample:
>
>   \setupinteraction[state=start,
> focus=standard]
>   \starttext
>   \completecontent
>   \section{section}
>   a\footnote{\contextversion}
>   \stoptext

Hans,

I have found the cause of the misbehavior in strc-lst.lua, lines 898-903:

if cheat and references then
-- this permits runs=2 with interactivity
local internal = references.internal
usedinternals[internal] = true
usedviews[internal] = references.view
end

So, line 40 of that file ("local cheat = true") needs a conditional that
I’m not able to provide (I have no idea how it would read).

Basically, if \setupinteraction[focus=standard], please don’t cheat .

Sorry, but I don’t even know which file (strc-lst.lua or lpdf-ano) has
to be modified.

I hope the issue is clearer now.

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___