From 344dd03236ce7a31067cf768fed299127c60c7aa Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 28 Mar 2023 03:03:58 +0000 Subject: CTAN sync 202303280303 --- .../contrib/context-calendar-examples/LICENSE | 1 + .../contrib/context-calendar-examples/VERSION | 1 + .../third/calendar-examples/calendar-examples.md | 38 ++ .../t-intervalcalendar-module-doc.pdf | Bin 0 -> 103780 bytes .../t-calendar-examples/LICENSE | 1 - .../t-calendar-examples/VERSION | 1 - .../third/calendar-examples/calendar-examples.md | 38 -- .../t-intervalcalendar-module-doc.pdf | Bin 103780 -> 0 bytes .../third/calendar-examples/A5-day_per_page.tex | 427 --------------------- .../calendar-examples/A6-1week_per_2pages.tex | 359 ----------------- .../third/calendar-examples/Menu-calendar.tex | 282 -------------- .../third/calendar-examples/Photocalendar.tex | 197 ---------- .../third/calendar-examples/Sundata-calendar.tex | 424 -------------------- .../third/calendar-examples/A5-day_per_page.tex | 427 +++++++++++++++++++++ .../calendar-examples/A6-1week_per_2pages.tex | 359 +++++++++++++++++ .../third/calendar-examples/Menu-calendar.tex | 282 ++++++++++++++ .../third/calendar-examples/Photocalendar.tex | 197 ++++++++++ .../third/calendar-examples/Sundata-calendar.tex | 424 ++++++++++++++++++++ .../context/contrib/context-collatingmarks/LICENSE | 1 + .../context/contrib/context-collatingmarks/VERSION | 1 + .../doc/context/third/collating-marks/README.md | 36 ++ .../t-collatingmarks-module-doc.pdf | Bin 0 -> 140658 bytes .../t-collatingmarks-module-doc.tex | 3 + .../t-collatingmarks/LICENSE | 1 - .../t-collatingmarks/VERSION | 1 - .../doc/context/third/collating-marks/README.md | 36 -- .../t-collatingmarks-module-doc.pdf | Bin 140658 -> 0 bytes .../t-collatingmarks-module-doc.tex | 3 - .../third/collationg-marks/t-collatingmarks.tex | 177 --------- .../third/collationg-marks/t-collatingmarks.tex | 177 +++++++++ .../contrib/context-interval-calendar/LICENSE | 1 + .../contrib/context-interval-calendar/VERSION | 1 + .../t-intervalcalendar-module-doc.pdf | Bin 0 -> 103780 bytes .../t-interval-calendar/LICENSE | 1 - .../t-interval-calendar/VERSION | 1 - .../t-intervalcalendar-module-doc.pdf | Bin 103780 -> 0 bytes .../third/interval-calendar/Interval-calendar.tex | 44 --- .../third/interval-calendar/t-intervalcalendar.tex | 265 ------------- .../third/interval-calendar/Interval-calendar.tex | 44 +++ .../third/interval-calendar/t-intervalcalendar.tex | 265 +++++++++++++ 40 files changed, 2258 insertions(+), 2258 deletions(-) create mode 100644 macros/context/contrib/context-calendar-examples/LICENSE create mode 100644 macros/context/contrib/context-calendar-examples/VERSION create mode 100644 macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md create mode 100644 macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/LICENSE delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/VERSION delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex delete mode 100644 macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex create mode 100644 macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex create mode 100644 macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex create mode 100644 macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex create mode 100644 macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex create mode 100644 macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex create mode 100644 macros/context/contrib/context-collatingmarks/LICENSE create mode 100644 macros/context/contrib/context-collatingmarks/VERSION create mode 100644 macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/README.md create mode 100644 macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf create mode 100644 macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/LICENSE delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/VERSION delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/README.md delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex delete mode 100644 macros/context/contrib/context-collatingmarks/t-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex create mode 100644 macros/context/contrib/context-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex create mode 100644 macros/context/contrib/context-interval-calendar/LICENSE create mode 100644 macros/context/contrib/context-interval-calendar/VERSION create mode 100644 macros/context/contrib/context-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf delete mode 100644 macros/context/contrib/context-interval-calendar/t-interval-calendar/LICENSE delete mode 100644 macros/context/contrib/context-interval-calendar/t-interval-calendar/VERSION delete mode 100644 macros/context/contrib/context-interval-calendar/t-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf delete mode 100644 macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex delete mode 100644 macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex create mode 100644 macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex create mode 100644 macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex (limited to 'macros/context/contrib') diff --git a/macros/context/contrib/context-calendar-examples/LICENSE b/macros/context/contrib/context-calendar-examples/LICENSE new file mode 100644 index 0000000000..a7a158b93c --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/LICENSE @@ -0,0 +1 @@ +Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/VERSION b/macros/context/contrib/context-calendar-examples/VERSION new file mode 100644 index 0000000000..bcdfbcd1bb --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/VERSION @@ -0,0 +1 @@ +2023.03.23 \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md b/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md new file mode 100644 index 0000000000..d250ea54c7 --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md @@ -0,0 +1,38 @@ +# Calendar examples + +The module provides different examples of calendars, made-up using the machinery provided in the t-pocketdiary module. + +The user is completely free to change and adapt the examples to his needs. The examples are in the Public Domain. + +## A5-day_per_page.tex + +This calendar produces single page day-calendars for the whole year. The page carries in the header the month's name and the year. +On the next line it places the the day-number of the month with the day-name. This is followed by the week-number and the the day-number of the year. In the following field the name of the Christian holiday is typeset. In the last block data concerning the moon-cycle and sun data are provided. +The page is filled with a hourly schedule from 06:00 to 22:00 +The footer displays information according to the setup established in the variable set. + +This example has different modes for the production either an A5 or an A6 sized calendar. The A5 sized calendar is arranged A4 landscape paper for sections of 16 pages consisting out of 4 sheets each carrying 2 pages recto and verso. The A6 version is also arranged for sections of 16 pages typeset on A4 portrait paper. The sections consist out of 2 sheets carrying 4 pages recto and 4 pages verso. + +## A6-1week_per_2pages.tex + +The calendar is made up as a table for one week, spread over two pages. +The header displays the month's name and to the right the week-number and the year. +The table is split in two parts after Thursday. Friday and the weekend is placed on the second page. The Weekend is split into two cells on one row. +On Tuesdays moon- and sun-data are desplayed. If the day is Chrstian holiday, it is printed in red and the name of the holiday is typeset. + + +## Menu-calendar.tex + +The menu-calendar is based on week-number, i.e. in years, where the first of January is not in the first week, those days are left out. Each week is spread over two pages. +The header shows the month's name and to the right the week-number. +The year is typeset in the footer. +Each day shows the day-number and the name of the day. Christian holidays are marked red and the name of the holiday is typeset right to the day-name. There is a larger space for notes concerning the menu and each day has a "Comment" line. + +## Photocalendar.tex + +The Phorocalendar is made-up on A4 paper. It contains a title page with one picture, followed by 12 pages each reserved for one month. On each of those pages there is a picture and at the bottom a month-table is placed. Centered above the table the month's name and the year is typeset. This example is set-up such, that one can only put either landscape or portrait pictures. + +## Sundata-calendar.tex + +This calendar puts the moon- and sun-data per day in a table. It is arranged as a A6-booklet consisting out of two sections. Sewn together and set into a cover this gives a handy brochure to keep track of moon-cycle and the dayly sunrise, sunset and day-light hours. + diff --git a/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf b/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf new file mode 100644 index 0000000000..a97245c510 Binary files /dev/null and b/macros/context/contrib/context-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf differ diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/LICENSE b/macros/context/contrib/context-calendar-examples/t-calendar-examples/LICENSE deleted file mode 100644 index a7a158b93c..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/LICENSE +++ /dev/null @@ -1 +0,0 @@ -Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/VERSION b/macros/context/contrib/context-calendar-examples/t-calendar-examples/VERSION deleted file mode 100644 index bcdfbcd1bb..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/VERSION +++ /dev/null @@ -1 +0,0 @@ -2023.03.23 \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md b/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md deleted file mode 100644 index d250ea54c7..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/calendar-examples.md +++ /dev/null @@ -1,38 +0,0 @@ -# Calendar examples - -The module provides different examples of calendars, made-up using the machinery provided in the t-pocketdiary module. - -The user is completely free to change and adapt the examples to his needs. The examples are in the Public Domain. - -## A5-day_per_page.tex - -This calendar produces single page day-calendars for the whole year. The page carries in the header the month's name and the year. -On the next line it places the the day-number of the month with the day-name. This is followed by the week-number and the the day-number of the year. In the following field the name of the Christian holiday is typeset. In the last block data concerning the moon-cycle and sun data are provided. -The page is filled with a hourly schedule from 06:00 to 22:00 -The footer displays information according to the setup established in the variable set. - -This example has different modes for the production either an A5 or an A6 sized calendar. The A5 sized calendar is arranged A4 landscape paper for sections of 16 pages consisting out of 4 sheets each carrying 2 pages recto and verso. The A6 version is also arranged for sections of 16 pages typeset on A4 portrait paper. The sections consist out of 2 sheets carrying 4 pages recto and 4 pages verso. - -## A6-1week_per_2pages.tex - -The calendar is made up as a table for one week, spread over two pages. -The header displays the month's name and to the right the week-number and the year. -The table is split in two parts after Thursday. Friday and the weekend is placed on the second page. The Weekend is split into two cells on one row. -On Tuesdays moon- and sun-data are desplayed. If the day is Chrstian holiday, it is printed in red and the name of the holiday is typeset. - - -## Menu-calendar.tex - -The menu-calendar is based on week-number, i.e. in years, where the first of January is not in the first week, those days are left out. Each week is spread over two pages. -The header shows the month's name and to the right the week-number. -The year is typeset in the footer. -Each day shows the day-number and the name of the day. Christian holidays are marked red and the name of the holiday is typeset right to the day-name. There is a larger space for notes concerning the menu and each day has a "Comment" line. - -## Photocalendar.tex - -The Phorocalendar is made-up on A4 paper. It contains a title page with one picture, followed by 12 pages each reserved for one month. On each of those pages there is a picture and at the bottom a month-table is placed. Centered above the table the month's name and the year is typeset. This example is set-up such, that one can only put either landscape or portrait pictures. - -## Sundata-calendar.tex - -This calendar puts the moon- and sun-data per day in a table. It is arranged as a A6-booklet consisting out of two sections. Sewn together and set into a cover this gives a handy brochure to keep track of moon-cycle and the dayly sunrise, sunset and day-light hours. - diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf b/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf deleted file mode 100644 index a97245c510..0000000000 Binary files a/macros/context/contrib/context-calendar-examples/t-calendar-examples/doc/context/third/calendar-examples/t-intervalcalendar-module-doc.pdf and /dev/null differ diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex b/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex deleted file mode 100644 index 6dd5c69843..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex +++ /dev/null @@ -1,427 +0,0 @@ -% Context file -% Filename: A5-day_per_page.tex -% -% 14-01-2023 -% Created by Willi Egger, w.egger@boede.nl -% This document is in the Public Domain. - -% This is an example of how to use the PocketDiary-module outside the built-in -% structure of a PocketDiary. -% In order to use this example you need to have the PocketDiary-module -% installed from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 -% If you want collating marks placed on the outermost sheet of a section, -% then you need to install also the Collatingmarks-module from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 -% The used imposition scheme is contained in the \CONTEXT\ distro. - -% This is an example how to prepare a calendar, where each page contains one -% day. On the left side there is a time-schedule starting at 06:00 ending -% at 22:00. The header contains left the month and right the year. Below the -% header there is a table showing left the day and the short dayname followed by -% the week number and the day number of the year. If the day in question is a -% Christian holiday, then the name of it is stated in the center. -% To the right astronomical data -% are shown: Lunar days/moon phase, sun rise, sun set and light hours. -% In order to have complete section at the end of the calendar a number of -% pages with lines are added. - -\usemodule[pocketdiary] -\usemodule[collatingmarks][Collatingmarks=yes] - -% define the different modes to enable the international interface: - -\definemode[English,Dutch,German,French,Italian,Spanish][keep] - -\enablemode[English] -% \enablemode[German] -% \enablemode[Dutch] -% \enablemode[Italian] -% \enablemode[French] -% \enablemode[Spanish] - -% The variable sets for the PocketDiary module: - -\setvariables - [PocketDiary] - [Year=2023, - Week=1, - Day=1, - Month=1, - Nextyear=yes, - Yearnext=2024] - -\setvariables - [PocketDiaryFooter] - [Lefttext={\jobname .pdf}, - Centertext=\pagenumber, - Righttext=] - -\setvariables - [PocketDiaryColors] - [Separatorline=blue, - Gridline={s=.75}] - -\setvariables - [PocketDiaryGeoPosition] - [lat=52.467860, - lon=16.981240, - timezoneoffset=1, - continent=EU] % EU, US or empty for no Daylight Saving Time (DST) - -\setvariables - [PocketDiaryAddress] - [Familyname=YourFamilyName, - Forename=YourName, - Street=YourStreet and Number, - Zipcode=YourPostalCode, - City=YourPlace, - Country=YourCountry, - Phone=YourPhoneNumber, - Mobile=YourMobilePhoneNumber, - E-mail=YourEmail@YourProvider, - Web=YourWWW] - -\setupbodyfont[ibmplex,ss,10pt] - -\definefontfeature[f:Tabular][tnum=yes] - -\addfeature[f:Tabular] - -\startmode[English] - \mainlanguage[en] -\stopmode - -\startmode[German] - \mainlanguage[de] -\stopmode - -\startmode[French] - \mainlanguage[fr] -\stopmode - -\startmode[Italian] - \mainlanguage[it] -\stopmode - -\startmode[Spanish] - \mainlanguage[es] -\stopmode - -% The document is double sided printed, the page number will be set in the \setupfootertexts: - -\setuppagenumbering[alternative=doublesided,location=] - -\setuppapersize[A5][A4,landscape] -% \setuppapersize[A5][A5] - -% Adapt the page layout to the size of the page: - -\setuplayout - [topspace=.6cm, - backspace=1.5cm, - header=2\bodyfontsize, - headerdistance=.5\bodyfontsize, - footer=1.2\bodyfontsize, - footerdistance=.5\bodyfontsize, - margin=0pt, - height=middle, - width=middle, - location=middle] - -% Enable the imposition: 2 pages recto and verso using 4 sheets of A4 for forming one section - -\setuparranging[2*2*4] - -% Setup of the Collating marks module: - -\setupMPvariables % for collatingmarks - [pages=8, % pages per sheet of paper doublesided - sheets=2, % sheets of paper used per section - horpageshift=-0.5mm] - -% \showframe - -% Let Lua do the work: - -\startluacode - - local report = logs.reporter("Calendar-1-day-per-page") - - function thirddata.diary.year_of_monthtables( - year,lat,lon,timeoffset,continent) - - report("Working in function: diary.year_of_monthtables") - - for i = 1,12 do - local monthname = string.lower(os.date - ("%B",os.time{year=year,month=i,day=1})) - - thirddata.diary.header_text(monthname,year) - - thirddata.diary.monthblock(i,year,lat,lon,timeoffset,continent) - end - end - - function thirddata.diary.monthblock(month,year,lat,lon,timeoffset,continent) - - report("Working in function diary.monthblock") - - local nofdays = 1 - - local monthname = thirddata.calendar.select_nameofmonth(month,year) - local yeardays = thirddata.calendar.isleapyear(year) - - if month == 2 and yeardays == 366 then - nofdays = thirddata.calendar.nofdays_month(month,year) + 1 - else - nofdays = thirddata.calendar.nofdays_month(month,year) - end - - --report("Number of days in month: %s", nofdays) - - for i = 1,nofdays do - local ordinalday = thirddata.calendar.ordinalday(i,month,year) - local weeknumber = thirddata.calendar.weeknumber(i,month,year) - local dayname = string.lower(os.date ("%a",os.time{day=i,month=month,year=year})) - local holiday = thirddata.calendar.checkchristianfeast(i,month,year) - local moondata = thirddata.moonphase.lunardays(year,month,i) - local dst_start,dst_stop = thirddata.diary.DST(year,continent) - local sunrise,sunset,lighthours = - thirddata.srss.sundata( - i,month,year,lat,lon,timeoffset,dst_start,dst_stop) - - if holiday ~= "" then - report("Holiday: %s", holiday) - report("Day number: %s", i) - end - - context.bTABLE({setups="table:dayblock"}) - context.bTR() - context.bTD() - context.starttabulate{"|lw(0.1\\textwidth)|p(0.06\\textwidth)|p|"} - context.NC() - context("\\bf") - --report("Daynumber: %s Month %s", i,month) - if dayname == "sun" or holiday ~= "" and holiday ~= "ashw" then - local dnu = i - local dna = dayname - context.color({"red"}, - function() context(dnu) end) --day number - context("~") - context.color({"red"}, - function() context.labeltext(dna) end)--dayname - else - context(i) --day - context("~") - context.labeltext(dayname) --dayname - end - context.NC() - context.switchtobodyfont{"6pt"} - context.labeltext("week") - context(":") - context.par() - context(weeknumber) - context.NC() - context.switchtobodyfont{"6pt"} - context.labeltext("day") - context(":") - context.par() - context(ordinalday) - context("/") - context(yeardays) - context.NC() - context.NR() - context.stoptabulate() - context.eTD() - context.bTD() - context.starttabulate{"|lw(0.2\\textwidth)|p|p|p|p|"} - context.NC() - if holiday == "" then - context.strut() - else - context.labeltext(holiday) - end - context.NC() - if tonumber(moondata) then - context.labeltext("moondays") - else - context.labeltext("moon") - end - context(":~") - context.par() - context(moondata) - context.NC() - context("\\SunA[background=Sunrise]{}") - context.par() - context(sunrise) - context.NC() - context("\\SunA[background=Sunset]{}") - context.par() - context(sunset) - context.NC() - context("\\SunB[background=Light]{}") - context.par() - context(lighthours) - context.NC() - context.NR() - context.stoptabulate() - context.eTD() - context.eTR() - context.eTABLE() - context.page() - end - end - - function thirddata.diary.header_text(monthname,year) - context.setupheadertexts( - {function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - {function() - context(year) - return true - end - }, - {function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - {function() - context(year) - return true - end - }) - end - -\stopluacode - -\startsetups[table:dayblock] - \setupTABLE[each][each][frame=off] - \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] - \setupTABLE[c][1][width=0.35\textwidth,align=lohi] - \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups - -\define[5]\Yearofmonthtables{% - \ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} - - -\startbuffer[Yearofmonthtables] - \Yearofmonthtables %Year,lat,lon,timeoffset,continent - {\getvariable{PocketDiary}{Year}} - {\getvariable{PocketDiaryGeoPosition}{lat}} - {\getvariable{PocketDiaryGeoPosition}{lon}} - {\getvariable{PocketDiaryGeoPosition}{timeoffset}} - {"\getvariable{PocketDiaryGeoPosition}{continent}"} -\stopbuffer - -% Create a time-table as a background to the page - -\startreusableMPgraphic{Time-Lines} - numeric w; w:= OverlaytWidth; - numeric h; h:= (OverlayHeight-2cm)/18; - numeric t; - path p,q; - p := unitsquare xscaled OverlayWidth yscaled (OverlayHeight-2cm); - - q:= llcorner p -- lrcorner p; - draw q withpen pencircle scaled .5pt - withcolor \MPcolor{Grid}; - for i = 1 upto 17: - draw q shifted (0,i*h) withpen pencircle scaled .5pt - withcolor \MPcolor{Grid}; - t := 24 - 1 - i ; - label.top(textext(""& decimal t & ":00"),point 0 of q) - shifted (15pt,((i-1)*h)+1pt); - endfor; -\stopreusableMPgraphic - -\defineoverlay[Textbackground][\reuseMPgraphic{Time-Lines}] - -% Implement international interface: -\setuplabeltext[en][title=Title] -\setuplabeltext[nl][title=Titel] -\setuplabeltext[de][title=Titel] -\setuplabeltext[fr][title=Titre] -\setuplabeltext[it][title=Titolo] -\setuplabeltext[es][title=Título] - -\setuplabeltext[en][author=Author] -\setuplabeltext[nl][author=Auteur] -\setuplabeltext[de][author=Autor] -\setuplabeltext[fr][author=Auteur] -\setuplabeltext[it][author=autore] -\setuplabeltext[es][author=Autor] - -\setuplabeltext[en][typography=Typography] -\setuplabeltext[nl][typography=Typografie] -\setuplabeltext[de][typography=Typographie] -\setuplabeltext[fr][typography=Typographie] -\setuplabeltext[it][typography=Tipografia] -\setuplabeltext[es][typography=Tipografía] - -\setuplabeltext[en][compilation=Compilation date] -\setuplabeltext[nl][compilation=Compilatie datum] -\setuplabeltext[de][compilation=Kompilationsdatum] -\setuplabeltext[fr][compilation=Date de compilation] -\setuplabeltext[it][compilation=Dato di compilazione] -\setuplabeltext[es][compilation=Fecha de compilación] - -% Setup the TeX side of the document: - -\starttext - - \startstandardmakeup[page=yes,doublesided=no] - \strut - \startalignment [middle] - \godown[.3\textheight] - {\bfa \labeltext{calendar}} - \vfil - {\bf \getvariable{PocketDiary}{Year}} - \stopalignment - \stopstandardmakeup - - \startstandardmakeup[page=yes,doublesided=no] - \starttabulate[|l|p|] - \NC \labeltext{title} - \EQ {\bf \labeltext{calendar}} \NC\NR - \NC \labeltext{author} - \EQ \getvariable{PocketDiaryAddress}{Forename} - \getvariable{PocketDiaryAddress}{Familyname} \NC\NR - \NC \labeltext{typography} - \EQ \CONTEXT\ with \LUAMETATEX \NC\NR - \NC \labeltext{compilation} - \EQ \currentdate \NC\NR - \stoptabulate - \stopstandardmakeup - - \getbuffer[Lost-Returnto] - - \setupbackgrounds[text][background=] - - \setupbackgrounds[text][background=Textbackground] - - \getbuffer[Yearofmonthtables] - - \setupbackgrounds[text][background=] - - \getbuffer[Yearcurrentplan] - - \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}] - - \getbuffer[Yearnextplan] - - \dorecurse - {3} - {\getbuffer[Todo]} - - \dorecurse - {10} - {\getbuffer[Lines]} - -\stoptext diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex b/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex deleted file mode 100644 index ea25de5f9a..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex +++ /dev/null @@ -1,359 +0,0 @@ -% Context file -% Filename: A6-1week_per_2pages.tex -% -% 14-01-2023 -% Created by Willi Egger, w.egger@boede.nl -% This document is in the Public Domain. - -% This is an example of how to use the PocketDiary-module outside the built-in -% structure of a PocketDiary. -% In order to use this example you need to have the PocketDiary-module -% installed from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 -% If you want collating marks placed on the outermost sheet of a section, -% then you need to install also the Collatingmarks-module from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 -% The used imposition scheme is contained in the \CONTEXT\ distro. - -% This is an example how to prepare a calendar, where two facing pages carry -% one week as a table. Saturday and Sunday are placed together in one row. -% The header contains the month name to the left and the week number and the -% year to the right. -% The footer contains three fields. The first contains the job-name, the center -% field shows the page number, the right field is not filled. -- However -% this can easily be changed in the variable set "PocketDiaryFooter". -% Each row of the week-table shows top left the day number followed by the short -% name of the day. Next to this the ordinal day number of the year is typeset. -% If the day in question is a Christian holiday, then its name is placed next -% to the general information. -% This example supports 6 languages i.e. English, German, Dutch, French, -% Italian and Spanish. The respective interface is activated by enabling the -% respective mode -% The original idea was to have an A6 calendar, where 4 pages are print on -% A4 paper. This is activated by enabling the mode "A6". By activating the mode -% "A5" the calendar is prepared A5 sized on a A4 landscape paper. -% Because there are astronomical data concerning the sun rise, sun set times it -% is necessary to fill in the correct geo-positional data in the variable set -% "PocketDiaryGeoPosition". - -\usemodule[pocketdiary] -\usemodule[collatingmarks][Collatingmarks=yes] - -\definemode[English,Dutch,German,French,Italian][keep] -\definemode[A5,A6][keep] - -\enablemode[English] -% \enablemode[German] -% \enablemode[Dutch] -% \enablemode[Italian] -% \enablemode[French] -% \enablemode[Spanish] - -\enablemode[A6] -% \enablemode[A5] - -\setvariables - [PocketDiary] - [Year=2023, - Week=1, - Day=1, - Month=1, - Nextyear=yes] - -\setvariables - [PocketDiaryFooter] - [Lefttext={\jobname .pdf}, - Centertext=\pagenumber, - Righttext=] - -\setvariables - [PocketDiaryColors] - [Separatorline=blue, - Gridline={s=.75}] - -\setvariables - [PocketDiaryGeoPosition] - [lat=52.467860, - lon=16.981240, - timezoneoffset=1, - continent=EU] % Eu, US or empty for no Daylight Saving Time (DST) - -\setvariables - [PocketDiaryAddress] - [Familyname=YourFamilyName, - Forename=YourName, - Street=YourStreet and Number, - Zipcode=YourPostalCode, - City=YourPlace, - Country=YourCountry, - Phone=YourPhoneNumber, - Mobile=YourMobilePhoneNumber, - E-mail=YourEmail@YourProvider, - Web=YourWWW] - -\setupbodyfont[ibmplex,ss,10pt] - -\definefontfeature[f:Tabular][tnum=yes] - -\addfeature[f:Tabular] - -\startmode[English] - \mainlanguage[en] -\stopmode - -\startmode[German] - \mainlanguage[de] -\stopmode - -\startmode[French] - \mainlanguage[fr] -\stopmode - -\startmode[Italian] - \mainlanguage[it] -\stopmode - -\startmode[Spanish] - \mainlanguage[es] -\stopmode - -\setuppagenumbering[alternative=doublesided,location=] - -\setuplayout - [topspace=.6cm, - backspace=1cm, - header=2\bodyfontsize, - headerdistance=.5\bodyfontsize, - footer=1.2\bodyfontsize, - footerdistance=.5\bodyfontsize, - margin=0pt, - height=middle, - width=middle, - location=middle] - -\startmode[A6] - \definepapersize[Agenda][width=100mm,height=140mm] - - \setuppapersize[Agenda][A4,portrait] - - % The vertical page-shift enables to make a 2.5mm cut at the head of the - % section - \definepageshift - [ver] - [vertical] - [2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm, - 2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm] - - \setuppageshift[paper][ver] - - \setuparranging[2*4*2] - - \setupMPvariables % for collating marks - [pages=8, % pages per sheet of paper doublesided - sheets=2, % sheets of paper used per section - horpageshift=-0.5mm] -\stopmode - -\startmode[A5] - \definepapersize[Agenda][width=148mm,height=210mm] - - \setuppapersize[Agenda][A4,landscape] - - \setuparranging[2*2*4] - - \setupMPvariables % for collatingmarks - [pages=4, % pages per sheet of paper doublesided - sheets=4, % sheets of paper used per section - horpageshift=0mm] -\stopmode - -% Let Lua the main work: - -\startluacode - - local report = logs.reporter("Calendar-1-week-per-2-pages") - - function thirddata.diary.year_of_weektables(year, - lat,lon,timeoffset,continent) - - local year = year - local lat = lat - local lon = lon - local timeoffset = timeoffset - local continent = continent - - report("Working in function: diary.year_of_weektables") - - for i = 1,12 do --i is month - thirddata.diary.monthblock(i,year,lat,lon,timeoffset,continent) - end - end - - function thirddata.diary.monthblock(month,year, - lat,lon,timeoffset,continent) - - report("Working in function diary.monthblock: %s", month) - - local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month - local wkf = thirddata.calendar.weeknumber(1,month,year) --weeknumber of 1st day of a given month - - local wkl = wkf + c - 1 -- last week of a given month based on wkf and c, is wrong for January - - --report("Weeks in the selected month: %s", c) - --report("First week of month: %s", wkf) - - if month == 1 and wkf > 51 then - - --report("Calculating in week number %s", wkf) - - thirddata.diary.setup_header_texts(wkf,month,year) - year = year - 1 - thirddata.diary.thisweek(wkf,year,lat,lon,timeoffset,continent) - year = year + 1 - wkf = 1 - wkl = wkf + c - 2 - - for i = wkf, wkl do - thirddata.diary.setup_header_texts(i,month,year) - thirddata.diary.thisweek(i,year,lat,lon,timeoffset,continent) - end - else - for i = wkf, wkl do - - --report("Calculating in week number %s", i) - - thirddata.diary.setup_header_texts(i,month,year) - thirddata.diary.thisweek(i,year, - lat,lon,timeoffset,continent) - end - end - end - - - function thirddata.diary.setup_header_texts(week,month,year) - - local monthname = string.lower(os.date - ("%B",os.time{year=year,month=month,day=1})) - - context.setupheadertexts( - {function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - {function() - context.labeltext("week") - context(": ~") - context(week) - context("\\quad") - context(year) - return true - end - }, - {function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - {function() - context.labeltext("week") - context(": ~") - context(week) - context("\\quad") - context(year) - return true - end - }) - end - -\stopluacode - -\startsetups[table:week] - \setupTABLE[split=yes] - \setupTABLE[each][each][frame=on] - \setupTABLE - [r] - [each] - [offset=0pt, - loffset=3pt, - roffset=3pt, - height=0.23\textheight] - \setupTABLE[c][1][width=0.5\textwidth] - \setupTABLE[c][2][width=0.5\textwidth] -\stopsetups - -\define[5]\Yearofweektables{\ctxlua{thirddata.diary.year_of_weektables(#1,#2,#3,#4,#5)}} - - -\startbuffer[Yearofweektables] - \Yearofweektables %Year,lat,lon,timeoffset,continent - {\getvariable{PocketDiary}{Year}} - {\getvariable{PocketDiaryGeoPosition}{lat}} - {\getvariable{PocketDiaryGeoPosition}{lon}} - {\getvariable{PocketDiaryGeoPosition}{timeoffset}} - {"\getvariable{PocketDiaryGeoPosition}{continent}"} -\stopbuffer - -\starttext - - \startstandardmakeup[page=yes,doublesided=no] - \strut - \godown[.3\textheight] - \startalignment [middle] - {\bfa \labeltext{calendar}} - \vfil - {\bf \getvariable{PocketDiary}{Year}} - \stopalignment - \stopstandardmakeup - - \startstandardmakeup[page=yes,doublesided=no] - \starttabulate[|l|p|] - \NC \translate[en=Title, - nl=Titel, - de=Titel, - fr=Titre, - it=Titolo] - \EQ {\bf \labeltext{calendar}} \NC\NR - \NC \translate[en=Author, - nl=Auteur, - de=Autor, - fr=Auteur, - it=autore, - es=Autor] - \EQ \getvariable{PocketDiaryAddress}{Forename} - \getvariable{PocketDiaryAddress}{Familyname} \NC\NR - \NC \translate[en=Typography, - nl=Typografie, - de=Typographie, - fr=Typographie, - it=Tipografia, - es=Tipografía] - \EQ \CONTEXT\ with \LUAMETATEX \NC\NR - \NC \translate[en=Compilation date, - nl=Compilatie datum, - de=Kompilationsdatum, - fr=Date de compilation, - it=Dato di compilazione, - es=Fecha de compilación] - \EQ \currentdate \NC\NR - \stoptabulate - \stopstandardmakeup - - \getbuffer[Lost-Returnto] - - \getbuffer[Yearcurrentplan] - - \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}+1] - - \getbuffer[Yearnextplan] - - \setupheadertexts[] - - \getbuffer[Yearofweektables] - - \dorecurse - {13} - {\getbuffer[Lines]} -\stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex b/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex deleted file mode 100644 index 135994f9d8..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex +++ /dev/null @@ -1,282 +0,0 @@ -% Context file -% Filename: Menu-calender.tex -% -% 14-01-2023 -% Created by Willi Egger w.egger@boede.nl -% This file is in the Public Domain - -% This is an example of how to use the PocketDiary-module outside the built-in -% structure of a PocketDiary. -% In order to use this example you need to have the PocketDiary-module -% installed from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 -% If you want collating marks placed on the outermost sheet of a section, -% then you need to install also the Collatingmarks-module from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 -% The used imposition scheme is contained in the \CONTEXT\ distro. - -\usemodule[pocketdiary] -\usemodule[collatingmarks][Collatingmarks=yes] - -% Choose your font - -\setupbodyfont[ibmplex,ss,10pt] - -% Add a path to the picture placed on page 3: - -\setupexternalfigures - [directory=/Users/willi/Documents/TEXdata - /Koken/Grossmutters-Guetzli-Rezepte/] - -% Choose the main language it determines the interface: - -\mainlanguage[en] - -% This document will be doublesided, the pagenumber will be placed in the footer by means of \setupfootertexts: -\setuppagenumbering[alternative=doublesided,location=] - -% The calendar has a pagesize of A6 and with the imposition 4 pages recto and verso are placed on a A4. Two sheets of A4 form one section: - -%\setuppapersize[A6][A4] -\setuppapersize[A5][A4,landscape] - -% \setuparranging[2*4*2] -%\setuparranging[2*2*4] -\setuparranging[2SIDE] - -% The module Collating marks needs appropriate information: - -% \setupMPvariables -% [pages=8, % pages per sheet of paper doublesided -% sheets=2, % sheets of paper used per section -% horpageshift=0mm] -\setupMPvariables - [pages=4, % pages per sheet of paper doublesided - sheets=4, % sheets of paper used per section - horpageshift=0mm] - - -% Adapt the layout of the page to the size of the page: -\setuplayout - [topspace=.6cm, - backspace=.6cm, - header=2\bodyfontsize, - headerdistance=.5\bodyfontsize, - footer=1.2\bodyfontsize, - footerdistance=.5\bodyfontsize, - margin=0pt, - height=middle, - width=middle, - location=middle] - -% Variable sets from the PocketDiary module to be set: - -\setvariables - [PocketDiary] - [Year=2023] - -\setvariables - [PocketDiaryFooter] - [Lefttext=\labeltext{menu}-\labeltext{calendar}, - Centertext=\pagenumber, - Righttext=\getvariable{PocketDiary}{Year}] - -\setvariables - [PocketDiaryColors] - [Separatorline=blue, - Gridline={s=.75}] - -% The data are presented in table form. The setup of the table: - -\startsetups table:week - \setupTABLE[split=yes] - \setupTABLE[c][1][width=.35\textwidth,frame=off] - \setupTABLE[c][2][width=.65\textwidth,frame=off] - \setupTABLE[r][height=2\lineheight,align=lohi] - \setupTABLE[r][2,3,5,6,8,9,11,12,14,15,17,18,20,21][bottomframe=on] -\stopsetups - -% There are currently 6 interfaces supported: - -% English interface -\setuplabeltext[en][menu=Menu] -\setuplabeltext[en][comment=Comment] - -% German interface -\setuplabeltext[de][menu=Menü] -\setuplabeltext[de][comment=Kommentar] - -% French interface -\setuplabeltext[fr][menu=Menu] -\setuplabeltext[fr][comment=Commentaire] - -% Dutch interface -\setuplabeltext[nl][menu=Menu] -\setuplabeltext[nl][comment=Commentaar] - -% Italian interface -\setuplabeltext[it][menu=Menu] -\setuplabeltext[it][comment=Commento] - -% Spanish interface -\setuplabeltext[es][menu=Menú] -\setuplabeltext[es][comment=Comentario] - - -% The lua code performing all the magic: - -\startluacode - - local report = logs.reporter("Menu calendar") - - function thirddata.calendar.menuweektable(mondaytimestamp,year,w) - local stamp = mondaytimestamp - local year = year - local week = w - local daynumber,dayname,monthname,holiday - - local day = stamp + 1 * 24 * 60 * 60 - - report("Working in function: thirddata.calendar.menuweektable") - - local monthname = string.lower(os.date("%B",day)) - - --report("Month: %s Week: %s", monthname,week) - - thirddata.calendar.myheadertext(monthname,week) - - context.bTABLE({setups="table:week"}) - - for i = 1,7 do - local day = stamp + i * 24 * 60 * 60 - - --report("Day-inloop: %s", day) - - daynumber = tonumber(os.date("%d",day)) --day number - dayname = string.lower(os.date("%a",day)) -- day name short - monthnumber = tonumber(os.date("%m",day)) -- month name - holiday = thirddata.calendar.checkchristianfeast(daynumber,monthnumber,year) -- Christian holida - - if holiday ~= "" then - report("Holiday (before table row): %s", holiday) - report("Day number (before table row): %s", daynumber) - report("Day name (before table row): %s",dayname) - end - - context.bTR() - context.bTD({style="bfa"}) - - if dayname == "sun" or holiday ~= "" and f ~= "ashw" then - local dnu = daynumber - local dna = dayname - context.color({"red"},function() context(dnu) end) - context("~") - context.color({"red"},function() context.labeltext(dna) end) - else - context(daynumber) - context("~") - context.labeltext(dayname) - end - context.eTD() - context.bTD() - context.labeltext(holiday) - context.eTD() - context.eTR() - context.bTR() - context.bTD({nx="2"}) - context.labeltext("menu") - context.eTD() - context.eTR() - context.bTR() - context.bTD({nx="2"}) - context.labeltext("comment") - context.eTD() - context.eTR() - end - context.eTABLE() - context.page({"yes"}) - end - - function thirddata.calendar.myheadertext(monthname,week) - - report("Working in function myheadertext") - - context.setupheadertexts{ - function() - context("\\bgroup\\bfa") - context.labeltext(monthname) - context("\\egroup") - context("\\hfill") - context.labeltext("week") - context(": ") - context(week) - return true - end} - end - - function thirddata.calendar.week(weeknumber,year) - local w = weeknumber - local year = year - local month = thirddata.calendar.select_month(1,w,year) - local mondaytimestamp = thirddata.calendar.weekcalendar(w,month,year) - - report("Working in function: thirddata.calendar.week") - --report("Mondaytimestamp %s", mondaytimestamp) - - thirddata.calendar.menuweektable(mondaytimestamp,year,w) - end - -\stopluacode - -% We need a macro to call the lua-code: this macro has two parameters week number and year - -\define[2]\MenuWeektable{\ctxlua{thirddata.calendar.week(#1,#2)}} - -% \showframe - -% The setup of the document at the TeX-side: - -\starttext - \startstandardmakeup[page=yes,doublsided=yes] - \strut - \godown[.3\textheight] - \startalignment [middle] - {\bfc \labeltext{menu}-\labeltext{calendar}} - \vfill - {\tfa \getvariable{PocketDiary}{Year}} - \stopalignment - \vfil - \stopstandardmakeup - - \setupheadertexts[][] - - \strut\vfil - - \startplacefigure - [number=, - title=, - location=middle] - {\externalfigure[YourPicture.jpg][width=0.75\textwidth]} - \stopplacefigure - - \vfill - - \page - - \setups{Footertext} - - \dorecurse{52} - {\setvariables - [PocketDiary] - [Week=\recurselevel] - \MenuWeektable{\recurselevel}{\getvariable{PocketDiary}{Year}}\page} - - \page - - \setupheadertexts[\bf \labeltext{notes}] - - \dorecurse - {3} - {\strut\page} -\stoptext - diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex b/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex deleted file mode 100644 index f55b954e14..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex +++ /dev/null @@ -1,197 +0,0 @@ -% Context file -% Filename: Photocalendar.tex -% -% 14-01-2023 -% Created by Willi Egger, w.egger@boede.nl -% This file is in the Public Domain - -% Mind you that Thomas Schmitz put on the \CONTEXT -wiki a lua-script, which -% creates a tex-file which can be compiled with \CONTEXT\ already back in 2007 -% for the preparation of a photo-calendar. -% The nice thing about it is, that it uses a small number of formulae. Nice is, -% that it also uses the Sohael Babwani formulae. See: -% https://wiki.contextgarden.net/Calendar_script - -% This example file creates a photo calendar based on the PocketDiary-module. -% In order to use this example you need to have the PocketDiary-module -% installed from: -% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 - -% The calendar is typeset on A4 portrait. The calendar is a flip-over type, -% where in the top-part is a photo and thereunder the month-table with -% indication of the month name and year. -% The pictures to be used are placed in a subdirectory. Each picture gets -% a symbolic name (number) to be used in the \dorecurse loop. -% For completing the calendar we need 13 pictures. The picture 13 is used on -% the title page. -% This file supports 6 languages, which are selected through the \mainlanguage[] - - -\usemodule[pocketdiary] - -\setupbodyfont[ibmplex,ss,12pt] - -\setuppagenumbering[location=] - -\setuppapersize[A4,portrait][A4,portrait] - -\setuplayout - [topspace=20mm, - backspace=8.6mm, - header=0pt, - footer=0pt, - height=middle, - width=middle] - -% Supported languages: en, de, nl, fr, it, es -\mainlanguage[en] - -% Where to find the calendar pictures -\setupexternalfigures - [directory=./MyPhotoDirectory] - -% Give pictures symbolic names for using in a loop -\useexternalfigure - [1] - [A.jpg] - -\useexternalfigure - [2] - [B.jpg] - -\useexternalfigure - [3] - [C.jpg] - -\useexternalfigure - [4] - [D.jpg] - -\useexternalfigure - [5] - [E.jpg] - -\useexternalfigure - [6] - [F.jpg] %[TV-Kasten-Flurin.jpg] - -\useexternalfigure - [7] - [G.jpg] - -\useexternalfigure - [8] - [H.jpg] - -\useexternalfigure - [9] - [I.jpg] - -\useexternalfigure - [10] - [J.jpg] - -\useexternalfigure - [11] - [K.jpg] - -\useexternalfigure - [12] - [L.jpg] - -\useexternalfigure - [13] - [M.jpg] - -% Setup the variables for the Pocket diary, only year is used for the title page and the variable passed to Lua. - -\setvariables - [PocketDiary] - [Year=2023] - -% Let the header and the footer be empty: - -\setupheadertexts[][] - -\setupfootertexts[][] - -% Add 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}] - -% Lua is performing 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 - -% The setup of the table with the day numbers: - -\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 - -% We need a simple macro with one parameter to call the lua-code: - -\define[1]\Photocalendarpages - {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}} - -% Layout of the TeX part of the calendar: - -\starttext - -\startstandardmakeup[page=yes,doublesided=yes] - \startplacefigure - [location=middle, - title=, - number=] - {\externalfigure[13][width=\paperwidth]} - \stopplacefigure - \midaligned{\bfc \labeltext{fotocal}~\getvariable{PocketDiary}{Year}} -\stopstandardmakeup - -\Photocalendarpages{\getvariable{PocketDiary}{Year}} - -\stoptext - - diff --git a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex b/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex deleted file mode 100644 index 18726204cb..0000000000 --- a/macros/context/contrib/context-calendar-examples/t-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex +++ /dev/null @@ -1,424 +0,0 @@ -% Context file -% Filename: Sundata-calendar.tex -% -% 13-07-2022 -% Copyright (c) 2022 BOEDE. All rights reserved. -% -% \nopdfcompression -% \enabletrackers[context.trace] -% \enabletrackers[system.jobfiles] - -\usemodule[pocketdiary] -\usemodule[collatingmarks][Collatingmarks=yes] - -\definemode[English,Dutch,German,French,Italian,Spanish][keep] - -\enablemode[English] -% \enablemode[German] -% \enablemode[Dutch] -% \enablemode[Italian] -% \enablemode[French] -%\enablemode[Spanish] - -\setvariables - [PocketDiary] - [Year=2023, - Week=1, - Day=1, - Month=1, - Nextyear=no, - Place=Sambeek, - Country=NL] - -\setvariables - [PocketDiaryFooter] - [Lefttext={\jobname .pdf}, - Centertext=\pagenumber, - Righttext=] - -\setvariables - [PocketDiaryColors] - [Separatorline=blue, - Gridline={s=.75}] - -\setvariables %Koziegłowy 52.467860,16.981240 //52.5921425,6.0962685, % Hasselt - [PocketDiaryGeoPosition] - [lat=51.63682, %Sambeek Maasstraat 2A (Google Maps) - lon=5.96655, %Sambeek, Maasstraat 2A (Google Maps) - timezoneoffset=1, - continent=EU] %EU, US or empty for no DST - -\setupbodyfont[ibmplex,ss,10pt] -% \usetypescriptfile[type-seravek] -% \usetypescript[Seravek] -% \setupbodyfont[Seravek,ss,10pt] - -% Modes for the international interface - -\startmode[English] - \mainlanguage[en] -\stopmode - -\startmode[Dutch] - \mainlanguage[nl] -\stopmode - -\startmode[German] - \mainlanguage[de] -\stopmode - -\startmode[French] - \mainlanguage[fr] -\stopmdode - -\startmode[Italian] - \mainlanguage[it] -\stopmode - -\startmode[Spanish] - \mainlanguage[es] -\stopmode - -\setuppagenumbering[alternative=doublesided,location=] - -\setuppapersize[A6][A6] - -\setuplayout - [topspace=.6cm, - backspace=.6cm, - header=2\bodyfontsize, - headerdistance=.5\bodyfontsize, - footer=1.2\bodyfontsize, - footerdistance=.5\bodyfontsize, - margin=0pt, - height=middle, - width=88mm, - location=middle] - -\setuparranging[2*4*2] - -\setupMPvariables % for collatingmarks - [pages=8, % pages per sheet of paper doublesided - sheets=2, % sheets of paper used per section - horpageshift=0mm] - -\startluacode - -local report = logs.reporter("Sundata calendar") - -function thirddata.diary.year_of_monthtables( - year,lat,lon,timeoffset,continent) - - report("Working in function: diary.year_of_monthtables") - - local dst_start,dst_stop = thirddata.diary.DST(year,continent) - - report("DST start: %s, DST stop: %s",dst_start,dst_stop) - - for i= 1,1 do - local monthname = string.lower(os.date - ("%B",os.time{year=year,month=i,day=1})) - - context.setupheadertexts( - { - function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - { - function() - context(year) - return true - end - }, - { - function() - context("\\bf") - context.labeltext(monthname) - return true - end - }, - { - function() - context(year) - return true - end - }) - - thirddata.diary.monthblock(i,year,lat,lon,timeoffset,dst_start,dst_stop) - end -end - -function thirddata.diary.monthblock( - month,year,lat,lon,timeoffset,dst_start,dst_stop) - - report("Working in function diary.monthblock") - - local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month - local wkf = thirddata.calendar.weeknumber(1,month,year) - - --report("Weeks in the selected month: %s", c) - --report("Week number : %s", wkf) - - local nofdays = 1 - - if month == 2 and thirddata.calendar.isleapyear(year) ~= 365 then - nofdays = thirddata.calendar.nofdays_month(month,year) + 1 - else - nofdays = thirddata.calendar.nofdays_month(month,year) - end - - report("Number of days in month: %s", nofdays) - - local wkl = thirddata.calendar.weeknumber(nofdays,month,year) - - local monthname = thirddata.calendar.select_nameofmonth(month,year) - - context.bTABLE({setups="table:monthblock"}) - - for i = 1,nofdays do - - local ordinalday = thirddata.calendar.ordinalday(i,month,year) - local weeknumber = thirddata.calendar.weeknumber(i,month,year) - local holiday = thirddata.calendar.checkchristianfeast(i,month,year) - local moondata = thirddata.moonphase.lunardays(year,month,i) - local sunrise,sunset,lighthours = - thirddata.srss.sundata( - i,month,year,lat,lon,timeoffset,dst_start,dst_stop) - - context.bTR() - context.bTD() - - local dayname = string.lower(os.date - ("%a",os.time{day=i,month=month,year=year})) - - --report("Dayname: %s",dayname) - context.starttabulate{"|lw(0.1\\textwidth)|lw(0.06\\textwidth)|l|"} - context.NC() - if dayname == "sun" or holiday ~= "" and holiday ~= "asw" then - local dnu = i - local dna = dayname - context.color({"red"}, - function() context(dnu) end) --day number - context("~") - context.color({"red"}, - function() context.labeltext(dna) end)--dayname - else - context(i) --day - context("~") - context.labeltext(dayname) --dayname - end - context.NC() - context.switchtobodyfont{"6pt"} - context.labeltext("week") - context(": ") - context(weeknumber) - context.NC() - context.switchtobodyfont{"6pt"} - context.labeltext("day") - context(": ") - context(ordinalday) - context.NC() - context.NR() - context.stoptabulate() - context.eTD() - context.bTD() - context.starttabulate{"|lw(0.2\\textwidth)|l|l|l|l|"} - context.NC() - if holiday == "" then - context.strut() - context.NC() - context.NC() - context.NC() - context.NC() - else - context.labeltext(holiday) - context.NC() - context.NC() - context.NC() - context.NC() - end - context.NR() - context.NC() - if tonumber(moondata) then - context.labeltext("moondays") - else - context.labeltext("moon") - end - context(":~") - context(moondata) - context.NC() - --context.labeltext("sunrise") - context("\\SunA[background=Sunrise]{}") - context("\\quad :~") - context(sunrise) - context.NC() - context("\\SunA[background=Sunset]{}") - context("\\quad :~") - context(sunset) - context.NC() - context("\\SunB[background=Light]{}") - context("~:~") - context(lighthours) - context.NC() - context.NR() - context.stoptabulate() - context.eTD() - context.eTR() - end - context.eTABLE() - context.page() -end - -\stopluacode - -\startsetups[table:monthblock] - \setupTABLE[split=yes] - \setupTABLE[each][each][frame=on] - \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] - \setupTABLE[c][1][width=0.35\textwidth,align=lohi] - \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups - -\define[5]\Yearofmonthtables{\ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} - -\startbuffer[Yearofmonthtables] - \Yearofmonthtables %Year,lat,lon,timeoffset,dst_start,dst_stop - {\getvariable{PocketDiary}{Year}} - {\getvariable{PocketDiaryGeoPosition}{lat}} - {\getvariable{PocketDiaryGeoPosition}{lon}} - {\getvariable{PocketDiaryGeoPosition}{timeoffset}} - {"\getvariable{PocketDiaryGeoPosition}{continent}"} -\stopbuffer - -% Implement international interface: -\setuplabeltext[en][title=Title] -\setuplabeltext[nl][title=Titel] -\setuplabeltext[de][title=Titel] -\setuplabeltext[fr][title=Titre] -\setuplabeltext[it][title=Titolo] -\setuplabeltext[es][title=Título] - -\setuplabeltext[en][author=Author] -\setuplabeltext[nl][author=Auteur] -\setuplabeltext[de][author=Autor] -\setuplabeltext[fr][author=Auteur] -\setuplabeltext[it][author=autore] -\setuplabeltext[es][author=Autor] - -\setuplabeltext[en][typography=Typography] -\setuplabeltext[nl][typography=Typografie] -\setuplabeltext[de][typography=Typographie] -\setuplabeltext[fr][typography=Typographie] -\setuplabeltext[it][typography=Tipografia] -\setuplabeltext[es][typography=Tipografía] - -\setuplabeltext[en][compilation=Compilation date] -\setuplabeltext[nl][compilation=Compilatie datum] -\setuplabeltext[de][compilation=Kompilationsdatum] -\setuplabeltext[fr][compilation=Date de compilation] -\setuplabeltext[it][compilation=Dato di compilazione] -\setuplabeltext[es][compilation=Fecha de compilación] - -\starttext - - \startstandardmakeup[page=yes,doublesided=no] - \strut - \startalignment [middle] - \godown[.3\textheight] - \startmode[English] - {\bfc \labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} - \stopmode - \startmode[Dutch] - {\bfc \labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} - \stopmode - \startmode[German] - {\bfc \labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar} } - \stopmode - \startmode[French] - {\bfc \labeltext{calendar} du \labeltext{sunstar} - et de la \labeltext{moon}} - \stopmode - \startmode[Italian] - {\bfc \labeltext{calendar} di \labeltext{sunstar} - e della \labeltext{moon}} - \stopmode - \startmode[Spanish] - {\labeltext{calendar} del \labeltext{sunstar} - y la \labeltext{moon}} - \stopmode - \blank - {\bfb \getvariable{PocketDiary}{Place}} - \vfill - {\tfa \getvariable{PocketDiary}{Year}} - \stopalignment - \vfil - \stopstandardmakeup - - \startstandardmakeup[page=yes,doublesided=no] - \starttabulate[|l|p|] - \NC \labeltext{title} - \EQ - \startmode[English] - {\labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} - \stopmode - \startmode[Dutch] - {\labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} - \stopmode - \startmode[German] - {\labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar}} - \stopmode - \startmode[French] - {\labeltext{calendar} du \labeltext{sunstar} - et de la \labeltext{moon}} - \stopmode - \startmode[Italian] - {\labeltext{calendar} di \labeltext{sunstar} - e della \labeltext{moon}} - \stopmode - \startmode[Spanish] - {\labeltext{calendar} del \labeltext{sunstar} - y la \labeltext{moon}} - \stopmode - \NC\NR - \NC \labeltext{author} - \EQ \getvariable{PocketDiaryAddress}{Forename}~ - \getvariable{PocketDiaryAddress}{Familyname} \NC\NR - \NC \labeltext{typography} \EQ \CONTEXT\ with \LUAMETATEX \NC\NR - \NC \labeltext[compilation] \EQ \currentdate \NC\NR - \stoptabulate - \vfil - \startmode[English] - This calendar is generated for \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \startmode[German] - Dieser Kalender ist berechnet für \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \startmode[Dutch] - Deze kalender is opgemaakt voor \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \startmode[French] - Ce calendrier est fait pour \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \startmode[Italian] - Questo calendario è prodotto per \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \startmode[Spanish] - Este calendario está calculado para \getvariable{PocketDiary}{Place}, - \getvariable{PocketDiary}{Country} - \stopmode - \starttabulate[|l|r|] - \NC Longitude \EQ \getvariable{PocketDiaryGeoPosition}{lon} \NC\NR - \NC Latitude \EQ \getvariable{PocketDiaryGeoPosition}{lat} \NC\NR - \stoptabulate - \stopstandardmakeup - - \getbuffer[Yearofmonthtables] - -\stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex new file mode 100644 index 0000000000..6dd5c69843 --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A5-day_per_page.tex @@ -0,0 +1,427 @@ +% Context file +% Filename: A5-day_per_page.tex +% +% 14-01-2023 +% Created by Willi Egger, w.egger@boede.nl +% This document is in the Public Domain. + +% This is an example of how to use the PocketDiary-module outside the built-in +% structure of a PocketDiary. +% In order to use this example you need to have the PocketDiary-module +% installed from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +% If you want collating marks placed on the outermost sheet of a section, +% then you need to install also the Collatingmarks-module from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +% The used imposition scheme is contained in the \CONTEXT\ distro. + +% This is an example how to prepare a calendar, where each page contains one +% day. On the left side there is a time-schedule starting at 06:00 ending +% at 22:00. The header contains left the month and right the year. Below the +% header there is a table showing left the day and the short dayname followed by +% the week number and the day number of the year. If the day in question is a +% Christian holiday, then the name of it is stated in the center. +% To the right astronomical data +% are shown: Lunar days/moon phase, sun rise, sun set and light hours. +% In order to have complete section at the end of the calendar a number of +% pages with lines are added. + +\usemodule[pocketdiary] +\usemodule[collatingmarks][Collatingmarks=yes] + +% define the different modes to enable the international interface: + +\definemode[English,Dutch,German,French,Italian,Spanish][keep] + +\enablemode[English] +% \enablemode[German] +% \enablemode[Dutch] +% \enablemode[Italian] +% \enablemode[French] +% \enablemode[Spanish] + +% The variable sets for the PocketDiary module: + +\setvariables + [PocketDiary] + [Year=2023, + Week=1, + Day=1, + Month=1, + Nextyear=yes, + Yearnext=2024] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables + [PocketDiaryGeoPosition] + [lat=52.467860, + lon=16.981240, + timezoneoffset=1, + continent=EU] % EU, US or empty for no Daylight Saving Time (DST) + +\setvariables + [PocketDiaryAddress] + [Familyname=YourFamilyName, + Forename=YourName, + Street=YourStreet and Number, + Zipcode=YourPostalCode, + City=YourPlace, + Country=YourCountry, + Phone=YourPhoneNumber, + Mobile=YourMobilePhoneNumber, + E-mail=YourEmail@YourProvider, + Web=YourWWW] + +\setupbodyfont[ibmplex,ss,10pt] + +\definefontfeature[f:Tabular][tnum=yes] + +\addfeature[f:Tabular] + +\startmode[English] + \mainlanguage[en] +\stopmode + +\startmode[German] + \mainlanguage[de] +\stopmode + +\startmode[French] + \mainlanguage[fr] +\stopmode + +\startmode[Italian] + \mainlanguage[it] +\stopmode + +\startmode[Spanish] + \mainlanguage[es] +\stopmode + +% The document is double sided printed, the page number will be set in the \setupfootertexts: + +\setuppagenumbering[alternative=doublesided,location=] + +\setuppapersize[A5][A4,landscape] +% \setuppapersize[A5][A5] + +% Adapt the page layout to the size of the page: + +\setuplayout + [topspace=.6cm, + backspace=1.5cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle] + +% Enable the imposition: 2 pages recto and verso using 4 sheets of A4 for forming one section + +\setuparranging[2*2*4] + +% Setup of the Collating marks module: + +\setupMPvariables % for collatingmarks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=-0.5mm] + +% \showframe + +% Let Lua do the work: + +\startluacode + + local report = logs.reporter("Calendar-1-day-per-page") + + function thirddata.diary.year_of_monthtables( + year,lat,lon,timeoffset,continent) + + report("Working in function: diary.year_of_monthtables") + + for i = 1,12 do + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=i,day=1})) + + thirddata.diary.header_text(monthname,year) + + thirddata.diary.monthblock(i,year,lat,lon,timeoffset,continent) + end + end + + function thirddata.diary.monthblock(month,year,lat,lon,timeoffset,continent) + + report("Working in function diary.monthblock") + + local nofdays = 1 + + local monthname = thirddata.calendar.select_nameofmonth(month,year) + local yeardays = thirddata.calendar.isleapyear(year) + + if month == 2 and yeardays == 366 then + nofdays = thirddata.calendar.nofdays_month(month,year) + 1 + else + nofdays = thirddata.calendar.nofdays_month(month,year) + end + + --report("Number of days in month: %s", nofdays) + + for i = 1,nofdays do + local ordinalday = thirddata.calendar.ordinalday(i,month,year) + local weeknumber = thirddata.calendar.weeknumber(i,month,year) + local dayname = string.lower(os.date ("%a",os.time{day=i,month=month,year=year})) + local holiday = thirddata.calendar.checkchristianfeast(i,month,year) + local moondata = thirddata.moonphase.lunardays(year,month,i) + local dst_start,dst_stop = thirddata.diary.DST(year,continent) + local sunrise,sunset,lighthours = + thirddata.srss.sundata( + i,month,year,lat,lon,timeoffset,dst_start,dst_stop) + + if holiday ~= "" then + report("Holiday: %s", holiday) + report("Day number: %s", i) + end + + context.bTABLE({setups="table:dayblock"}) + context.bTR() + context.bTD() + context.starttabulate{"|lw(0.1\\textwidth)|p(0.06\\textwidth)|p|"} + context.NC() + context("\\bf") + --report("Daynumber: %s Month %s", i,month) + if dayname == "sun" or holiday ~= "" and holiday ~= "ashw" then + local dnu = i + local dna = dayname + context.color({"red"}, + function() context(dnu) end) --day number + context("~") + context.color({"red"}, + function() context.labeltext(dna) end)--dayname + else + context(i) --day + context("~") + context.labeltext(dayname) --dayname + end + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("week") + context(":") + context.par() + context(weeknumber) + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("day") + context(":") + context.par() + context(ordinalday) + context("/") + context(yeardays) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.bTD() + context.starttabulate{"|lw(0.2\\textwidth)|p|p|p|p|"} + context.NC() + if holiday == "" then + context.strut() + else + context.labeltext(holiday) + end + context.NC() + if tonumber(moondata) then + context.labeltext("moondays") + else + context.labeltext("moon") + end + context(":~") + context.par() + context(moondata) + context.NC() + context("\\SunA[background=Sunrise]{}") + context.par() + context(sunrise) + context.NC() + context("\\SunA[background=Sunset]{}") + context.par() + context(sunset) + context.NC() + context("\\SunB[background=Light]{}") + context.par() + context(lighthours) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.eTR() + context.eTABLE() + context.page() + end + end + + function thirddata.diary.header_text(monthname,year) + context.setupheadertexts( + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context(year) + return true + end + }, + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context(year) + return true + end + }) + end + +\stopluacode + +\startsetups[table:dayblock] + \setupTABLE[each][each][frame=off] + \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] + \setupTABLE[c][1][width=0.35\textwidth,align=lohi] + \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups + +\define[5]\Yearofmonthtables{% + \ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} + + +\startbuffer[Yearofmonthtables] + \Yearofmonthtables %Year,lat,lon,timeoffset,continent + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +% Create a time-table as a background to the page + +\startreusableMPgraphic{Time-Lines} + numeric w; w:= OverlaytWidth; + numeric h; h:= (OverlayHeight-2cm)/18; + numeric t; + path p,q; + p := unitsquare xscaled OverlayWidth yscaled (OverlayHeight-2cm); + + q:= llcorner p -- lrcorner p; + draw q withpen pencircle scaled .5pt + withcolor \MPcolor{Grid}; + for i = 1 upto 17: + draw q shifted (0,i*h) withpen pencircle scaled .5pt + withcolor \MPcolor{Grid}; + t := 24 - 1 - i ; + label.top(textext(""& decimal t & ":00"),point 0 of q) + shifted (15pt,((i-1)*h)+1pt); + endfor; +\stopreusableMPgraphic + +\defineoverlay[Textbackground][\reuseMPgraphic{Time-Lines}] + +% Implement international interface: +\setuplabeltext[en][title=Title] +\setuplabeltext[nl][title=Titel] +\setuplabeltext[de][title=Titel] +\setuplabeltext[fr][title=Titre] +\setuplabeltext[it][title=Titolo] +\setuplabeltext[es][title=Título] + +\setuplabeltext[en][author=Author] +\setuplabeltext[nl][author=Auteur] +\setuplabeltext[de][author=Autor] +\setuplabeltext[fr][author=Auteur] +\setuplabeltext[it][author=autore] +\setuplabeltext[es][author=Autor] + +\setuplabeltext[en][typography=Typography] +\setuplabeltext[nl][typography=Typografie] +\setuplabeltext[de][typography=Typographie] +\setuplabeltext[fr][typography=Typographie] +\setuplabeltext[it][typography=Tipografia] +\setuplabeltext[es][typography=Tipografía] + +\setuplabeltext[en][compilation=Compilation date] +\setuplabeltext[nl][compilation=Compilatie datum] +\setuplabeltext[de][compilation=Kompilationsdatum] +\setuplabeltext[fr][compilation=Date de compilation] +\setuplabeltext[it][compilation=Dato di compilazione] +\setuplabeltext[es][compilation=Fecha de compilación] + +% Setup the TeX side of the document: + +\starttext + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \startalignment [middle] + \godown[.3\textheight] + {\bfa \labeltext{calendar}} + \vfil + {\bf \getvariable{PocketDiary}{Year}} + \stopalignment + \stopstandardmakeup + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \labeltext{title} + \EQ {\bf \labeltext{calendar}} \NC\NR + \NC \labeltext{author} + \EQ \getvariable{PocketDiaryAddress}{Forename} + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \labeltext{typography} + \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \labeltext{compilation} + \EQ \currentdate \NC\NR + \stoptabulate + \stopstandardmakeup + + \getbuffer[Lost-Returnto] + + \setupbackgrounds[text][background=] + + \setupbackgrounds[text][background=Textbackground] + + \getbuffer[Yearofmonthtables] + + \setupbackgrounds[text][background=] + + \getbuffer[Yearcurrentplan] + + \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}] + + \getbuffer[Yearnextplan] + + \dorecurse + {3} + {\getbuffer[Todo]} + + \dorecurse + {10} + {\getbuffer[Lines]} + +\stoptext diff --git a/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex new file mode 100644 index 0000000000..ea25de5f9a --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/A6-1week_per_2pages.tex @@ -0,0 +1,359 @@ +% Context file +% Filename: A6-1week_per_2pages.tex +% +% 14-01-2023 +% Created by Willi Egger, w.egger@boede.nl +% This document is in the Public Domain. + +% This is an example of how to use the PocketDiary-module outside the built-in +% structure of a PocketDiary. +% In order to use this example you need to have the PocketDiary-module +% installed from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +% If you want collating marks placed on the outermost sheet of a section, +% then you need to install also the Collatingmarks-module from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +% The used imposition scheme is contained in the \CONTEXT\ distro. + +% This is an example how to prepare a calendar, where two facing pages carry +% one week as a table. Saturday and Sunday are placed together in one row. +% The header contains the month name to the left and the week number and the +% year to the right. +% The footer contains three fields. The first contains the job-name, the center +% field shows the page number, the right field is not filled. -- However +% this can easily be changed in the variable set "PocketDiaryFooter". +% Each row of the week-table shows top left the day number followed by the short +% name of the day. Next to this the ordinal day number of the year is typeset. +% If the day in question is a Christian holiday, then its name is placed next +% to the general information. +% This example supports 6 languages i.e. English, German, Dutch, French, +% Italian and Spanish. The respective interface is activated by enabling the +% respective mode +% The original idea was to have an A6 calendar, where 4 pages are print on +% A4 paper. This is activated by enabling the mode "A6". By activating the mode +% "A5" the calendar is prepared A5 sized on a A4 landscape paper. +% Because there are astronomical data concerning the sun rise, sun set times it +% is necessary to fill in the correct geo-positional data in the variable set +% "PocketDiaryGeoPosition". + +\usemodule[pocketdiary] +\usemodule[collatingmarks][Collatingmarks=yes] + +\definemode[English,Dutch,German,French,Italian][keep] +\definemode[A5,A6][keep] + +\enablemode[English] +% \enablemode[German] +% \enablemode[Dutch] +% \enablemode[Italian] +% \enablemode[French] +% \enablemode[Spanish] + +\enablemode[A6] +% \enablemode[A5] + +\setvariables + [PocketDiary] + [Year=2023, + Week=1, + Day=1, + Month=1, + Nextyear=yes] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables + [PocketDiaryGeoPosition] + [lat=52.467860, + lon=16.981240, + timezoneoffset=1, + continent=EU] % Eu, US or empty for no Daylight Saving Time (DST) + +\setvariables + [PocketDiaryAddress] + [Familyname=YourFamilyName, + Forename=YourName, + Street=YourStreet and Number, + Zipcode=YourPostalCode, + City=YourPlace, + Country=YourCountry, + Phone=YourPhoneNumber, + Mobile=YourMobilePhoneNumber, + E-mail=YourEmail@YourProvider, + Web=YourWWW] + +\setupbodyfont[ibmplex,ss,10pt] + +\definefontfeature[f:Tabular][tnum=yes] + +\addfeature[f:Tabular] + +\startmode[English] + \mainlanguage[en] +\stopmode + +\startmode[German] + \mainlanguage[de] +\stopmode + +\startmode[French] + \mainlanguage[fr] +\stopmode + +\startmode[Italian] + \mainlanguage[it] +\stopmode + +\startmode[Spanish] + \mainlanguage[es] +\stopmode + +\setuppagenumbering[alternative=doublesided,location=] + +\setuplayout + [topspace=.6cm, + backspace=1cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle] + +\startmode[A6] + \definepapersize[Agenda][width=100mm,height=140mm] + + \setuppapersize[Agenda][A4,portrait] + + % The vertical page-shift enables to make a 2.5mm cut at the head of the + % section + \definepageshift + [ver] + [vertical] + [2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm, + 2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm,2.5mm] + + \setuppageshift[paper][ver] + + \setuparranging[2*4*2] + + \setupMPvariables % for collating marks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=-0.5mm] +\stopmode + +\startmode[A5] + \definepapersize[Agenda][width=148mm,height=210mm] + + \setuppapersize[Agenda][A4,landscape] + + \setuparranging[2*2*4] + + \setupMPvariables % for collatingmarks + [pages=4, % pages per sheet of paper doublesided + sheets=4, % sheets of paper used per section + horpageshift=0mm] +\stopmode + +% Let Lua the main work: + +\startluacode + + local report = logs.reporter("Calendar-1-week-per-2-pages") + + function thirddata.diary.year_of_weektables(year, + lat,lon,timeoffset,continent) + + local year = year + local lat = lat + local lon = lon + local timeoffset = timeoffset + local continent = continent + + report("Working in function: diary.year_of_weektables") + + for i = 1,12 do --i is month + thirddata.diary.monthblock(i,year,lat,lon,timeoffset,continent) + end + end + + function thirddata.diary.monthblock(month,year, + lat,lon,timeoffset,continent) + + report("Working in function diary.monthblock: %s", month) + + local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month + local wkf = thirddata.calendar.weeknumber(1,month,year) --weeknumber of 1st day of a given month + + local wkl = wkf + c - 1 -- last week of a given month based on wkf and c, is wrong for January + + --report("Weeks in the selected month: %s", c) + --report("First week of month: %s", wkf) + + if month == 1 and wkf > 51 then + + --report("Calculating in week number %s", wkf) + + thirddata.diary.setup_header_texts(wkf,month,year) + year = year - 1 + thirddata.diary.thisweek(wkf,year,lat,lon,timeoffset,continent) + year = year + 1 + wkf = 1 + wkl = wkf + c - 2 + + for i = wkf, wkl do + thirddata.diary.setup_header_texts(i,month,year) + thirddata.diary.thisweek(i,year,lat,lon,timeoffset,continent) + end + else + for i = wkf, wkl do + + --report("Calculating in week number %s", i) + + thirddata.diary.setup_header_texts(i,month,year) + thirddata.diary.thisweek(i,year, + lat,lon,timeoffset,continent) + end + end + end + + + function thirddata.diary.setup_header_texts(week,month,year) + + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=month,day=1})) + + context.setupheadertexts( + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context.labeltext("week") + context(": ~") + context(week) + context("\\quad") + context(year) + return true + end + }, + {function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + {function() + context.labeltext("week") + context(": ~") + context(week) + context("\\quad") + context(year) + return true + end + }) + end + +\stopluacode + +\startsetups[table:week] + \setupTABLE[split=yes] + \setupTABLE[each][each][frame=on] + \setupTABLE + [r] + [each] + [offset=0pt, + loffset=3pt, + roffset=3pt, + height=0.23\textheight] + \setupTABLE[c][1][width=0.5\textwidth] + \setupTABLE[c][2][width=0.5\textwidth] +\stopsetups + +\define[5]\Yearofweektables{\ctxlua{thirddata.diary.year_of_weektables(#1,#2,#3,#4,#5)}} + + +\startbuffer[Yearofweektables] + \Yearofweektables %Year,lat,lon,timeoffset,continent + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +\starttext + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \godown[.3\textheight] + \startalignment [middle] + {\bfa \labeltext{calendar}} + \vfil + {\bf \getvariable{PocketDiary}{Year}} + \stopalignment + \stopstandardmakeup + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \translate[en=Title, + nl=Titel, + de=Titel, + fr=Titre, + it=Titolo] + \EQ {\bf \labeltext{calendar}} \NC\NR + \NC \translate[en=Author, + nl=Auteur, + de=Autor, + fr=Auteur, + it=autore, + es=Autor] + \EQ \getvariable{PocketDiaryAddress}{Forename} + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \translate[en=Typography, + nl=Typografie, + de=Typographie, + fr=Typographie, + it=Tipografia, + es=Tipografía] + \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \translate[en=Compilation date, + nl=Compilatie datum, + de=Kompilationsdatum, + fr=Date de compilation, + it=Dato di compilazione, + es=Fecha de compilación] + \EQ \currentdate \NC\NR + \stoptabulate + \stopstandardmakeup + + \getbuffer[Lost-Returnto] + + \getbuffer[Yearcurrentplan] + + \setupheadertexts[\bfa \getvariable{PocketDiary}{Yearnext}+1] + + \getbuffer[Yearnextplan] + + \setupheadertexts[] + + \getbuffer[Yearofweektables] + + \dorecurse + {13} + {\getbuffer[Lines]} +\stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex new file mode 100644 index 0000000000..135994f9d8 --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Menu-calendar.tex @@ -0,0 +1,282 @@ +% Context file +% Filename: Menu-calender.tex +% +% 14-01-2023 +% Created by Willi Egger w.egger@boede.nl +% This file is in the Public Domain + +% This is an example of how to use the PocketDiary-module outside the built-in +% structure of a PocketDiary. +% In order to use this example you need to have the PocketDiary-module +% installed from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 +% If you want collating marks placed on the outermost sheet of a section, +% then you need to install also the Collatingmarks-module from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=129 +% The used imposition scheme is contained in the \CONTEXT\ distro. + +\usemodule[pocketdiary] +\usemodule[collatingmarks][Collatingmarks=yes] + +% Choose your font + +\setupbodyfont[ibmplex,ss,10pt] + +% Add a path to the picture placed on page 3: + +\setupexternalfigures + [directory=/Users/willi/Documents/TEXdata + /Koken/Grossmutters-Guetzli-Rezepte/] + +% Choose the main language it determines the interface: + +\mainlanguage[en] + +% This document will be doublesided, the pagenumber will be placed in the footer by means of \setupfootertexts: +\setuppagenumbering[alternative=doublesided,location=] + +% The calendar has a pagesize of A6 and with the imposition 4 pages recto and verso are placed on a A4. Two sheets of A4 form one section: + +%\setuppapersize[A6][A4] +\setuppapersize[A5][A4,landscape] + +% \setuparranging[2*4*2] +%\setuparranging[2*2*4] +\setuparranging[2SIDE] + +% The module Collating marks needs appropriate information: + +% \setupMPvariables +% [pages=8, % pages per sheet of paper doublesided +% sheets=2, % sheets of paper used per section +% horpageshift=0mm] +\setupMPvariables + [pages=4, % pages per sheet of paper doublesided + sheets=4, % sheets of paper used per section + horpageshift=0mm] + + +% Adapt the layout of the page to the size of the page: +\setuplayout + [topspace=.6cm, + backspace=.6cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=middle, + location=middle] + +% Variable sets from the PocketDiary module to be set: + +\setvariables + [PocketDiary] + [Year=2023] + +\setvariables + [PocketDiaryFooter] + [Lefttext=\labeltext{menu}-\labeltext{calendar}, + Centertext=\pagenumber, + Righttext=\getvariable{PocketDiary}{Year}] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +% The data are presented in table form. The setup of the table: + +\startsetups table:week + \setupTABLE[split=yes] + \setupTABLE[c][1][width=.35\textwidth,frame=off] + \setupTABLE[c][2][width=.65\textwidth,frame=off] + \setupTABLE[r][height=2\lineheight,align=lohi] + \setupTABLE[r][2,3,5,6,8,9,11,12,14,15,17,18,20,21][bottomframe=on] +\stopsetups + +% There are currently 6 interfaces supported: + +% English interface +\setuplabeltext[en][menu=Menu] +\setuplabeltext[en][comment=Comment] + +% German interface +\setuplabeltext[de][menu=Menü] +\setuplabeltext[de][comment=Kommentar] + +% French interface +\setuplabeltext[fr][menu=Menu] +\setuplabeltext[fr][comment=Commentaire] + +% Dutch interface +\setuplabeltext[nl][menu=Menu] +\setuplabeltext[nl][comment=Commentaar] + +% Italian interface +\setuplabeltext[it][menu=Menu] +\setuplabeltext[it][comment=Commento] + +% Spanish interface +\setuplabeltext[es][menu=Menú] +\setuplabeltext[es][comment=Comentario] + + +% The lua code performing all the magic: + +\startluacode + + local report = logs.reporter("Menu calendar") + + function thirddata.calendar.menuweektable(mondaytimestamp,year,w) + local stamp = mondaytimestamp + local year = year + local week = w + local daynumber,dayname,monthname,holiday + + local day = stamp + 1 * 24 * 60 * 60 + + report("Working in function: thirddata.calendar.menuweektable") + + local monthname = string.lower(os.date("%B",day)) + + --report("Month: %s Week: %s", monthname,week) + + thirddata.calendar.myheadertext(monthname,week) + + context.bTABLE({setups="table:week"}) + + for i = 1,7 do + local day = stamp + i * 24 * 60 * 60 + + --report("Day-inloop: %s", day) + + daynumber = tonumber(os.date("%d",day)) --day number + dayname = string.lower(os.date("%a",day)) -- day name short + monthnumber = tonumber(os.date("%m",day)) -- month name + holiday = thirddata.calendar.checkchristianfeast(daynumber,monthnumber,year) -- Christian holida + + if holiday ~= "" then + report("Holiday (before table row): %s", holiday) + report("Day number (before table row): %s", daynumber) + report("Day name (before table row): %s",dayname) + end + + context.bTR() + context.bTD({style="bfa"}) + + if dayname == "sun" or holiday ~= "" and f ~= "ashw" then + local dnu = daynumber + local dna = dayname + context.color({"red"},function() context(dnu) end) + context("~") + context.color({"red"},function() context.labeltext(dna) end) + else + context(daynumber) + context("~") + context.labeltext(dayname) + end + context.eTD() + context.bTD() + context.labeltext(holiday) + context.eTD() + context.eTR() + context.bTR() + context.bTD({nx="2"}) + context.labeltext("menu") + context.eTD() + context.eTR() + context.bTR() + context.bTD({nx="2"}) + context.labeltext("comment") + context.eTD() + context.eTR() + end + context.eTABLE() + context.page({"yes"}) + end + + function thirddata.calendar.myheadertext(monthname,week) + + report("Working in function myheadertext") + + context.setupheadertexts{ + function() + context("\\bgroup\\bfa") + context.labeltext(monthname) + context("\\egroup") + context("\\hfill") + context.labeltext("week") + context(": ") + context(week) + return true + end} + end + + function thirddata.calendar.week(weeknumber,year) + local w = weeknumber + local year = year + local month = thirddata.calendar.select_month(1,w,year) + local mondaytimestamp = thirddata.calendar.weekcalendar(w,month,year) + + report("Working in function: thirddata.calendar.week") + --report("Mondaytimestamp %s", mondaytimestamp) + + thirddata.calendar.menuweektable(mondaytimestamp,year,w) + end + +\stopluacode + +% We need a macro to call the lua-code: this macro has two parameters week number and year + +\define[2]\MenuWeektable{\ctxlua{thirddata.calendar.week(#1,#2)}} + +% \showframe + +% The setup of the document at the TeX-side: + +\starttext + \startstandardmakeup[page=yes,doublsided=yes] + \strut + \godown[.3\textheight] + \startalignment [middle] + {\bfc \labeltext{menu}-\labeltext{calendar}} + \vfill + {\tfa \getvariable{PocketDiary}{Year}} + \stopalignment + \vfil + \stopstandardmakeup + + \setupheadertexts[][] + + \strut\vfil + + \startplacefigure + [number=, + title=, + location=middle] + {\externalfigure[YourPicture.jpg][width=0.75\textwidth]} + \stopplacefigure + + \vfill + + \page + + \setups{Footertext} + + \dorecurse{52} + {\setvariables + [PocketDiary] + [Week=\recurselevel] + \MenuWeektable{\recurselevel}{\getvariable{PocketDiary}{Year}}\page} + + \page + + \setupheadertexts[\bf \labeltext{notes}] + + \dorecurse + {3} + {\strut\page} +\stoptext + diff --git a/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex new file mode 100644 index 0000000000..f55b954e14 --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Photocalendar.tex @@ -0,0 +1,197 @@ +% Context file +% Filename: Photocalendar.tex +% +% 14-01-2023 +% Created by Willi Egger, w.egger@boede.nl +% This file is in the Public Domain + +% Mind you that Thomas Schmitz put on the \CONTEXT -wiki a lua-script, which +% creates a tex-file which can be compiled with \CONTEXT\ already back in 2007 +% for the preparation of a photo-calendar. +% The nice thing about it is, that it uses a small number of formulae. Nice is, +% that it also uses the Sohael Babwani formulae. See: +% https://wiki.contextgarden.net/Calendar_script + +% This example file creates a photo calendar based on the PocketDiary-module. +% In order to use this example you need to have the PocketDiary-module +% installed from: +% https://modules.contextgarden.net/cgi-bin/module.cgi/action=view/id=132 + +% The calendar is typeset on A4 portrait. The calendar is a flip-over type, +% where in the top-part is a photo and thereunder the month-table with +% indication of the month name and year. +% The pictures to be used are placed in a subdirectory. Each picture gets +% a symbolic name (number) to be used in the \dorecurse loop. +% For completing the calendar we need 13 pictures. The picture 13 is used on +% the title page. +% This file supports 6 languages, which are selected through the \mainlanguage[] + + +\usemodule[pocketdiary] + +\setupbodyfont[ibmplex,ss,12pt] + +\setuppagenumbering[location=] + +\setuppapersize[A4,portrait][A4,portrait] + +\setuplayout + [topspace=20mm, + backspace=8.6mm, + header=0pt, + footer=0pt, + height=middle, + width=middle] + +% Supported languages: en, de, nl, fr, it, es +\mainlanguage[en] + +% Where to find the calendar pictures +\setupexternalfigures + [directory=./MyPhotoDirectory] + +% Give pictures symbolic names for using in a loop +\useexternalfigure + [1] + [A.jpg] + +\useexternalfigure + [2] + [B.jpg] + +\useexternalfigure + [3] + [C.jpg] + +\useexternalfigure + [4] + [D.jpg] + +\useexternalfigure + [5] + [E.jpg] + +\useexternalfigure + [6] + [F.jpg] %[TV-Kasten-Flurin.jpg] + +\useexternalfigure + [7] + [G.jpg] + +\useexternalfigure + [8] + [H.jpg] + +\useexternalfigure + [9] + [I.jpg] + +\useexternalfigure + [10] + [J.jpg] + +\useexternalfigure + [11] + [K.jpg] + +\useexternalfigure + [12] + [L.jpg] + +\useexternalfigure + [13] + [M.jpg] + +% Setup the variables for the Pocket diary, only year is used for the title page and the variable passed to Lua. + +\setvariables + [PocketDiary] + [Year=2023] + +% Let the header and the footer be empty: + +\setupheadertexts[][] + +\setupfootertexts[][] + +% Add 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}] + +% Lua is performing 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 + +% The setup of the table with the day numbers: + +\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 + +% We need a simple macro with one parameter to call the lua-code: + +\define[1]\Photocalendarpages + {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}} + +% Layout of the TeX part of the calendar: + +\starttext + +\startstandardmakeup[page=yes,doublesided=yes] + \startplacefigure + [location=middle, + title=, + number=] + {\externalfigure[13][width=\paperwidth]} + \stopplacefigure + \midaligned{\bfc \labeltext{fotocal}~\getvariable{PocketDiary}{Year}} +\stopstandardmakeup + +\Photocalendarpages{\getvariable{PocketDiary}{Year}} + +\stoptext + + diff --git a/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex new file mode 100644 index 0000000000..18726204cb --- /dev/null +++ b/macros/context/contrib/context-calendar-examples/tex/context/third/calendar-examples/Sundata-calendar.tex @@ -0,0 +1,424 @@ +% Context file +% Filename: Sundata-calendar.tex +% +% 13-07-2022 +% Copyright (c) 2022 BOEDE. All rights reserved. +% +% \nopdfcompression +% \enabletrackers[context.trace] +% \enabletrackers[system.jobfiles] + +\usemodule[pocketdiary] +\usemodule[collatingmarks][Collatingmarks=yes] + +\definemode[English,Dutch,German,French,Italian,Spanish][keep] + +\enablemode[English] +% \enablemode[German] +% \enablemode[Dutch] +% \enablemode[Italian] +% \enablemode[French] +%\enablemode[Spanish] + +\setvariables + [PocketDiary] + [Year=2023, + Week=1, + Day=1, + Month=1, + Nextyear=no, + Place=Sambeek, + Country=NL] + +\setvariables + [PocketDiaryFooter] + [Lefttext={\jobname .pdf}, + Centertext=\pagenumber, + Righttext=] + +\setvariables + [PocketDiaryColors] + [Separatorline=blue, + Gridline={s=.75}] + +\setvariables %Koziegłowy 52.467860,16.981240 //52.5921425,6.0962685, % Hasselt + [PocketDiaryGeoPosition] + [lat=51.63682, %Sambeek Maasstraat 2A (Google Maps) + lon=5.96655, %Sambeek, Maasstraat 2A (Google Maps) + timezoneoffset=1, + continent=EU] %EU, US or empty for no DST + +\setupbodyfont[ibmplex,ss,10pt] +% \usetypescriptfile[type-seravek] +% \usetypescript[Seravek] +% \setupbodyfont[Seravek,ss,10pt] + +% Modes for the international interface + +\startmode[English] + \mainlanguage[en] +\stopmode + +\startmode[Dutch] + \mainlanguage[nl] +\stopmode + +\startmode[German] + \mainlanguage[de] +\stopmode + +\startmode[French] + \mainlanguage[fr] +\stopmdode + +\startmode[Italian] + \mainlanguage[it] +\stopmode + +\startmode[Spanish] + \mainlanguage[es] +\stopmode + +\setuppagenumbering[alternative=doublesided,location=] + +\setuppapersize[A6][A6] + +\setuplayout + [topspace=.6cm, + backspace=.6cm, + header=2\bodyfontsize, + headerdistance=.5\bodyfontsize, + footer=1.2\bodyfontsize, + footerdistance=.5\bodyfontsize, + margin=0pt, + height=middle, + width=88mm, + location=middle] + +\setuparranging[2*4*2] + +\setupMPvariables % for collatingmarks + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm] + +\startluacode + +local report = logs.reporter("Sundata calendar") + +function thirddata.diary.year_of_monthtables( + year,lat,lon,timeoffset,continent) + + report("Working in function: diary.year_of_monthtables") + + local dst_start,dst_stop = thirddata.diary.DST(year,continent) + + report("DST start: %s, DST stop: %s",dst_start,dst_stop) + + for i= 1,1 do + local monthname = string.lower(os.date + ("%B",os.time{year=year,month=i,day=1})) + + context.setupheadertexts( + { + function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + { + function() + context(year) + return true + end + }, + { + function() + context("\\bf") + context.labeltext(monthname) + return true + end + }, + { + function() + context(year) + return true + end + }) + + thirddata.diary.monthblock(i,year,lat,lon,timeoffset,dst_start,dst_stop) + end +end + +function thirddata.diary.monthblock( + month,year,lat,lon,timeoffset,dst_start,dst_stop) + + report("Working in function diary.monthblock") + + local c = thirddata.calendar.month(month,year) --returns number of weeks in a given month + local wkf = thirddata.calendar.weeknumber(1,month,year) + + --report("Weeks in the selected month: %s", c) + --report("Week number : %s", wkf) + + local nofdays = 1 + + if month == 2 and thirddata.calendar.isleapyear(year) ~= 365 then + nofdays = thirddata.calendar.nofdays_month(month,year) + 1 + else + nofdays = thirddata.calendar.nofdays_month(month,year) + end + + report("Number of days in month: %s", nofdays) + + local wkl = thirddata.calendar.weeknumber(nofdays,month,year) + + local monthname = thirddata.calendar.select_nameofmonth(month,year) + + context.bTABLE({setups="table:monthblock"}) + + for i = 1,nofdays do + + local ordinalday = thirddata.calendar.ordinalday(i,month,year) + local weeknumber = thirddata.calendar.weeknumber(i,month,year) + local holiday = thirddata.calendar.checkchristianfeast(i,month,year) + local moondata = thirddata.moonphase.lunardays(year,month,i) + local sunrise,sunset,lighthours = + thirddata.srss.sundata( + i,month,year,lat,lon,timeoffset,dst_start,dst_stop) + + context.bTR() + context.bTD() + + local dayname = string.lower(os.date + ("%a",os.time{day=i,month=month,year=year})) + + --report("Dayname: %s",dayname) + context.starttabulate{"|lw(0.1\\textwidth)|lw(0.06\\textwidth)|l|"} + context.NC() + if dayname == "sun" or holiday ~= "" and holiday ~= "asw" then + local dnu = i + local dna = dayname + context.color({"red"}, + function() context(dnu) end) --day number + context("~") + context.color({"red"}, + function() context.labeltext(dna) end)--dayname + else + context(i) --day + context("~") + context.labeltext(dayname) --dayname + end + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("week") + context(": ") + context(weeknumber) + context.NC() + context.switchtobodyfont{"6pt"} + context.labeltext("day") + context(": ") + context(ordinalday) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.bTD() + context.starttabulate{"|lw(0.2\\textwidth)|l|l|l|l|"} + context.NC() + if holiday == "" then + context.strut() + context.NC() + context.NC() + context.NC() + context.NC() + else + context.labeltext(holiday) + context.NC() + context.NC() + context.NC() + context.NC() + end + context.NR() + context.NC() + if tonumber(moondata) then + context.labeltext("moondays") + else + context.labeltext("moon") + end + context(":~") + context(moondata) + context.NC() + --context.labeltext("sunrise") + context("\\SunA[background=Sunrise]{}") + context("\\quad :~") + context(sunrise) + context.NC() + context("\\SunA[background=Sunset]{}") + context("\\quad :~") + context(sunset) + context.NC() + context("\\SunB[background=Light]{}") + context("~:~") + context(lighthours) + context.NC() + context.NR() + context.stoptabulate() + context.eTD() + context.eTR() + end + context.eTABLE() + context.page() +end + +\stopluacode + +\startsetups[table:monthblock] + \setupTABLE[split=yes] + \setupTABLE[each][each][frame=on] + \setupTABLE[r][each][offset=0pt,loffset=3pt,roffset=3pt,align=lohi] + \setupTABLE[c][1][width=0.35\textwidth,align=lohi] + \setupTABLE[c][2][style={\switchtobodyfont[6pt]},width=0.65\textwidth] \stopsetups + +\define[5]\Yearofmonthtables{\ctxlua{thirddata.diary.year_of_monthtables(#1,#2,#3,#4,#5)}} + +\startbuffer[Yearofmonthtables] + \Yearofmonthtables %Year,lat,lon,timeoffset,dst_start,dst_stop + {\getvariable{PocketDiary}{Year}} + {\getvariable{PocketDiaryGeoPosition}{lat}} + {\getvariable{PocketDiaryGeoPosition}{lon}} + {\getvariable{PocketDiaryGeoPosition}{timeoffset}} + {"\getvariable{PocketDiaryGeoPosition}{continent}"} +\stopbuffer + +% Implement international interface: +\setuplabeltext[en][title=Title] +\setuplabeltext[nl][title=Titel] +\setuplabeltext[de][title=Titel] +\setuplabeltext[fr][title=Titre] +\setuplabeltext[it][title=Titolo] +\setuplabeltext[es][title=Título] + +\setuplabeltext[en][author=Author] +\setuplabeltext[nl][author=Auteur] +\setuplabeltext[de][author=Autor] +\setuplabeltext[fr][author=Auteur] +\setuplabeltext[it][author=autore] +\setuplabeltext[es][author=Autor] + +\setuplabeltext[en][typography=Typography] +\setuplabeltext[nl][typography=Typografie] +\setuplabeltext[de][typography=Typographie] +\setuplabeltext[fr][typography=Typographie] +\setuplabeltext[it][typography=Tipografia] +\setuplabeltext[es][typography=Tipografía] + +\setuplabeltext[en][compilation=Compilation date] +\setuplabeltext[nl][compilation=Compilatie datum] +\setuplabeltext[de][compilation=Kompilationsdatum] +\setuplabeltext[fr][compilation=Date de compilation] +\setuplabeltext[it][compilation=Dato di compilazione] +\setuplabeltext[es][compilation=Fecha de compilación] + +\starttext + + \startstandardmakeup[page=yes,doublesided=no] + \strut + \startalignment [middle] + \godown[.3\textheight] + \startmode[English] + {\bfc \labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[Dutch] + {\bfc \labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[German] + {\bfc \labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar} } + \stopmode + \startmode[French] + {\bfc \labeltext{calendar} du \labeltext{sunstar} + et de la \labeltext{moon}} + \stopmode + \startmode[Italian] + {\bfc \labeltext{calendar} di \labeltext{sunstar} + e della \labeltext{moon}} + \stopmode + \startmode[Spanish] + {\labeltext{calendar} del \labeltext{sunstar} + y la \labeltext{moon}} + \stopmode + \blank + {\bfb \getvariable{PocketDiary}{Place}} + \vfill + {\tfa \getvariable{PocketDiary}{Year}} + \stopalignment + \vfil + \stopstandardmakeup + + \startstandardmakeup[page=yes,doublesided=no] + \starttabulate[|l|p|] + \NC \labeltext{title} + \EQ + \startmode[English] + {\labeltext{sunstar}- and \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[Dutch] + {\labeltext{sunstar}- en \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[German] + {\labeltext{sunstar}n- und \labeltext{moon}-\labeltext{calendar}} + \stopmode + \startmode[French] + {\labeltext{calendar} du \labeltext{sunstar} + et de la \labeltext{moon}} + \stopmode + \startmode[Italian] + {\labeltext{calendar} di \labeltext{sunstar} + e della \labeltext{moon}} + \stopmode + \startmode[Spanish] + {\labeltext{calendar} del \labeltext{sunstar} + y la \labeltext{moon}} + \stopmode + \NC\NR + \NC \labeltext{author} + \EQ \getvariable{PocketDiaryAddress}{Forename}~ + \getvariable{PocketDiaryAddress}{Familyname} \NC\NR + \NC \labeltext{typography} \EQ \CONTEXT\ with \LUAMETATEX \NC\NR + \NC \labeltext[compilation] \EQ \currentdate \NC\NR + \stoptabulate + \vfil + \startmode[English] + This calendar is generated for \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[German] + Dieser Kalender ist berechnet für \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[Dutch] + Deze kalender is opgemaakt voor \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[French] + Ce calendrier est fait pour \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[Italian] + Questo calendario è prodotto per \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \startmode[Spanish] + Este calendario está calculado para \getvariable{PocketDiary}{Place}, + \getvariable{PocketDiary}{Country} + \stopmode + \starttabulate[|l|r|] + \NC Longitude \EQ \getvariable{PocketDiaryGeoPosition}{lon} \NC\NR + \NC Latitude \EQ \getvariable{PocketDiaryGeoPosition}{lat} \NC\NR + \stoptabulate + \stopstandardmakeup + + \getbuffer[Yearofmonthtables] + +\stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/LICENSE b/macros/context/contrib/context-collatingmarks/LICENSE new file mode 100644 index 0000000000..a7a158b93c --- /dev/null +++ b/macros/context/contrib/context-collatingmarks/LICENSE @@ -0,0 +1 @@ +Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/VERSION b/macros/context/contrib/context-collatingmarks/VERSION new file mode 100644 index 0000000000..bcdfbcd1bb --- /dev/null +++ b/macros/context/contrib/context-collatingmarks/VERSION @@ -0,0 +1 @@ +2023.03.23 \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/README.md b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/README.md new file mode 100644 index 0000000000..f35f92a89e --- /dev/null +++ b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/README.md @@ -0,0 +1,36 @@ +## Collting Marks + +# Introduction +Collating marks are small black rules placed on printed sections. On each section the mark is moved by the length of the black rule. When the book is assembled on the spine appears a stair like pattern. Continuity of this pattern insures that the book is ordered in the correct sequence of sections. + +# Usage +The module is used in connection with arranging pages for folding to form sections. + +Depending on the arranging scheme used the module must be set up accordingly in the set of MetaPost variables. + +Example: + +\usemodule[collatingmarks][Collatingmarks=yes] + +\setupMPvariables + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm, % used for correction if horizontal page-shifting is used + frenchdoors=false, + wickel=false] + +This setup is used for the arranging scheme \setuparranging[2*4*2] which indicates that it is double-sided printed with 4 pages recto and verso and there are two sheets of paper forming together the sections containing 16 pages. + +The shift parameter is used to adjust the position of the collating mark centered on the spine. This is specially important when a horizontal shift-list is used for arranging! + +Exanmple: + +\definepageshift + [hor] + [horizontal] + [1mm,-1mm,.75mm,-.75mm,.5mm,-.5mm,.25mm,0mm, + 0mm,-.25mm,.5mm,-.5mm,.75mm,-.75mm,1mm,-1mm] + +\setuppageshift[paper][hor] %paper= arrange only, horizontal only + +\setuparranging[2*2*4] diff --git a/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf new file mode 100644 index 0000000000..1dd95ed6c6 Binary files /dev/null and b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf differ diff --git a/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex new file mode 100644 index 0000000000..ab3abb9aa3 --- /dev/null +++ b/macros/context/contrib/context-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex @@ -0,0 +1,3 @@ +The documentation of this module can be created from the source-file by running: + +mtxrun --script modules --process t-collatingmarks.tex \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/LICENSE b/macros/context/contrib/context-collatingmarks/t-collatingmarks/LICENSE deleted file mode 100644 index a7a158b93c..0000000000 --- a/macros/context/contrib/context-collatingmarks/t-collatingmarks/LICENSE +++ /dev/null @@ -1 +0,0 @@ -Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/VERSION b/macros/context/contrib/context-collatingmarks/t-collatingmarks/VERSION deleted file mode 100644 index bcdfbcd1bb..0000000000 --- a/macros/context/contrib/context-collatingmarks/t-collatingmarks/VERSION +++ /dev/null @@ -1 +0,0 @@ -2023.03.23 \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/README.md b/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/README.md deleted file mode 100644 index f35f92a89e..0000000000 --- a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/README.md +++ /dev/null @@ -1,36 +0,0 @@ -## Collting Marks - -# Introduction -Collating marks are small black rules placed on printed sections. On each section the mark is moved by the length of the black rule. When the book is assembled on the spine appears a stair like pattern. Continuity of this pattern insures that the book is ordered in the correct sequence of sections. - -# Usage -The module is used in connection with arranging pages for folding to form sections. - -Depending on the arranging scheme used the module must be set up accordingly in the set of MetaPost variables. - -Example: - -\usemodule[collatingmarks][Collatingmarks=yes] - -\setupMPvariables - [pages=8, % pages per sheet of paper doublesided - sheets=2, % sheets of paper used per section - horpageshift=0mm, % used for correction if horizontal page-shifting is used - frenchdoors=false, - wickel=false] - -This setup is used for the arranging scheme \setuparranging[2*4*2] which indicates that it is double-sided printed with 4 pages recto and verso and there are two sheets of paper forming together the sections containing 16 pages. - -The shift parameter is used to adjust the position of the collating mark centered on the spine. This is specially important when a horizontal shift-list is used for arranging! - -Exanmple: - -\definepageshift - [hor] - [horizontal] - [1mm,-1mm,.75mm,-.75mm,.5mm,-.5mm,.25mm,0mm, - 0mm,-.25mm,.5mm,-.5mm,.75mm,-.75mm,1mm,-1mm] - -\setuppageshift[paper][hor] %paper= arrange only, horizontal only - -\setuparranging[2*2*4] diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf b/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf deleted file mode 100644 index 1dd95ed6c6..0000000000 Binary files a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf and /dev/null differ diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex b/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex deleted file mode 100644 index ab3abb9aa3..0000000000 --- a/macros/context/contrib/context-collatingmarks/t-collatingmarks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex +++ /dev/null @@ -1,3 +0,0 @@ -The documentation of this module can be created from the source-file by running: - -mtxrun --script modules --process t-collatingmarks.tex \ No newline at end of file diff --git a/macros/context/contrib/context-collatingmarks/t-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex b/macros/context/contrib/context-collatingmarks/t-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex deleted file mode 100644 index 5b340243a5..0000000000 --- a/macros/context/contrib/context-collatingmarks/t-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex +++ /dev/null @@ -1,177 +0,0 @@ -%D \module -%D [ file=t-collatingmarks, -%D version=\currentdate, -%D title=\CONTEXT\ User Module, -%D subtitle=Environment for collating marks, -%D author={W. Egger}, -%D date=\currentdate, -%D copyright={W. Egger}, -%D email=w.egger@boede.nl, -%D license=Public Domain] -%D -%D The documentation can be generated with: -%D mtxrun --script modules --process t-collatingmarks.tex - -\startmodule[collatingmarks] - -\writestatus{loading}{Context Module for collating marks} - -%D\enablemode[demo] - -%D \subject{Introduction} -%D -%D This code is based on the work of Thomas A. Schmitz, who created the module for -%D different crop marks. -%D -%D If a book consists of multiple sections, each section should be marked -%D along the spine with a collating mark. This mark moves down along the spine -%D according to the number of the section. After collating the book it becomes -%D easy tho check whether the sequence of the sections is correct. One should -%D see a \quotation{stair case} on the spine of the book. -%D -%D \subject{Using the module} -%D -%D If the collating marks should be placed, then the system should be setup with -%D \type{\setupMPvariables[pages=8,sheets=2,shift=0mm,frenchdoors=false,wickel=false]} Note that the -%D collating marks-setup needs to know how many pages are placed on a -%D doublesided printed sheet of paper and how many such sheets result in a -%D section i.e. these values depend on the \type{\setuparranging} command. The -%D shift-option is 0mm if no horizontal page shifting is issued during -%D imposition. If a horizontal page shifting is used, then the shift option is -%D used to position the collating mark precisely on the spine. -%D -%D The two keys \quotation{frenchdoors} and \quotation{wickel} are used for -%D special purposes. These are not intended for general use. -%D For the preparation of a binding called -%D French doors, where there is a left (normal) and a right book, which opens -%D from left to right the MPvariable \quotation{frenchdoors} must be set to true -%D (boolean). -%D For preparing a section with parallelfolding/letterfolding/Wickelfalz the -%D MPvariable \quotation{wickel} must be set to true (boolean). -%D -%D Be aware that the use of collating marks in MKII causes a lot of calls to -%D Metapost, resulting in very long compilation times. -%D So better use MKIV where Metapost is included as a -%D library. In this case the time overhead is absolutely minimal. -%D -%D \section{Vocabulary} -%D -%D EN: Collating mark, DE: Kollationiermarke, NL: collationeerblokje -%D - - -\unprotect - -\setupmodule[Collatingmarks=yes] - -\setupMPvariables - [Collatingmarks] - [pages=16, %pages per sheet doublesided - sheets=1,% number of sheets forming one section - horpageshift=0, - frenchdoors=false, - wickel=false] - -%D We prepare collating marks: - -\processaction[\currentmoduleparameter{Collatingmarks}] - [yes=>\def\Collatingmarks{Collatingmarks}, - no=>\def\Collatingmarks{}, - \v!unknown=>\def\Collatingmarks{}, - \v!default=>\def\Collatingmarks{}] - -%D The newly prepared macros go into the page background: - -\setupbackgrounds[page][state=repeat,background={\Collatingmarks}] - -%D We define an overlay for the collating marks. - -\defineoverlay[Collatingmarks][\useMPgraphic{Collatingmarks}] - -%D We let \METAPOST do the calculations and draw de collating marks. - -\startusableMPgraphic{Collatingmarks} -StartPage; - -numeric offset, sectionno, pages, sheets, factor, correction, offset, pageshift; -path p,q; -boolean frenchdoors,wickel; - -pages := \MPvar{pages}; -sheets := \MPvar{sheets}; -pageshift := \MPvar{horpageshift}; -frenchdoors := \MPvar{frenchdoors}; -wickel := \MPvar{wickel}; - -z5colm = ulcorner Page; -z6colm = (x5colm, y5colm-10mm); - -p := unitsquare xscaled 1mm yscaled 7mm; - -if \realpagenumber mod 2 = 1 : % on uneven pages only - sectionno := \realpagenumber div (sheets*pages)+1; - label.lrt(textext("\switchtobodyfont[5pt]"& decimal sectionno &""),llcorner Page shifted (1mm,-2mm)); - if \realpagenumber mod (sheets*pages) = 1 : % on the first page of a section only - nofmarkings := (y6colm-7mm) div 7mm; - offset := y6colm-sectionno*7mm; - if sectionno > nofmarkings : - correction := sectionno div nofmarkings; - offset := y6colm-(sectionno-correction*nofmarkings)*7mm; - fi; - if frenchdoors or wickel : - p := p shifted ((PaperWidth),offset); - else : - p := p shifted (-1mm-2pageshift,offset); - fi; - fill p withcolor black; - if sectionno < 9 : - label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.3mm,0)); - else : - label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.5mm,0)); - fi; - fi; -fi; -\stopusableMPgraphic - -\protect -\stopmodule - -\doifnotmode{demo}{\endinput} - - - -%D Example: -%D \usemodule[collatingmarks][Collatingmarks=yes] -%D \setuppapersize[A5][A2] -%D \setuplayout[location=middle,marking=on] -%D \setuppagenumbering[alternative=doublesided] -%D \setuparranging[2*4] -%D -%D \setupMPvariables -%D [pages=8, % pages per sheet of paper doublesided -%D sheets=1, % sheets of paper used per section -%D horpageshift=0mm, % used for correction if horizontal page-shifting is used -%D frenchdoors=false, -%D wickel=false] -%D -%D \starttext -%D \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} -%D \stoptext - - -\usemodule[collatingmarks][Collatingmarks=yes] -\setuppapersize[A5][A2] -\setuplayout[location=middle,marking=on] -\setuppagenumbering[alternative=doublesided] -\setuparranging[2*4*2] - -\setupMPvariables - [pages=8, % pages per sheet of paper doublesided - sheets=2, % sheets of paper used per section - horpageshift=0mm, % used for correction if horizontal page-shifting is used - frenchdoors=false, - wickel=false] - -\starttext - \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} -\stoptext diff --git a/macros/context/contrib/context-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex b/macros/context/contrib/context-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex new file mode 100644 index 0000000000..5b340243a5 --- /dev/null +++ b/macros/context/contrib/context-collatingmarks/tex/context/third/collationg-marks/t-collatingmarks.tex @@ -0,0 +1,177 @@ +%D \module +%D [ file=t-collatingmarks, +%D version=\currentdate, +%D title=\CONTEXT\ User Module, +%D subtitle=Environment for collating marks, +%D author={W. Egger}, +%D date=\currentdate, +%D copyright={W. Egger}, +%D email=w.egger@boede.nl, +%D license=Public Domain] +%D +%D The documentation can be generated with: +%D mtxrun --script modules --process t-collatingmarks.tex + +\startmodule[collatingmarks] + +\writestatus{loading}{Context Module for collating marks} + +%D\enablemode[demo] + +%D \subject{Introduction} +%D +%D This code is based on the work of Thomas A. Schmitz, who created the module for +%D different crop marks. +%D +%D If a book consists of multiple sections, each section should be marked +%D along the spine with a collating mark. This mark moves down along the spine +%D according to the number of the section. After collating the book it becomes +%D easy tho check whether the sequence of the sections is correct. One should +%D see a \quotation{stair case} on the spine of the book. +%D +%D \subject{Using the module} +%D +%D If the collating marks should be placed, then the system should be setup with +%D \type{\setupMPvariables[pages=8,sheets=2,shift=0mm,frenchdoors=false,wickel=false]} Note that the +%D collating marks-setup needs to know how many pages are placed on a +%D doublesided printed sheet of paper and how many such sheets result in a +%D section i.e. these values depend on the \type{\setuparranging} command. The +%D shift-option is 0mm if no horizontal page shifting is issued during +%D imposition. If a horizontal page shifting is used, then the shift option is +%D used to position the collating mark precisely on the spine. +%D +%D The two keys \quotation{frenchdoors} and \quotation{wickel} are used for +%D special purposes. These are not intended for general use. +%D For the preparation of a binding called +%D French doors, where there is a left (normal) and a right book, which opens +%D from left to right the MPvariable \quotation{frenchdoors} must be set to true +%D (boolean). +%D For preparing a section with parallelfolding/letterfolding/Wickelfalz the +%D MPvariable \quotation{wickel} must be set to true (boolean). +%D +%D Be aware that the use of collating marks in MKII causes a lot of calls to +%D Metapost, resulting in very long compilation times. +%D So better use MKIV where Metapost is included as a +%D library. In this case the time overhead is absolutely minimal. +%D +%D \section{Vocabulary} +%D +%D EN: Collating mark, DE: Kollationiermarke, NL: collationeerblokje +%D + + +\unprotect + +\setupmodule[Collatingmarks=yes] + +\setupMPvariables + [Collatingmarks] + [pages=16, %pages per sheet doublesided + sheets=1,% number of sheets forming one section + horpageshift=0, + frenchdoors=false, + wickel=false] + +%D We prepare collating marks: + +\processaction[\currentmoduleparameter{Collatingmarks}] + [yes=>\def\Collatingmarks{Collatingmarks}, + no=>\def\Collatingmarks{}, + \v!unknown=>\def\Collatingmarks{}, + \v!default=>\def\Collatingmarks{}] + +%D The newly prepared macros go into the page background: + +\setupbackgrounds[page][state=repeat,background={\Collatingmarks}] + +%D We define an overlay for the collating marks. + +\defineoverlay[Collatingmarks][\useMPgraphic{Collatingmarks}] + +%D We let \METAPOST do the calculations and draw de collating marks. + +\startusableMPgraphic{Collatingmarks} +StartPage; + +numeric offset, sectionno, pages, sheets, factor, correction, offset, pageshift; +path p,q; +boolean frenchdoors,wickel; + +pages := \MPvar{pages}; +sheets := \MPvar{sheets}; +pageshift := \MPvar{horpageshift}; +frenchdoors := \MPvar{frenchdoors}; +wickel := \MPvar{wickel}; + +z5colm = ulcorner Page; +z6colm = (x5colm, y5colm-10mm); + +p := unitsquare xscaled 1mm yscaled 7mm; + +if \realpagenumber mod 2 = 1 : % on uneven pages only + sectionno := \realpagenumber div (sheets*pages)+1; + label.lrt(textext("\switchtobodyfont[5pt]"& decimal sectionno &""),llcorner Page shifted (1mm,-2mm)); + if \realpagenumber mod (sheets*pages) = 1 : % on the first page of a section only + nofmarkings := (y6colm-7mm) div 7mm; + offset := y6colm-sectionno*7mm; + if sectionno > nofmarkings : + correction := sectionno div nofmarkings; + offset := y6colm-(sectionno-correction*nofmarkings)*7mm; + fi; + if frenchdoors or wickel : + p := p shifted ((PaperWidth),offset); + else : + p := p shifted (-1mm-2pageshift,offset); + fi; + fill p withcolor black; + if sectionno < 9 : + label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.3mm,0)); + else : + label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.5mm,0)); + fi; + fi; +fi; +\stopusableMPgraphic + +\protect +\stopmodule + +\doifnotmode{demo}{\endinput} + + + +%D Example: +%D \usemodule[collatingmarks][Collatingmarks=yes] +%D \setuppapersize[A5][A2] +%D \setuplayout[location=middle,marking=on] +%D \setuppagenumbering[alternative=doublesided] +%D \setuparranging[2*4] +%D +%D \setupMPvariables +%D [pages=8, % pages per sheet of paper doublesided +%D sheets=1, % sheets of paper used per section +%D horpageshift=0mm, % used for correction if horizontal page-shifting is used +%D frenchdoors=false, +%D wickel=false] +%D +%D \starttext +%D \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} +%D \stoptext + + +\usemodule[collatingmarks][Collatingmarks=yes] +\setuppapersize[A5][A2] +\setuplayout[location=middle,marking=on] +\setuppagenumbering[alternative=doublesided] +\setuparranging[2*4*2] + +\setupMPvariables + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm, % used for correction if horizontal page-shifting is used + frenchdoors=false, + wickel=false] + +\starttext + \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} +\stoptext diff --git a/macros/context/contrib/context-interval-calendar/LICENSE b/macros/context/contrib/context-interval-calendar/LICENSE new file mode 100644 index 0000000000..a7a158b93c --- /dev/null +++ b/macros/context/contrib/context-interval-calendar/LICENSE @@ -0,0 +1 @@ +Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/VERSION b/macros/context/contrib/context-interval-calendar/VERSION new file mode 100644 index 0000000000..48d81a803c --- /dev/null +++ b/macros/context/contrib/context-interval-calendar/VERSION @@ -0,0 +1 @@ +2022-08-13 \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf b/macros/context/contrib/context-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf new file mode 100644 index 0000000000..a97245c510 Binary files /dev/null and b/macros/context/contrib/context-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf differ diff --git a/macros/context/contrib/context-interval-calendar/t-interval-calendar/LICENSE b/macros/context/contrib/context-interval-calendar/t-interval-calendar/LICENSE deleted file mode 100644 index a7a158b93c..0000000000 --- a/macros/context/contrib/context-interval-calendar/t-interval-calendar/LICENSE +++ /dev/null @@ -1 +0,0 @@ -Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/t-interval-calendar/VERSION b/macros/context/contrib/context-interval-calendar/t-interval-calendar/VERSION deleted file mode 100644 index 48d81a803c..0000000000 --- a/macros/context/contrib/context-interval-calendar/t-interval-calendar/VERSION +++ /dev/null @@ -1 +0,0 @@ -2022-08-13 \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/t-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf b/macros/context/contrib/context-interval-calendar/t-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf deleted file mode 100644 index a97245c510..0000000000 Binary files a/macros/context/contrib/context-interval-calendar/t-interval-calendar/doc/context/third/interval-calendar/t-intervalcalendar-module-doc.pdf and /dev/null differ diff --git a/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex b/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex deleted file mode 100644 index e5da11f8f0..0000000000 --- a/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex +++ /dev/null @@ -1,44 +0,0 @@ -% Context file -% Filename: Interval-calendar.tex -% -% 13-08-2022 -% Copyright (c) 2022 Willi Egger. All rights reserved. - -% \enablemode[weekly] -% \enablemode[twoweekly] -\enablemode[monthly] - -\usemodule[intervalcalendar] - -\mainlanguage[en] - -\startsetups table:interval_check - \setupTABLE[split=repeat] - \setupTABLE[r][each][height=12mm,align=lohi] - \setupTABLE[r][1][style=bold,align={lohi,middle}] - \setupTABLE[c][1][width=0.2\textwidth] - \setupTABLE[c][2,3,4][width=0.15\textwidth] - \setupTABLE[c][5][width=0.3\textwidth] -\stopsetups - -% Columnheads -\setuplabeltext[en][c1=Datum] -\setuplabeltext[en][c2=Gas] -\setuplabeltext[en][c3=Electricity] -\setuplabeltext[en][c4=Water] -\setuplabeltext[en][c5=Observation] - - -\starttext - - \startmode[weekly] - \Checklist{"2022-8-10"}{"2022-9-30"}{5}{7} % startdate,enddate,columns,interval - \stopmode - \startmode[twoweekly] - \Checklist{"2022/9/10"}{"2023/01/31"}{5}{14} % startdate,enddate,columns,interval - \stopmode - \startmode[monthly] - \Checklist{"2022/8/10"}{"2023/05/31"}{5}{30} % startdate,enddate,columns,interval - \stopmode - - \stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex b/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex deleted file mode 100644 index 4d1c38cac1..0000000000 --- a/macros/context/contrib/context-interval-calendar/t-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex +++ /dev/null @@ -1,265 +0,0 @@ -%D \module -%D [ file=t-interval-calender, -%D version=2022.08.13, -%D title=\CONTEXT\ User Module, -%D subtitle=Interval Calendar, -%D author=Willi Egger, -%D date=\currentdate, -%D copyright=Willi Egger, -%D email=w.egger@boede.nl, -%D license=Public Domain] - -\startmodule[intervalcalendar] - -\writestatus{loading}{ConTeXt User Module / Interval Calendar} - -%D \startsubject[title=Introduction] -%D After announcing a presentation for the 16th \CONTEXT -Meeting in Dreifelden, -%D Germany, over a new version of the PocketDiary module, Taco Hoekwater asked -%D whether the PocketDiary module might also be -%D able to produce lists with calendar-dates in intervals like \quote{weekly}, -%D \quote{twoweekly} or \quote{monthly} for the purpose of taking notes for -%D checks on a regular base. -- The lists should be configurable for the length -%D of the list, the number of columns and the possibility to assign an -%D individual -%D column-header. -- Quickly it appeared, that the use of the PocketDiary module -%D is not necessary. In order to be able to do math on dates it is the easiest -%D to convert a date to a timestamp in seconds or what is used by the -%D operating-system. -- Due to the fact that there are repeating calculations -%D done it is easiest to keep as much as possible at the lua end. Therefore the -%D out-put is prepared as a \CONTEXT -LUA-document (cld). -%D \stopsubject - -%D \startsubject[title=One Mode for Each List] -%D -%D The module can be used for the production of different lists. For each -%D list we define a mode. - -\definemode[weekly][keep] -\definemode[twoweekly][keep] -\definemode[monthly][keep] - -%D None of the modes are activated. - -%D \stopsubject - -%D \startsubject[title=General Setups] - -\setupbodyfont[dejavu,ss,12pt] -\setuppagenumbering[location=] - -\setuppapersize[A4,portrait][A4,portrait] - -\setuplayout - [topspace=20mm, - backspace=12mm, - header=10mm, - footer=2\bodyfontsize, - height=middle, - width=middle] - -\setupfootertexts - [\jobname .pdf] - [\pagenumber\ / \totalnumberofpages] - -%D \stopsubject - -%D \startsubject[title=LUA-Code] - -\startluacode - - thirddata = thirddata or { } - thirddata.calendar = { } - local calendar = thirddata.calendar - - local report = logs.reporter("Interval Checks") - - local interval_dates = {} - - function calendar.interval_checks(startdate,stopdate,cols,intval) - - local startdate_string =startdate - local stopdate_string =stopdate - local columns=cols - local intervaldays = intval - - local year,month,day = calendar.date(startdate_string) - local start_time_stamp = os.time({year=year,month=month,day=day}) - - --report("Starttimestamp: %s", start_time_stamp) - - local year,month,day = calendar.date(stopdate_string) - local end_time_stamp = os.time{year=year,month=month,day=day} - - local interval = intervaldays * 24 * 60 * 60 - - for i = start_time_stamp, end_time_stamp, interval do - local interval_date = os.date("%d-%m-%Y",i) - table.insert(interval_dates,interval_date) - report("%s",interval_date) - end - - calendar.print_interval_checks(columns) - end - - function calendar.print_interval_checks(cols) - - local columns = cols - - context.bTABLE({setups="table:interval_check"}) - context.bTABLEhead() - context.bTR() - for i = 1,columns do - context.bTH() - context.labeltext("c"..i) - context.eTH() - end - context.eTR() - context.eTABLEhead() - context.bTABLEbody() - for k,v in ipairs(interval_dates) do - context.bTR() - context.bTD() - context(v) - context.eTD() - for i=1,columns-1 do - context.bTD() - context.strut() - context.eTD() - end - context.eTR() - end - context.eTABLEbody() - context.eTABLE() - end - - function calendar.date(inputstr) - - --report("Input : %s",inputstr) - - local sep = "%-%s/" - if sep == nil then - sep = "%s" - end - local t={} - i=1 - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - t[i] = str - --report("Actual string %s", str) - i = i + 1 - end - - --report("Datum strings: %s, %s, %s", t[1],t[2],t[3]) - - return t[1],t[2],t[3] - end -\stopluacode - -%D The main function is the \quote{calendar.interval_ckecks} function -%D with 4 parameters. The function needs a start-date, an end-date, -%D the number of columns for the table in the out-put and the interval -%D in days. The function calculates all dates fitting into the start -%D and end dates based on the epoch-time. It converts the timestamp -%D into a human readable date format and puts the values into a -%D table \quote{interval_dates}. -%D -%D The second function is called from within the first function and -%D gets the number of columns as parameter. This function creates the -%D out-put table. It is a flexible setup, which is based on the -%D number of the columns provided as a parameter. Label-texts are used -%D for the column heads and the column heads are repeated at the top -%D of each following page. -%D -%D The third function is there to deal with the preparation of the dates, -%D which are sent to LUA as strings. It extracts the year (yyyy) the -%D month (m) and day (d). The extracted values are put into a table. The dates -%D can be entered in the format 2022-8-21 or as 2022/8/21. - -%D \stopsubject - -%D \startsubject[title=Macro for Calling the List Generator] -%D The command needs 4 parameters: Start-date, stop-date, number of -%D columns in the table and the interval in days. - -\define[4]\Checklist{\ctxlua{thirddata.calendar.interval_checks(#1,#2,#3,#4)}} - -%D \stopsubject - -%D \startsubject[title=Setups for the Out-Put Table] - -%D The layout of the out-put table is organized at the \TEX\ end. If -%D the table design changes in terms of more or less columns, this -%D setup has to be adapted. - -\startsetups table:interval_check - \setupTABLE[split=repeat] - \setupTABLE[r][each][height=12mm,align=lohi] - \setupTABLE[r][1][style=bold,align={lohi,middle}] - \setupTABLE[c][1][width=0.2\textwidth] - \setupTABLE[c][2,3,4][width=0.15\textwidth] - \setupTABLE[c][5][width=0.3\textwidth] -\stopsetups - -%D \stopsubject - -%D \startsubject[title=Column Head Texts] -%D It has been chosen to use the label-text mechanism to implement -%D the head texts of the columns. Depending on the design of the -%D out-put table the names can be adapted, the list can be made longer -%D or shorter according to the needs. - -\setuplabeltext[en][c1=Datum] -\setuplabeltext[en][c2=Gas] -\setuplabeltext[en][c3=Electricity] -\setuplabeltext[en][c4=Water] -\setuplabeltext[en][c5=Observation] - -%D \stopsubject - -%D \startsubject[title=Header Texts of Out-Put] -%D -%D Also for the header texts the label text mechanism is used. Now only three -%D intervals are defined, but this mechanism allows easily to extend the list -%D of possible header texts. It also allows to implement other languages. -%D Depending on the setting of the \type{\mainlanguage[]} the correct labels -%D are picked up and typeset. - -\setuplabeltext[en][weekly={Weekly Checks}] -\setuplabeltext[en][twoweekly={Two-weekly Checks}] -\setuplabeltext[en][monthly={Monthly Checks}] - -\setuplabeltext[de][weekly={Wochen Checks}] -\setuplabeltext[de][twoweekly={Zwei Wochen Checks}] -\setuplabeltext[de][monthly={Monatliche Checks}] - -\setuplabeltext[nl][weekly={Weekelijkse Checks}] -\setuplabeltext[nl][twoweekly={Twee-weekelijkse Checks}] -\setuplabeltext[nl][monthly={Maandelijkse Checks}] - -%D \stopsubject - -%D \startsubject[title=Header Text Setup] - -%D Each list gets a header text fitting the purpose of the list. - -\startmode[weekly] - \setupheadertexts - [\midaligned{\bfc \labeltext{weekly}}] - [] -\stopmode - -\startmode[twoweekly] - \setupheadertexts - [\midaligned{\bfc \labeltext{twoweekly}}] - [] -\stopmode - -\startmode[monthly] - \setupheadertexts - [\midaligned{\bfc \labeltext{monthly}}] - [] -\stopmode - -%D \stopsubject - -\stopmodule \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex b/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex new file mode 100644 index 0000000000..e5da11f8f0 --- /dev/null +++ b/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/Interval-calendar.tex @@ -0,0 +1,44 @@ +% Context file +% Filename: Interval-calendar.tex +% +% 13-08-2022 +% Copyright (c) 2022 Willi Egger. All rights reserved. + +% \enablemode[weekly] +% \enablemode[twoweekly] +\enablemode[monthly] + +\usemodule[intervalcalendar] + +\mainlanguage[en] + +\startsetups table:interval_check + \setupTABLE[split=repeat] + \setupTABLE[r][each][height=12mm,align=lohi] + \setupTABLE[r][1][style=bold,align={lohi,middle}] + \setupTABLE[c][1][width=0.2\textwidth] + \setupTABLE[c][2,3,4][width=0.15\textwidth] + \setupTABLE[c][5][width=0.3\textwidth] +\stopsetups + +% Columnheads +\setuplabeltext[en][c1=Datum] +\setuplabeltext[en][c2=Gas] +\setuplabeltext[en][c3=Electricity] +\setuplabeltext[en][c4=Water] +\setuplabeltext[en][c5=Observation] + + +\starttext + + \startmode[weekly] + \Checklist{"2022-8-10"}{"2022-9-30"}{5}{7} % startdate,enddate,columns,interval + \stopmode + \startmode[twoweekly] + \Checklist{"2022/9/10"}{"2023/01/31"}{5}{14} % startdate,enddate,columns,interval + \stopmode + \startmode[monthly] + \Checklist{"2022/8/10"}{"2023/05/31"}{5}{30} % startdate,enddate,columns,interval + \stopmode + + \stoptext \ No newline at end of file diff --git a/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex b/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex new file mode 100644 index 0000000000..4d1c38cac1 --- /dev/null +++ b/macros/context/contrib/context-interval-calendar/tex/context/third/interval-calendar/t-intervalcalendar.tex @@ -0,0 +1,265 @@ +%D \module +%D [ file=t-interval-calender, +%D version=2022.08.13, +%D title=\CONTEXT\ User Module, +%D subtitle=Interval Calendar, +%D author=Willi Egger, +%D date=\currentdate, +%D copyright=Willi Egger, +%D email=w.egger@boede.nl, +%D license=Public Domain] + +\startmodule[intervalcalendar] + +\writestatus{loading}{ConTeXt User Module / Interval Calendar} + +%D \startsubject[title=Introduction] +%D After announcing a presentation for the 16th \CONTEXT -Meeting in Dreifelden, +%D Germany, over a new version of the PocketDiary module, Taco Hoekwater asked +%D whether the PocketDiary module might also be +%D able to produce lists with calendar-dates in intervals like \quote{weekly}, +%D \quote{twoweekly} or \quote{monthly} for the purpose of taking notes for +%D checks on a regular base. -- The lists should be configurable for the length +%D of the list, the number of columns and the possibility to assign an +%D individual +%D column-header. -- Quickly it appeared, that the use of the PocketDiary module +%D is not necessary. In order to be able to do math on dates it is the easiest +%D to convert a date to a timestamp in seconds or what is used by the +%D operating-system. -- Due to the fact that there are repeating calculations +%D done it is easiest to keep as much as possible at the lua end. Therefore the +%D out-put is prepared as a \CONTEXT -LUA-document (cld). +%D \stopsubject + +%D \startsubject[title=One Mode for Each List] +%D +%D The module can be used for the production of different lists. For each +%D list we define a mode. + +\definemode[weekly][keep] +\definemode[twoweekly][keep] +\definemode[monthly][keep] + +%D None of the modes are activated. + +%D \stopsubject + +%D \startsubject[title=General Setups] + +\setupbodyfont[dejavu,ss,12pt] +\setuppagenumbering[location=] + +\setuppapersize[A4,portrait][A4,portrait] + +\setuplayout + [topspace=20mm, + backspace=12mm, + header=10mm, + footer=2\bodyfontsize, + height=middle, + width=middle] + +\setupfootertexts + [\jobname .pdf] + [\pagenumber\ / \totalnumberofpages] + +%D \stopsubject + +%D \startsubject[title=LUA-Code] + +\startluacode + + thirddata = thirddata or { } + thirddata.calendar = { } + local calendar = thirddata.calendar + + local report = logs.reporter("Interval Checks") + + local interval_dates = {} + + function calendar.interval_checks(startdate,stopdate,cols,intval) + + local startdate_string =startdate + local stopdate_string =stopdate + local columns=cols + local intervaldays = intval + + local year,month,day = calendar.date(startdate_string) + local start_time_stamp = os.time({year=year,month=month,day=day}) + + --report("Starttimestamp: %s", start_time_stamp) + + local year,month,day = calendar.date(stopdate_string) + local end_time_stamp = os.time{year=year,month=month,day=day} + + local interval = intervaldays * 24 * 60 * 60 + + for i = start_time_stamp, end_time_stamp, interval do + local interval_date = os.date("%d-%m-%Y",i) + table.insert(interval_dates,interval_date) + report("%s",interval_date) + end + + calendar.print_interval_checks(columns) + end + + function calendar.print_interval_checks(cols) + + local columns = cols + + context.bTABLE({setups="table:interval_check"}) + context.bTABLEhead() + context.bTR() + for i = 1,columns do + context.bTH() + context.labeltext("c"..i) + context.eTH() + end + context.eTR() + context.eTABLEhead() + context.bTABLEbody() + for k,v in ipairs(interval_dates) do + context.bTR() + context.bTD() + context(v) + context.eTD() + for i=1,columns-1 do + context.bTD() + context.strut() + context.eTD() + end + context.eTR() + end + context.eTABLEbody() + context.eTABLE() + end + + function calendar.date(inputstr) + + --report("Input : %s",inputstr) + + local sep = "%-%s/" + if sep == nil then + sep = "%s" + end + local t={} + i=1 + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + t[i] = str + --report("Actual string %s", str) + i = i + 1 + end + + --report("Datum strings: %s, %s, %s", t[1],t[2],t[3]) + + return t[1],t[2],t[3] + end +\stopluacode + +%D The main function is the \quote{calendar.interval_ckecks} function +%D with 4 parameters. The function needs a start-date, an end-date, +%D the number of columns for the table in the out-put and the interval +%D in days. The function calculates all dates fitting into the start +%D and end dates based on the epoch-time. It converts the timestamp +%D into a human readable date format and puts the values into a +%D table \quote{interval_dates}. +%D +%D The second function is called from within the first function and +%D gets the number of columns as parameter. This function creates the +%D out-put table. It is a flexible setup, which is based on the +%D number of the columns provided as a parameter. Label-texts are used +%D for the column heads and the column heads are repeated at the top +%D of each following page. +%D +%D The third function is there to deal with the preparation of the dates, +%D which are sent to LUA as strings. It extracts the year (yyyy) the +%D month (m) and day (d). The extracted values are put into a table. The dates +%D can be entered in the format 2022-8-21 or as 2022/8/21. + +%D \stopsubject + +%D \startsubject[title=Macro for Calling the List Generator] +%D The command needs 4 parameters: Start-date, stop-date, number of +%D columns in the table and the interval in days. + +\define[4]\Checklist{\ctxlua{thirddata.calendar.interval_checks(#1,#2,#3,#4)}} + +%D \stopsubject + +%D \startsubject[title=Setups for the Out-Put Table] + +%D The layout of the out-put table is organized at the \TEX\ end. If +%D the table design changes in terms of more or less columns, this +%D setup has to be adapted. + +\startsetups table:interval_check + \setupTABLE[split=repeat] + \setupTABLE[r][each][height=12mm,align=lohi] + \setupTABLE[r][1][style=bold,align={lohi,middle}] + \setupTABLE[c][1][width=0.2\textwidth] + \setupTABLE[c][2,3,4][width=0.15\textwidth] + \setupTABLE[c][5][width=0.3\textwidth] +\stopsetups + +%D \stopsubject + +%D \startsubject[title=Column Head Texts] +%D It has been chosen to use the label-text mechanism to implement +%D the head texts of the columns. Depending on the design of the +%D out-put table the names can be adapted, the list can be made longer +%D or shorter according to the needs. + +\setuplabeltext[en][c1=Datum] +\setuplabeltext[en][c2=Gas] +\setuplabeltext[en][c3=Electricity] +\setuplabeltext[en][c4=Water] +\setuplabeltext[en][c5=Observation] + +%D \stopsubject + +%D \startsubject[title=Header Texts of Out-Put] +%D +%D Also for the header texts the label text mechanism is used. Now only three +%D intervals are defined, but this mechanism allows easily to extend the list +%D of possible header texts. It also allows to implement other languages. +%D Depending on the setting of the \type{\mainlanguage[]} the correct labels +%D are picked up and typeset. + +\setuplabeltext[en][weekly={Weekly Checks}] +\setuplabeltext[en][twoweekly={Two-weekly Checks}] +\setuplabeltext[en][monthly={Monthly Checks}] + +\setuplabeltext[de][weekly={Wochen Checks}] +\setuplabeltext[de][twoweekly={Zwei Wochen Checks}] +\setuplabeltext[de][monthly={Monatliche Checks}] + +\setuplabeltext[nl][weekly={Weekelijkse Checks}] +\setuplabeltext[nl][twoweekly={Twee-weekelijkse Checks}] +\setuplabeltext[nl][monthly={Maandelijkse Checks}] + +%D \stopsubject + +%D \startsubject[title=Header Text Setup] + +%D Each list gets a header text fitting the purpose of the list. + +\startmode[weekly] + \setupheadertexts + [\midaligned{\bfc \labeltext{weekly}}] + [] +\stopmode + +\startmode[twoweekly] + \setupheadertexts + [\midaligned{\bfc \labeltext{twoweekly}}] + [] +\stopmode + +\startmode[monthly] + \setupheadertexts + [\midaligned{\bfc \labeltext{monthly}}] + [] +\stopmode + +%D \stopsubject + +\stopmodule \ No newline at end of file -- cgit v1.2.3