2

How can I calculate the moon phase for LaTeX calendar?

My start point is D.E.Knuth's algorithm to calculate Easter is applied here https://texample.net/tikz/examples/birthday-calendar/

The number E is the epact, which specifies when a full moon occurs. However, I don't know how to access the variable \l_easter_E_int

If I could access E, then full moon would happen around 29 days after E.

The code

  Easter=-3, % Maundy Thursday
  Easter=-2, % Good Friday
  Easter,    % Easter Sunday
  Easter=1,  % Easter Monday
  Easter=39, % Feast of the Ascension
  Easter=49, % Pentecost
  Easter=50, % Whit Monday

Seems to be an easy way to state days with respect to "Easter". I don't know how this command works.

But instead of Easter=1, Easter=29,

How can I make the reference Epach=1, Epach=29, etc.?

  • Welcome to TeX.SE. Knuth's algorithm is for the calculation of Easter Sunday. For moon phase calculations, other, much more precise algorithms exist. Run a google search for "moon phase calculator" to learn about some of them. – Mico Jan 15 '21 at 18:28
  • @Mico Thanks. After 1 hour of search, I have not found any LaTeX calendar example with automatically calculated moon phases. Also, my calendar will in every casel contain Knuth's algorithm which already calculates a full moon occurence \l_easter_E_int. – Juha-Matti Huusko Jan 15 '21 at 18:38
  • 1
    What about using a Lua script via LuaLaTeX? –  Jan 15 '21 at 18:57
  • See https://tex.stackexchange.com/questions/34785/how-to-typeset-moon-phase-symbols for how to typeset the phase, once it is calculated. – Steven B. Segletes Jun 15 '21 at 11:33
  • @StevenB.Segletes OK, I know this. But how can I typeset the Easter, once it is calculated? – Juha-Matti Huusko Jun 17 '21 at 09:16
  • I'm not sure your exact meaning. In the Western world, Easter falls on the first Sunday after the first full moon after the vernal equinox. Therefore, Easter will always be between 1 and 7 days after the full moon, depending on the year. – Steven B. Segletes Jun 17 '21 at 09:49

1 Answers1

1

I remember back in the 80s there being a plain TeX macro in a file phoon.tex which calculated the phase of the moon, but this appears to have disappeared along with a lot of other ephemera of that era. However, there is another plain TeX macro file, https://ctan.org/pkg/dayofweek which includes a macro which calculates the phase of the moon.

I found this by going to https://ctan.org and entering “moon” into the searchbox. Too bad there's no longer any trace of that old phoon.tex file. I'm pretty sure that was the first solution of the problem.

Don Hosek
  • 14,078