[NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-16 Thread Bruce Horrocks


> On 15 Jun 2024, at 22:20, Michael Guravage  wrote:
> 
> Bruce,
> 
> Yes, I remember encountering this problem. The two files you need are: 
> sun-MP.tex and moons-MP.tex. I don't recall where I found them so I've 
> attached them below. Drop them into their respective pocketdiary directories 
> Solar and Moonphase and run mtxrun --generate. 
> 
> Your suggestion of the Day key was the first thing I tried myself. 
> Unfortunately, it has no effect.
> 
> Thanks for thinking along.

The month table layout is hard-coded in line 515 of file t-pocketdiary.lua

The code that decides in which cell to put the '1' of the first day is 
calculated elsewhere and not passed as a parameter.

That rules out a simple fix - you'd need to add a "weekstart" or similar 
parameter and track/act on it in various parts of the code.

—
Bruce Horrocks
Hampshire, UK

___
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: Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-15 Thread Michael Guravage
Bruce,

Yes, I remember encountering this problem. The two files you need are:
sun-MP.tex and moons-MP.tex. I don't recall where I found them so I've
attached them below. Drop them into their respective pocketdiary
directories Solar and Moonphase and run mtxrun --generate.

Your suggestion of the Day key was the first thing I tried myself.
Unfortunately, it has no effect.

Thanks for thinking along.

With kind regards,

Michael



On Sat, Jun 15, 2024 at 10:51 PM Bruce Horrocks  wrote:

>
>
> > On 15 Jun 2024, at 17:55, Michael Guravage <
> gurav...@literatesolutions.com> wrote:
> >
> > Hi,
> >
> > I am trying to use the Pocket Diary module to create a photo calendar as
> described in the Calendar Examples. The examples work fine. By default
> weeks begin on Monday. Does anyone know how to specify that weeks begin on
> Sunday? I have searched through all the setvariable assignments, but
> nothing seems applicable.
> >
> > I have attached an example file so you needn't retrieve all the
> examples. Any help would be appreciated.
>
> Your example didn't work for me - I didn't have PocketDiary installed and
> then after installing it I got an error about Moons.tex. Life's too short
> to faff trying to fix it so this suggestion is untested.
>
> The variables setting allows a Day= value so try experimenting with
>
> \setvariables
>   [PocketDiary]
>   [Year=2025,
>Day=7]
>
> as the default value is 1 which I assume is Monday.
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___
> 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
>
> ___
>
% Metafun
% filename: moons.tex
% Boede 2021

% \setupbodyfont[plex,ss,14pt]

\defineMPinstance
	[Moon]
	[metafun]
  []
	
\startMPinclusions[]{Moon}
	numeric w,h;
	path p[];
	pair ip[];
	
	w = OverlayWidth;
	h = OverlayHeight;
	
	p[1] := fullcircle scaled h;
	p[2] := p[1] shifted (0.2 w,0);
	
	ip[1] := p[1] intersectionpoint p[2];
	ip[2] := reverse p[1] intersectionpoint p[2];

	p[3] := p[1] cutbefore ip[1] cutafter ip[2];	
	p[4] := p[2] cutbefore ip[1] cutafter ip[2];
	
  drawoptions (withpen pencircle scaled 2pt);
	
\stopMPinclusions

\startuniqueMPgraphic{Moon::Waning_moon}
  draw  p[3] ;
	draw  p[4] ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Growing_moon}
  draw  p[3] ;
	draw  p[4] ;
	currentpicture := (currentpicture reflectedabout (ip[1],ip[2]));
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Fullmoon}
	draw p[1];
\stopuniqueMPgraphic

\startuniqueMPgraphic{Moon::Newmoon}
	fill p[1] withcolor 0.625 white;
	draw p[1];
\stopuniqueMPgraphic


\defineoverlay[waningmoon][\useMPgraphic{Moon::Waning_moon}]
\defineoverlay[growingmoon][\useMPgraphic{Moon::Growing_moon}]
\defineoverlay[newmoon][\useMPgraphic{Moon::Newmoon}]
\defineoverlay[fullmoon][\useMPgraphic{Moon::Fullmoon}]

\defineframed
	[Moon]
	[height=\bodyfontsize,
	 width=\bodyfontsize,
 	 frame=off]


% \starttext
% Results with \type{framed}
%
% \blank
%
%  Heute ist abnehmender Mond	{\Moon[background=waningmoon]{\strut}}
%
%  Heute ist Vollmond \Moon[background=fullmoon]{}
%
%  Heute haben wir Neumond \Moon[background=newmoon]{}
%
%  Und heute haben wir zunehmenden Mond \Moon[background=growingmoon]{}
%
% \stoptext% Metafun
% filename: moons.tex
% Boede 2021

% \setupbodyfont[plex,ss,14pt]

\defineMPinstance
	[Sun]
	[metafun]
  []
	
\startMPinclusions[]{Sun}
	numeric w,h;
	path p[];
	pair ip[];
	
	w = OverlayWidth;
	h = OverlayHeight;
	
	p[1]  := fullcircle scaled h;
	p[100] := tcircle scaled 0.5h; %h
	p[2] := tcircle scaled 0.6h;  %1.2h;
	p[3] := tcircle scaled 0.75h; %1.6h;
	p[4] := tcircle scaled h; %2h;
	p[5] := (0,0)--point 1 of p[4] ;
	p[6] := p[5] cutbefore point .3 of p[5];
	p[7] := p[6] rotatedaround (center p[1],18);
	 
  ip[1] :=  p[2] intersectionpoint p[7];
  ip[2] :=  p[3] intersectionpoint p[7];
	
  p[10] := ip[1]--ip[2];

	ip[3] :=  ip[1];
	ip[4] :=  point 1 of p[7];

	p[11] := ip[3]--ip[4];
	
  drawoptions (withpen pencircle scaled 0.25pt withcolor red);
	
\stopMPinclusions

\startreusableMPgraphic{Sun::Sunrise}
  drawoptions (withpen pencircle scaled 0.25pt withcolor red);
  draw p[100];
	for i = 36 step 36 until 154  :
	  draw p[10] rotatedaround (center p[1],i-18);
	endfor;
	for i = 18 step 36 until 180  :
	  draw p[11] rotatedaround (center p[1],i-18);
 endfor;
 drawarrow ((0,0)--(0,h)) shifted (0,-0.05h);
\stopreusableMPgraphic

\startreusableMPgraphic{Sun::Sunset}
  drawoptions (withpen pencircle scaled 0.25pt withcolor red);
  draw p[100];
	for i = 36 step 36 until 154  :
	  draw p[10] rotatedaround (center p[1],i-18);
	

[NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-15 Thread Bruce Horrocks


> On 15 Jun 2024, at 17:55, Michael Guravage  
> wrote:
> 
> Hi,
> 
> I am trying to use the Pocket Diary module to create a photo calendar as 
> described in the Calendar Examples. The examples work fine. By default weeks 
> begin on Monday. Does anyone know how to specify that weeks begin on Sunday? 
> I have searched through all the setvariable assignments, but nothing seems 
> applicable. 
> 
> I have attached an example file so you needn't retrieve all the examples. Any 
> help would be appreciated.

Your example didn't work for me - I didn't have PocketDiary installed and then 
after installing it I got an error about Moons.tex. Life's too short to faff 
trying to fix it so this suggestion is untested.

The variables setting allows a Day= value so try experimenting with

\setvariables
  [PocketDiary]
  [Year=2025,
   Day=7]

as the default value is 1 which I assume is Monday.

—
Bruce Horrocks
Hampshire, UK

___
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
___