0

Thanks to the help of this community I've managed to create a digital planner template page.

\documentclass{article}
\usepackage[landscape, margin=0.5cm]{geometry}
\usepackage{tabularx}
\usepackage[table, svgnames]{xcolor}
\usepackage{advdate}
\usepackage[dayofweek]{datetime}
\usepackage{pgffor}
\newcommand{\grayline}{\arrayrulecolor{lightgray}\cline{1-5}\arrayrulecolor{white}}
\newcommand{\Hsquare}{%
  \text{\fboxsep=0pt\fbox{\rule{0pt}{2ex}\rule{2ex}{0pt}}}%
}
\newcount\dayscnt
\dayscnt=1

\pagecolor{black}
\color{white}
\setlength{\extrarowheight}{10pt}
\ThisYear{2021}
\ThisMonth{1} % Start in January
\ThisDay{1} % Set the day number to zero
\newcounter{mycntr}
\mycntr=1
\newcounter{rownumber}
\begin{document}
\loop
    \begin{minipage}[b]{0.475\linewidth}
    \setcounter{rownumber}{0}
    \def\fillfirsttable{}%
    {
        \loop\ifnum\therownumber<12
        \addtocounter{rownumber}{1}
        \expandafter\def\expandafter\fillfirsttable\expandafter{%
            \fillfirsttable
            & & & & \\
            \hline
            & & & & \\
            \grayline
        }%
        \repeat
    }
    \noindent
    \begin{tabularx}{\linewidth}{wc{0.5cm}|X|X|X|X|}
        \cline{1-5}
        \multicolumn{5} {r|} {Date: \AdvanceDate[\value{mycntr}]\today\stepcounter{mycntr}}\\
        \hline
        \fillfirsttable
    \end{tabularx}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.475\linewidth}
    \par\noindent\rule{\textwidth}{0.4pt}\\
    \par\noindent\rule{\textwidth}{0.4pt}\\
    \par\noindent\rule{\textwidth}{0.4pt}\\
    \par\noindent\rule{\textwidth}{0.4pt}\\
    \par\noindent\rule{\textwidth}{0.4pt}\\
    \par\noindent\rule{\textwidth}{0.4pt}\\
    Shutdown complete: 

    \setcounter{rownumber}{0}
    \def\fillsecondtable{}%
    {
        \loop\ifnum\therownumber<10
        \addtocounter{rownumber}{1}
        \expandafter\def\expandafter\fillsecondtable\expandafter{%
            \fillsecondtable
            & \\ \hline
        }%
        \repeat
    }
    \noindent
    \begin{tabularx}{\linewidth}{X|X}
    TASKS: & IDEAS:  \\ \hline
    \fillsecondtable
    \end{tabularx}
    \end{minipage}

\advance \dayscnt 1
\ifnum \dayscnt<10
\repeat

\end{document}

Now I would like to create a document where each such page would represent particular day with date and week number already filled.

I'm not sure whether latex has capabilities to calculate dates and weeks. Maybe I could pass them as argument somehow when building?

EDIT1: I think the only problem is nested loops...

2
  • 1
    Welcome to TeX.SE. Have you already looked at datetime2 and datetime2-calc packages? They provide a lot of commands for typestting and calculating dates. Commented Jun 20, 2021 at 11:17
  • @DrecksHippy I've googled \AdvanceDate and loops, but it messes my layout Commented Jun 20, 2021 at 11:21

1 Answer 1

0

I used pgffor for the loop and defined a new command that typesets your whole calendar page (mainly for readability) and then used the \foreach and your hint with \AdvanceDate to produce this.

\documentclass{article}
\usepackage[landscape, margin=0.5cm]{geometry}
\usepackage{tabularx}
\usepackage[table, svgnames]{xcolor}
\usepackage{amsmath}
\newcommand{\grayline}{\arrayrulecolor{lightgray}\cline{1-5}\arrayrulecolor{white}}
\newcommand{\Hsquare}{%
    \text{\fboxsep=0pt\fbox{\rule{0pt}{2ex}\rule{2ex}{0pt}}}%
}
\def\tabularxcolumn#1{m{#1}}

%% use pgffor package for the loop
\usepackage{pgffor}
\usepackage{advdate}

%% typeset a whole calendar page
\newcounter{rownumber}
\def\calendarpage#1{
    \begin{minipage}[b]{0.475\linewidth}
        \setcounter{rownumber}{0}
        \def\fillfirsttable{}%
        \loop\ifnum\therownumber<12
        \addtocounter{rownumber}{1}
        \expandafter\def\expandafter\fillfirsttable\expandafter{%
            \fillfirsttable
            & & & & \\
            \hline
            & & & & \\
            \grayline
        }%
        \repeat
        \noindent
        \begin{tabularx}{\linewidth}{wc{0.5cm}|X|X|X|X|}
            \cline{1-5}
            \multicolumn{5} {r|} {Date: \AdvanceDate[#1]\today}\\
            \hline
            \fillfirsttable
        \end{tabularx}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.475\linewidth}
        Reflections:
        \par\noindent\rule{\textwidth}{0.4pt}\\
        \par\noindent\rule{\textwidth}{0.4pt}\\
        \par\noindent\rule{\textwidth}{0.4pt}\\
        \par\noindent\rule{\textwidth}{0.4pt}\\
        \par\noindent\rule{\textwidth}{0.4pt}\\
        \par\noindent\rule{\textwidth}{0.4pt}\\
        Shutdown complete: \Hsquare 
        
        \setcounter{rownumber}{0}
        \def\fillsecondtable{}%
        \loop\ifnum\therownumber<10
        \addtocounter{rownumber}{1}
        \expandafter\def\expandafter\fillsecondtable\expandafter{%
            \fillsecondtable
            \Hsquare & \\ \hline
        }%
        \repeat
        \noindent
        \begin{tabularx}{\linewidth}{X|X}
            TASKS: & IDEAS:  \\ \hline
            \fillsecondtable
        \end{tabularx}
    \end{minipage}
}

\begin{document}
    
    \pagecolor{black}
    \color{white}
    \setlength{\extrarowheight}{10pt}

    \foreach \i in {1,...,31}{
        \calendarpage{\i}
    }
\end{document}
1
  • Thanks for the solution! Commented Jun 20, 2021 at 13:45

You must log in to answer this question.

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