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.?

6
  • 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, 2021 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. Jan 15, 2021 at 18:38
  • 1
    What about using a Lua script via LuaLaTeX?
    – user226564
    Jan 15, 2021 at 18:57
  • See tex.stackexchange.com/questions/34785/… for how to typeset the phase, once it is calculated. Jun 15, 2021 at 11:33
  • @StevenB.Segletes OK, I know this. But how can I typeset the Easter, once it is calculated? Jun 17, 2021 at 9:16

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .