\documentclass{article}
\usepackage[landscape, margin=1.75cm]{geometry}
\usepackage{tikz}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
%%
%% A LaTeX calendar (v1.2, with lengthy joke comment section stripped out)
%%
%% Zishen (Jason) Qu
%
% To change the font size, use the \documentclass{class} options,
% To change the first day of the week, look for the line:
%% write 5 for monday indexing and 6 for sunday
%\advance \count0 by 6
% and use arithemetic to determine the correct positive integer to use.
% To change other things, figure it out yourself.
%
% "I think we can agree: The past is over." - George W. Bush
%
%% set the variables here
% year
\newcommand*{\ynum}{2021}
% month
\newcommand*{\mnum}{12}
%% zeller's congruence taking year, month, day in integers
%% computes the day of the week, 0 being saturday
%% q + floor(13(m+1)/5) + K + floor(K/4) + floor(J/4) + 5J mod 7
%% q is the day of the month, m is the month (march = 3 to feb = 14)
%% K = year mod 100, J = floor(year/100)
\newcommand*{\zeller}[3]{
% year
\count1 = #1
% month
\count2 = #2
% q (day)
\count0 = #3
% computing floor(13(m+1)/5)
% coverting month to 3 to 14
\ifnum \count2 < 3 \advance \count2 by 12 \advance \count1 by -1 \fi %
\advance \count2 by 1
\multiply \count2 by 13
\divide \count2 by 5
% add to final (q+floor(13(m+1)/5))
\advance \count0 by \count2
% make a copy for K J
\count3 = \count1
\count4 = \count1
% compute J
\divide \count3 by 100
% add 5J
\count5 = \count3
\multiply \count5 by 5
\advance \count0 by \count5
% add J/4
\divide \count3 by 4
\advance \count0 by \count3
% compute K
\divide \count4 by 100
\multiply \count4 by -100
\advance \count4 by \count1
% K is now \count4
% add K
\advance \count0 by \count4
% compute floor K/4
\divide \count4 by 4
\advance \count0 by \count4
% write 5 for monday indexing and 6 for sunday
\advance \count0 by 6
% compute modulo 7
\count1 = \count0
\divide \count1 by 7
\multiply \count1 by -7
\advance \count0 by \count1
\count255 = \count0
}
% a word for the month
\newcommand*{\mword}[1]{
\count0 = #1
\ifnum \count0 = 1 January \fi
\ifnum \count0 = 2 Febuary \fi
\ifnum \count0 = 3 March \fi
\ifnum \count0 = 4 April \fi
\ifnum \count0 = 5 May \fi
\ifnum \count0 = 6 June \fi
\ifnum \count0 = 7 July \fi
\ifnum \count0 = 8 August \fi
\ifnum \count0 = 9 September \fi
\ifnum \count0 = 10 October \fi
\ifnum \count0 = 11 November \fi
\ifnum \count0 = 12 December \fi
}
% in the standard grid setting
\newcommand*{\vinc}{34}
\newcommand*{\hinc}{34}
% days in a month
\newcommand*{\dmonth}{
\ifnum \mnum > 7
\count0 = \mnum
\divide \count0 by 2
\multiply \count0 by 2
% \message{count0 is \the\count0}
% \message{mnum is \mnum}
\ifnum \count0 = \mnum
\count252 = 31
\else
\count252 = 30
\fi
\else
\ifnum \mnum = 2
\count0 = \ynum
\divide \count0 by 400
\multiply \count0 by 400
\ifnum \count0 = \ynum
\count252 = 29
\else
\count0 = \ynum
\divide \count0 by 100
\multiply \count0 by 100
\ifnum \count0 = \ynum
\count252 = 28
\else
\count0 = \ynum
\divide \count0 by 4
\multiply \count0 by 4
\ifnum \count0 = \ynum
\count252 = 29
\else
\count252=28
\fi
\fi
\fi
\else
\count0 = \mnum
\divide \count0 by 2
\multiply \count0 by 2
% debug
% \message{count0 is \the\count0}
% \message{mnum is \mnum}
\ifnum \count0 = \mnum
\count252 = 30
\else
\count252 = 31
\fi
\fi
\fi
}
\newcommand*{\vnum}[1]{
\count0 = #1
\zeller{\ynum}{\mnum}{\count0}
\count1 = \count255
\multiply \count1 by \vinc
\advance \count1 by 4 % starting sep
\count254 = \count1
}
\newcommand*{\hnum}[1]{
\count200 = #1
\zeller{\ynum}{\mnum}{1}
\count0 = \count200
\message{count255 is \the\count255}
\advance \count0 by \count255
\advance \count0 by -1
\divide \count0 by 7
\multiply \count0 by \hinc
\ifnum \count0>4 \count0=0 \fi
\multiply \count0 by -1
\advance \count0 by 166 % starting sep
\count253 = \count0
}
\def\sdown{0.1}
% end of std grid
\begin{document}
\begin{center}
\ynum{} \mword{\mnum}
\begin{tikzpicture}[scale=0.1]
\draw[ystep=34, xstep=34,black,thin] (0,0) grid (238, 170);
\newcount\dcount
\newcount\dmonthpone
\dmonth{}
\dmonthpone = \count252
\advance \dmonthpone by 1
\dcount = 1
\loop
\ifnum \dcount < \dmonthpone
\vnum{\dcount}
\hnum{\dcount}
\node at (\the\count254, \the\count253) {\the\dcount};
\advance \dcount by 1
\repeat
\end{tikzpicture}
\end{center}
\end{document}