5

I want to create a one day per page calendar. I create the pages in a for loop, but I don't know how to save and increase it each iteration.

I thought about saving day, month and year separated, but then I would have to save how many days each month has and which years are leap years.

Is there a way to save a date and/or increase it?

2 Answers 2

5

There's an old package, that temporarily sets the date with \AdvanceDate.

\documentclass{article}

\usepackage{pgffor}
\usepackage{advdate}


\begin{document}
\ThisDay{0} % Set the day number to zero
\ThisMonth{1} % Start in January
%\ThisYear{2017} % for example
\foreach \x in {1,...,365} {%
  \AdvanceDate[\x]
  {\hfill\huge\textbf{\today}\hfill}  % Just as an example
  \clearpage
}

\end{document}

As can be seen from the screen shot the \AdvanceDate command is aware of leap years

enter image description here

6
  • @JohnKormylo I'd like to see such an example from TikZ calendar library because this is the sort of thing I've wanted to do myself using TikZ. But, I've always found the TikZ calendar very frustrating to work with. Could you post such an example?
    – A.Ellett
    Commented Mar 4, 2016 at 15:28
  • @A.Ellett: Apparently there was another comment which was deleted? ;-)
    – user31729
    Commented Mar 4, 2016 at 15:57
  • Yes, there was a comment that TikZ calendar library could be easier to use... Hmm... I would have liked to see that answer too.
    – A.Ellett
    Commented Mar 4, 2016 at 16:02
  • @A.Ellett: I've never used the TikZ calendar library so far. If there's such a solution, it should be added, of course
    – user31729
    Commented Mar 4, 2016 at 16:03
  • 1
    @A.Ellett I've got some examples that use pgfcalendar in Displaying a Calendar if they're of any use. Commented Mar 4, 2016 at 16:54
0

Here is an answer using pgf macros, see Section 90 "Date and Calendar Utility Macros" of the manual:

\documentclass{article}

\usepackage{pgfcalendar}

\begin{document}
\pgfcalendar{cal}{2020-08-11}{2020-08-15}{%
  \centering\huge\bfseries%
  \pgfcalendarshorthand wt,                         % weekdayname,
  \pgfcalendarshorthand mt\ \pgfcalendarcurrentday, % monthname dayofmonth,
  \pgfcalendarcurrentyear\clearpage%                % year
}
\end{document}

The same, but using a shorthand as suggested by the manual:

\documentclass{article}

\usepackage{pgfcalendar}

\begin{document}
\let\%=\pgfcalendarshorthand
\pgfcalendar{cal}{2020-08-11}{2020-08-15}{%
  \centering\huge\bfseries%
  \%wt, \%mt \%d0, \%y0\clearpage%
}
\end{document}

The first page looks like:

Preview of the first page, having the text "Tuesday, August 11, 2020" on it.

You must log in to answer this question.

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