On 12/16/24 23:49, Aditya Mahajan wrote:
On Mon, 16 Dec 2024, Pablo Rodriguez via ntg-context wrote:
I‘m afraid that approach is too complex for me to implement a full calendar of previous, current and next year.
tikz has various macros to typeset calendars: [...] Also see https://tikz.dev/library-calender and https://texample.net/ tikz/examples/feature/calendar-library/ (which, in principle, can be translated to ConTeXt rather easily).
Hi Aditya, many thanks for the reference: this solves all my needs (see below). It would be great (as per https://texample.net/tikz/examples/birthday-calendar/) to have automatic Easter calculation. I guess Lua code would be easier to write, but I cannot get how each Easter Sunday may be computed. Many thanks for your help and excuse my crappy (but functional) code, Pablo \unprotect \permanent\tolerant\protected\def\translate[#1]% {\getparameters[\??translation][#1]% \ifcsname\??translation\currentlanguage\endcsname \lastnamedcs \orelse\ifcsname\??translation\s!en\endcsname \lastnamedcs \else #1% \fi} \protect \usemodule[tikz] \usetikzlibrary[calendar] \setupbodyfont[palatino] \def\pgfcalendarmonthname#1{% \translate{\ifcase#1\or Enero\or Febrero\or Marzo\or Abril\or Mayo\or Junio\or Julio\or Agosto\or Septiembre\or Octubre\or Noviembre\or Diciembre\fi}% } \starttext \startbuffer \setupheadertexts[\framed[frame=off, foregroundstyle=\bfd, width=1tw, align=outer,]{\recursestring}] \startlayout[standard][align=center] \startxtable[frame=off] \ctxlua{document.rcount = 1} \dorecurse{4} {\startxrow[toffset=1st] \dorecurse{3} {\startxcell \starttikzpicture \calendar(mycal)[dates=\recursestring-\cldcontext{document.rcount}-01 to \recursestring-\cldcontext{document.rcount}-last, week list, month label above left, month text={\feature[+][smallcaps]\%mt}, ] if (Sunday, equals=2025-04-20, equals=2025-04-18, equals=2025-04-19, equals=01-01, equals=01-06, equals=02-22, equals=05-01, equals=07-28, equals=08-15, equals=09-9, equals=09-15, equals=11-1, equals=12-6, equals=12-8, equals=12-25, equals=02-22) [font=\bf]; \stoptikzpicture \stopxcell\ctxlua{document.rcount = document.rcount + 1} \startxcell[width={\ifnum\recurselevel <3 .04675tw\else 0tw\fi}] \stopxcell} \stopxrow} \stopxtable \stoplayout \stopbuffer \doloopoverlist{2050} {\getbuffer} \stoptext