* [NTG-context] Pocket Diary Photo Calendar: how to specify on which day the week begins? @ 2024-06-15 16:55 Michael Guravage 2024-06-15 20:49 ` [NTG-context] " Bruce Horrocks 0 siblings, 1 reply; 4+ messages in thread From: Michael Guravage @ 2024-06-15 16:55 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 583 bytes --] Hi, I am trying to use the Pocket Diary <https://ctan.org/pkg/context-pocketdiary> module to create a photo calendar as described in the Calendar Examples <https://ctan.org/pkg/context-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. -- With kind regards, Michael <http://literatesolutions.com> [-- Attachment #1.2: Type: text/html, Size: 962 bytes --] [-- Attachment #2: Photocalendar.tex --] [-- Type: text/x-tex, Size: 3517 bytes --] \usemodule[pocketdiary] %D Choose and setup the font to be used \setupbodyfont[ibmplex,ss,12pt] % Supported languages: EN,DE,NL,FR,IT,ES \mainlanguage[nl] % Switch off the page numbering \setuppagenumbering[location=] % Setup the paper size \setuppapersize[A4,portrait][A4,portrait] % Adjust the layout of the page \setuplayout [topspace=20mm, backspace=8.6mm, header=0pt, footer=0pt, height=middle, width=middle] % Setup the path where to find the calendar pictures \setupexternalfigures [directory={., ./graphics, ../graphics, ./MyPhotoDirectory}] \setupexternalfigures [location={local,global,default}] \def\testimage {cow} % dolly.png % Give pictures symbolic names for using in a loop \useexternalfigure [1] [\testimage] \useexternalfigure [2] [\testimage] \useexternalfigure [3] [\testimage] \useexternalfigure [4] [\testimage] \useexternalfigure [5] [\testimage] \useexternalfigure [6] [\testimage] \useexternalfigure [7] [\testimage] \useexternalfigure [8] [\testimage] \useexternalfigure [9] [\testimage] \useexternalfigure [10] [\testimage] \useexternalfigure [11] [\testimage] \useexternalfigure [12] [\testimage] \useexternalfigure [13] [\testimage] % Setup the variables for the Pocket diary, only year is used for the calculations. \setvariables [PocketDiary] [Year=2025] % Let the header and the footer be empty: \setupheadertexts[][] \setupfootertexts[][] % Add some label texts for the international interfaces: \setuplabeltext[en][fotocal={Photo Calendar}] \setuplabeltext[nl][fotocal=Fotokalender] \setuplabeltext[de][fotocal=Fotokalender] \setuplabeltext[fr][fotocal={Calendrier photo}] \setuplabeltext[it][fotocal={Calendario fotografico}] \setuplabeltext[es][fotocal={Calendario fotográfico}] %D Let lua is perform the magic: \startluacode local report = logs.reporter("Photo calendar") function thirddata.calendar.Photo_calendar_page(y) report("Working in function: calendar.Foto_calendar_page") local year = y --local path = file.dirname("./Fotokalender-fotos/") for i = 1,12 do local monthname = string.lower(os.date("%B", os.time{year=year,month=i,day=1})) context.startplacefigure({number="",title=""}) context.externalfigure({i}, {width = "0.8\\textwidth"}) context.stopplacefigure() context.strut() context("\\vfill") context.startalign({"middle"}) context("\\bfa") context.labeltext(monthname) context("~") context(year) context.stopalign() context.blank() thirddata.diary.monthtableH(i,year) context.page() end end \stopluacode % Setup of the month table \startsetups table:month \setupTABLE[c] [each] [width=\dimexpr\textwidth/7, frame=on, style=\tfa] \setupTABLE[r][each][height=1.8\lineheight,align={center,lohi}] \setupTABLE[c][7][foregroundcolor=red] \stopsetups % Define the macro for calling lua \define[1]\Photocalendarpages {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}} % Setup the \TEX\ side of the document \starttext % Add a title page \startstandardmakeup[page=yes,doublesided=yes] \startplacefigure [location=middle, title=, number=] {\externalfigure[13][width=\paperwidth]} \stopplacefigure \midaligned{\bfc \labeltext{fotocal}~\getvariable{PocketDiary}{Year}} \stopstandardmakeup % Call the defined macro \Photocalendarpages{\getvariable{PocketDiary}{Year}} \stoptext [-- Attachment #3: Type: text/plain, Size: 511 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins? 2024-06-15 16:55 [NTG-context] Pocket Diary Photo Calendar: how to specify on which day the week begins? Michael Guravage @ 2024-06-15 20:49 ` Bruce Horrocks 2024-06-15 21:20 ` Michael Guravage 0 siblings, 1 reply; 4+ messages in thread From: Bruce Horrocks @ 2024-06-15 20:49 UTC (permalink / raw) To: ntg-context mailing list > On 15 Jun 2024, at 17:55, Michael Guravage <guravage@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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins? 2024-06-15 20:49 ` [NTG-context] " Bruce Horrocks @ 2024-06-15 21:20 ` Michael Guravage 2024-06-16 11:39 ` Bruce Horrocks 0 siblings, 1 reply; 4+ messages in thread From: Michael Guravage @ 2024-06-15 21:20 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 2114 bytes --] 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 <ntg@scorecrow.com> wrote: > > > > On 15 Jun 2024, at 17:55, Michael Guravage < > guravage@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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 3309 bytes --] [-- Attachment #2: moons-MP.tex --] [-- Type: text/x-tex, Size: 1613 bytes --] % 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 [-- Attachment #3: sun-MP.tex --] [-- Type: text/x-tex, Size: 3054 bytes --] % 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); endfor; for i = 18 step 36 until 180 : draw p[11] rotatedaround (center p[1],i-18); endfor; drawarrow ((0,h)--(0,0)) shifted (0,-0.05h) xscaled 0.5; \stopreusableMPgraphic \startreusableMPgraphic{Sun::Light} h := OverlayHeight; w := OverlayWidth; drawoptions (withpen pencircle scaled 0.15pt withcolor red); p[11] := ip[3]--ip[4]; p[1] := fullcircle scaled 0.25h; p[2] := tcircle scaled 0.35h; p[3] := tcircle scaled 0.5h; p[4] := tcircle scaled 0.8h; 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]; draw p[1]; for i = 36 step 36 until 360 : draw p[10] rotatedaround (center p[1],i-18); endfor; for i = 18 step 36 until 360 : draw p[11] rotatedaround (center p[1],i-18); endfor; currentpicture := currentpicture rotatedaround(center p[1],18); \stopreusableMPgraphic \defineoverlay[Sunrise][\useMPgraphic{Sun::Sunrise}] \defineoverlay[Sunset][\useMPgraphic{Sun::Sunset}] \defineoverlay[Light][\useMPgraphic{Sun::Light}] \defineframed [SunA] [strut=yes, height=\lineheight, width=\emwidth, frame=off, offset=0pt] \defineframed [SunB] [strut=yes, height=\lineheight, width=\emwidth, frame=off, offset=0pt, location=depth] % \starttext % \setupbodyfont[8pt] % This is the minimal size which looks still ok. % % Sunrise: {\SunA[background=Sunrise]{\strut}} % Sunset: \SunA[background=Sunset]{\strut} % Light hours: \SunB[background=Light]{\strut} Sunshine % % \stoptext [-- Attachment #4: Type: text/plain, Size: 511 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: Pocket Diary Photo Calendar: how to specify on which day the week begins? 2024-06-15 21:20 ` Michael Guravage @ 2024-06-16 11:39 ` Bruce Horrocks 0 siblings, 0 replies; 4+ messages in thread From: Bruce Horrocks @ 2024-06-16 11:39 UTC (permalink / raw) To: ntg-context mailing list > On 15 Jun 2024, at 22:20, Michael Guravage <guravage@gmail.com> 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-16 11:40 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-06-15 16:55 [NTG-context] Pocket Diary Photo Calendar: how to specify on which day the week begins? Michael Guravage 2024-06-15 20:49 ` [NTG-context] " Bruce Horrocks 2024-06-15 21:20 ` Michael Guravage 2024-06-16 11:39 ` Bruce Horrocks
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).