[NTG-context] Re: MetaFun path joiners && and &&&& do not like single point paths

2023-12-30 Thread Mikael Sundqvist
Hi

On Sun, Dec 31, 2023 at 3:33 AM Gavin via ntg-context
 wrote:
>
> Hi MetaFun fans,
>
> Following a suggestion of Hans, I experimented with && and &&& and  for 
> joining paths in MetaFun. The joiner &&& produces one long path, but && and 
>  seem to produce a disconnected path which includes all the original 
> paths. However, if one of the paths is a single point, then it connects it. 
> MWE below.
>
> I spotted this on my globes module, where we saw an extra line appear for a 
> very specific orientation of the globe. I guessed that this orientation had 
> an island right on the horizon, so that only one boundary point was visible, 
> creating a singe point path for that island. I should probably fix my module 
> so it doesn’t do that. However, it might be nice to have && and  deal 
> with this situation gracefully.
>
> Gavin
>
>
> \startMPpage
>  path p[], q ;
>  p1 = fullcircle scaled 3cm ;
>  p2 = fullcircle scaled 2cm shifted (3cm,0) ;
>  p3 = (3cm,2cm) ;
>  q = for i = 1 upto 3 :
> p[i] &&
>  endfor
>  cycle ;
>  draw p1 withpen pencircle scaled 2pt withcolor .7 ;
>  draw p2 withpen pencircle scaled 2pt withcolor .7 ;
>  draw p3 withpen pencircle scaled 2pt withcolor .7 ;
>  draw q withcolor red ;
>  eofill q withcolor 0.9 ;
>  draw fullcircle scaled 6cm shifted (1.25cm,0) ;
> \stopMPpage

Not beautiful, but this seems to do what you want in this particular case:

\startMPpage
path p[], q ;
p1 = fullcircle scaled 3cm ;
p2 = fullcircle scaled 2cm shifted (3cm,0) ;
p3 = (3cm,2cm) ;
p4 = fullcircle ;
q = p[1] for i = 2 upto 3:
if (length(p[i]) == 0): &&& else: && fi p[i]
endfor
&& cycle ;
eofill q withcolor 0.9 ;
draw p1 withpen pencircle scaled 2pt withcolor .7 ;
draw p2 withpen pencircle scaled 2pt withcolor .7 ;
draw p3 withpen pencircle scaled 2pt withcolor .7 ;
draw q withcolor red ;
draw fullcircle scaled 6cm shifted (1.25cm,0) ;
\stopMPpage

This gives

q = p1 && p2 &&& p3 && cycle ;

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] MetaFun path joiners && and &&&& do not like single point paths

2023-12-30 Thread Gavin via ntg-context
Hi MetaFun fans,

Following a suggestion of Hans, I experimented with && and &&& and  for 
joining paths in MetaFun. The joiner &&& produces one long path, but && and 
 seem to produce a disconnected path which includes all the original paths. 
However, if one of the paths is a single point, then it connects it. MWE below.

I spotted this on my globes module, where we saw an extra line appear for a 
very specific orientation of the globe. I guessed that this orientation had an 
island right on the horizon, so that only one boundary point was visible, 
creating a singe point path for that island. I should probably fix my module so 
it doesn’t do that. However, it might be nice to have && and  deal with 
this situation gracefully.

Gavin


\startMPpage
 path p[], q ;
 p1 = fullcircle scaled 3cm ;
 p2 = fullcircle scaled 2cm shifted (3cm,0) ;
 p3 = (3cm,2cm) ;
 q = for i = 1 upto 3 :
p[i] &&
 endfor
 cycle ;
 draw p1 withpen pencircle scaled 2pt withcolor .7 ;
 draw p2 withpen pencircle scaled 2pt withcolor .7 ;
 draw p3 withpen pencircle scaled 2pt withcolor .7 ;
 draw q withcolor red ;
 eofill q withcolor 0.9 ;
 draw fullcircle scaled 6cm shifted (1.25cm,0) ;
\stopMPpage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Aditya Mahajan
On Sun, 31 Dec 2023, Shiv Shankar Dayal wrote:

> It would be nice to either support Metapost 3D or Asymptote. Right now I
> generate images separately and embed them in PDF using externalfigure command 
> which works but I have to maintain all the graphics separately.

It is possible to obtain simple integration for asymptote using the filter 
module:

  https://github.com/adityam/filter

Using that you could define an asymptote environment so that:

\startbuffer[asymptote-preamble]

\stopbuffer

\starttext

\startasymptote
% Asymptote figure
\stopasymptote

\stoptext

saves the content of the asymptote-preamble and the figure in a separate file, 
runs asymptote to generate a PDF figure and includes the figure. The results 
are cached so the asymptote is re-run only if the content of the figure 
environment changes. 

A drawback of this approach is that the labels are generated by asymptote. That 
means that the font, colors, and any macros needed for the figures need to be 
redefined at both context and asymptote end. 

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Hans Hagen

On 12/30/2023 8:04 PM, Shiv Shankar Dayal wrote:

Hi all,

It would be nice to either support Metapost 3D or Asymptote. Right now I 
generate images separately and embed them in PDF using externalfigure 
command which works but I have to maintain all the graphics separately.
next year we will pick up 3 (2.5, projections) in mp (either native or 
in macros) ... there will be no support for asymptote beyond what we 
have 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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Alan Braslau via ntg-context

On 30/12/23 30/12/23, 12:04, Shiv Shankar Dayal wrote:


It would be nice to either support Metapost 3D


Very simple MP pseudo 3D is included in
tex/texmf-context/metapost/context/base/mpiv/mp-tres.mpiv

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Gavin via ntg-context
Hi Shiv and Fabrice,

> On Dec 30, 2023, Shiv Shankar Dayal wrote:
> It would be nice to either support Metapost 3D or Asymptote.

> On Dec 6, 2021, Fabrice L wrote:
> I would be very interested to see an example of a Metafun drawing made with 
> the help of LuaTeX to speed up some calculations.

I made a module that draws 3D globes with MetaPost and Lua. This was my first 
step toward drawing general projections. If anyone would like to join this 
project, I’d love some help. The globes module is only about 300 lines of code, 
and most of the challenge was hiding paths and parts of paths that are on the 
back side of the globe. Anybody could get up to speed pretty quickly. (I am 
completely new to both MetaPost and Lua, so I tried to be very clear in my 
coding.)

My goal is a drawing process which starts with Lua tables containing data in 
arbitrary coordinates. The data could be any number of dimensions, and need not 
be rectangular. (For the globes the data is latitude and longitude points on 
the countries' boundaries.) The tables could be from an outside source (like 
the geographic data) or it could be calculated in Lua (for graphing functions 
or doing simulations).

Lua does all of the calculations to project this data down to two dimensional, 
rectangular coordinates. Lua then passes these two dimensional points, or paths 
made from them, to MetaPost. MetaPost uses the points and paths to draw dots, 
curves and areas, to place labels, etc. The only transformation performed by 
MetaPost is the final scaling for drawing everything on the page.

You can find the globe module on GitHub:

https://github.com/GavinPolhemus/luageo

I am relatively new to Git as well, so have patience if you start commenting or 
contributing there. I’ll learn fastest if there are collaborators!

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Status of Asymptote

2023-12-30 Thread Shiv Shankar Dayal

Hi all,

It would be nice to either support Metapost 3D or Asymptote. Right now I 
generate images separately and embed them in PDF using externalfigure 
command which works but I have to maintain all the graphics separately.


Respect,

Shiv

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Equivalent for hdots and hdotsfor

2023-12-30 Thread Mikael Sundqvist
Hi,

On Sat, Dec 30, 2023 at 9:45 AM Shiv Shankar Dayal
 wrote:
>
> In LaTeX, I can use \hdots for horizontal dots and \hdotsfor{n} to fill for 
> several columns in a determinant. But these do not work in ConTeXt. What is 
> the equivalent for these in ConTeXt?

You can try \HF or \HF[n].

\startTEXpage[offset=1DK]
\dm{
\startnamedmatrix[matrix:bars]
\NC 1 \NC x \NC x^2 \NC \ldots \NC x^{n-1} \NR
\NC 1 \NC y \NC y^2 \NC \ldots \NC y^{n-1} \NR
\HF[3] \NR
\NC 1 \NC z \NC z^2 \NC \ldots \NC z^{n-1} \NR
\stopnamedmatrix
}
\stopTEXpage

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Equivalent for hdots and hdotsfor

2023-12-30 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 30.12.2023 um 09:41:
In LaTeX, I can use \hdots for horizontal dots and \hdotsfor{n} to 
fill for several columns in a determinant. But these do not work in 
ConTeXt. What is the equivalent for these in ConTeXt?


Can you show the desired output from LaTeX with a PDF file and a minimal 
example of your ConTeXt version.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-30 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 30.12.2023 um 09:40:
I tried this for old style factorial, but it appears much below the 
line in which it is used. How can I bring it up?


Replace the \inmframed command with \mcframed.

\define[1]\oldfact
  {\mcframed[frame=off,strut=no,leftframe=on,bottomframe=on]{#1}}

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Equivalent for hdots and hdotsfor

2023-12-30 Thread Shiv Shankar Dayal
Never mind, I found the solution on list that we can use \dotfill and
\multispan{n}{\dotfill} as a substitute for what I have asked for.

On Sat, Dec 30, 2023 at 2:11 PM Shiv Shankar Dayal <
shivshankar.da...@gmail.com> wrote:

> In LaTeX, I can use \hdots for horizontal dots and \hdotsfor{n} to fill
> for several columns in a determinant. But these do not work in ConTeXt.
> What is the equivalent for these in ConTeXt?
>
> --
> Respect,
> Shiv Shankar Dayal
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Equivalent for hdots and hdotsfor

2023-12-30 Thread Shiv Shankar Dayal
In LaTeX, I can use \hdots for horizontal dots and \hdotsfor{n} to fill for
several columns in a determinant. But these do not work in ConTeXt. What is
the equivalent for these in ConTeXt?

-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-30 Thread Shiv Shankar Dayal
I tried this for old style factorial, but it appears much below the line in
which it is used. How can I bring it up?

On Wed, Dec 27, 2023 at 6:18 PM Shiv Shankar Dayal <
shivshankar.da...@gmail.com> wrote:

>
>
> A simple alternative to tikz is the usage of \framed.
>>
>> \define[1]\oldfact
>>   {\inmframed[frame=off,strut=no,leftframe=on,bottomframe=on]{#1}}
>>
>> \starttext
>>
>> \m{\oldfact{n}}
>>
>> \stoptext
>>
>> Wolfgang
>>
>> Thanks a lot. It should work nicely.
>
> --
> Respect,
> Shiv Shankar Dayal
>


-- 
Respect,
Shiv Shankar Dayal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___