I am typesetting a book which contains daily meditation exercises. There are 366 exercises (one for each day, including February 29).
The default styling for chapter titles has the text "Chapter 3" (for example) over the chapter title.
What I would like is for the "Chapter 3" to be replaced with the day of the year that corresponds with the exercise, in that case "January 3". Going forward it would reach "Chapter 31" => "January 31" and then "Chapter 32" => "February 1".
If there's a clever way to generate the chapter names so I don't have to type out 366 of them, that would be cool, but I'm fine with hardcoding them.
The bigger concern for me is how this shows up in the table of contents. I'd like it to show up "Date ChapterTitle PageNumber".
And finally, to complicate things, there is some titled material before and after the dated chapters which I want to show up in the TOC, but without a date associated with it (Introductions and About before, Appendices and Glossary after).
I'm not sure it's relevant, but the chapters are each one page.
Here's what I have so far:
\documentclass[openany]{book}
\usepackage{advdate}
\usepackage{datetime}
\newdateformat{noyear}{\monthname[\THEMONTH] \THEDAY
\SetDate[01/01/2020] % January 1 in a year with a leap day
\renewcommand{\chaptername}{}
\renewcommand{\thechapter}{\noyear\today \AdvanceDate[1]}
\begin{document}
\maketitle
\tableofcontents
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter{Ham}
\chapter{Spam}
\chapter{Eggs}
\chapter*{Appendices}
\addcontentsline{toc}{chapter}{Appendices}
\end{document}
I'm running into two problems:
- The text "January 1" is running over the chapter title in the table of contents.
- The dates aren't incrementing. I tried including
\AdvanceDate[1]
in the body (after each call to\chapter
) but that only increments the chapter header dates, it doesn't increment the dates in the table of contents.