Is there a way to create a week count in this calendar? I am interested in including text to consider the number of the week, would this be possible using the used for loop?. I tried creating a new counter for the week and then update it as soon Monday is reached so that the week counter adds 1 but I could not make it work with this approach.
Any suggestions?
\documentclass{article}
\usepackage[paperheight=4in,paperwidth=4in]{geometry}
\usepackage{ifthen}
\usepackage{forloop}
\usepackage{nth} % for 1st, 2nd, 3rd automagically!
% set counters for day and month
\newcounter{daycount}
\newcounter{monthcount}
\setcounter{daycount}{0}
\setcounter{monthcount}{1}
\newcounter{yearcount}
\setcounter{yearcount}{2012}
\newcounter{dispdaycount} % for Mon, Tue, etc
\setcounter{dispdaycount}{6} % 2012 started on Sunday, the loop increments this by 1
\newcounter{masterDayCount} % used in the main loop from 1 to 365 (or 366 in a leap year!)
% setup words for the days of the week
\newcommand{\displayday}[1]{%
\ifthenelse{\equal{#1}{1}}{Mon}{}%
\ifthenelse{\equal{#1}{2}}{Tue}{}%
\ifthenelse{\equal{#1}{3}}{Wed}{}%
\ifthenelse{\equal{#1}{4}}{Thu}{}%
\ifthenelse{\equal{#1}{5}}{Fri}{}%
\ifthenelse{\equal{#1}{6}}{Sat}{}%
\ifthenelse{\equal{#1}{7}}{Sun}{}%
}
% setup words for the months of the year
\newcommand{\displaymonth}[1]{%
\ifthenelse{\equal{#1}{1}}{Jan}{}%
\ifthenelse{\equal{#1}{2}}{Feb}{}%
\ifthenelse{\equal{#1}{3}}{Mar}{}%
\ifthenelse{\equal{#1}{4}}{Apr}{}%
\ifthenelse{\equal{#1}{5}}{May}{}%
\ifthenelse{\equal{#1}{6}}{Jun}{}%
\ifthenelse{\equal{#1}{7}}{Jul}{}%
\ifthenelse{\equal{#1}{8}}{Aug}{}%
\ifthenelse{\equal{#1}{9}}{Sep}{}%
\ifthenelse{\equal{#1}{10}}{Oct}{}%
\ifthenelse{\equal{#1}{11}}{Nov}{}%
\ifthenelse{\equal{#1}{12}}{Dec}{}%
}
% check the date to make sure the day is not above the allowed range e.g, there are only 31 days in Jan, not more
% to be used as \checkdate{daycount}{monthcount}
\newcommand{\checkdate}[2]{%
\ifthenelse{#2=2}
{%
% February only has 28 days (or 29 in a leap year like 2012)
\ifthenelse{#1>29}
{%
\addtocounter{daycount}{-29}%
\addtocounter{monthcount}{1}%
}%
{}%
}%
{}%
\ifthenelse{#2=4 \or #2=6 \or #2=9 \or #2=11}
{%
% 30 day months, April, May, September, November
\ifthenelse{#1>30}
{%
\addtocounter{daycount}{-30}%
\addtocounter{monthcount}{1}%
}%
{}%
}%
{}%
\ifthenelse{#2=1 \or #2=3 \or #2=5 \or #2=7 \or #2=8 \or #2=10 \or #2=12}
{%
% 31 day months
\ifthenelse{#1>31}
{%
\ifthenelse{#2=12}
{%
% if we're in December and the count is above 31, we need to set the month back to Jan
\addtocounter{monthcount}{-12}
}%
{}%
\addtocounter{daycount}{-31}%
\addtocounter{monthcount}{1}%
}
{}
}%
{}%
}
% worthy quotes
\newcommand{\worthyQuote}[1]{%
\ifthenelse{\equal{#1}{1}}{All we are\ldots}{}%
\ifthenelse{\equal{#1}{2}}{\dots is dust in the wind dude \ldots}{}%
\ifthenelse{\equal{#1}{3}}{dust}{}%
\ifthenelse{\equal{#1}{4}}{wind}{}%
\ifthenelse{\equal{#1}{5}}{dude!}{}%
\ifthenelse{\equal{#1}{6}}{Quote 6}{}%
\ifthenelse{\equal{#1}{7}}{Quote 7}{}%
\ifthenelse{\equal{#1}{8}}{Quote 8}{}%
\ifthenelse{\equal{#1}{9}}{Quote 9}{}%
\ifthenelse{\equal{#1}{10}}{Quote 10}{}%
\ifthenelse{\equal{#1}{11}}{Quote 11}{}%
\ifthenelse{\equal{#1}{12}}{Quote 12}{}%
\ifthenelse{\equal{#1}{13}}{Quote 13}{}%
\ifthenelse{\equal{#1}{14}}{Quote 14}{}%
\ifthenelse{\equal{#1}{15}}{Quote 15}{}%
\ifthenelse{\equal{#1}{16}}{Quote 16}{}%
\ifthenelse{\equal{#1}{17}}{Quote 17}{}%
\ifthenelse{\equal{#1}{18}}{Quote 18}{}%
\ifthenelse{\equal{#1}{19}}{Quote 19}{}%
\ifthenelse{\equal{#1}{20}}{Quote 20}{}%
\ifthenelse{\equal{#1}{21}}{Quote 21}{}%
\ifthenelse{\equal{#1}{22}}{Quote 22}{}% finish these yourself!
}
\begin{document}
\pagestyle{empty}
\forloop{masterDayCount}{1}{\value{masterDayCount} < 367}
{%
% new page for a new day
\clearpage%
% up the day counters
\addtocounter{daycount}{1}%
\addtocounter{dispdaycount}{1}%
% check that the displayed day counter doesn't go above 7
\ifthenelse{\thedispdaycount>7}{\setcounter{dispdaycount}{1}}{}%
% check the daycount for the relevant month
\checkdate{\thedaycount}{\themonthcount}%
% change this to suit your own style
\begin{flushright}
{\huge\displayday{\thedispdaycount} \nth{\thedaycount} \displaymonth{\themonthcount} \theyearcount}\\
{\textit{\worthyQuote{\themasterDayCount}}}
\end{flushright}
}
\end{document}
Attempt to include week counter
\newcounter{weekcount}
\setcounter{weekcount}{1}
\forloop{masterDayCount}{1}{\value{masterDayCount} < 367}
{%
% new page for a new day
\clearpage%
% up the day counters
\addtocounter{daycount}{1}%
\addtocounter{dispdaycount}{1}%
% Here is where I tried to update the week counter
\ifthenelse{\equal{\displayday{\thedispdaycount}}}{\string Mon} {% if True
\addtocounter{weekcount}{1}}
% check that the displayed day counter doesn't go above 7
\ifthenelse{\thedispdaycount>7}{\setcounter{dispdaycount}{1}}{}%
% check the daycount for the relevant month
\checkdate{\thedaycount}{\themonthcount}%
% change this to suit your own style
\begin{flushright}
{\LARGE \displayday{\thedispdaycount} {\thedaycount} \displaymonth{\themonthcount} \theyearcount}\\
{\textit{Semana {\theweekcount}}}\\
{\textit{\worthyQuote{\themasterDayCount}}}
\end{flushright}
}
Original post: How to create Page-a-Day Calendar Template
calendar
. Are you aware of that?/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
is full of useful routines, and hasw = week day of current date
in it.\pgfcalendarjuliantodate
, see p. 992 of pgfmanual v3.1.4. It allows you to find out the calendar week of a date.