答案1
日历的一个好的起点是latex-年度计划GitHub 上的 repo。它有每周视图,其中有三列表示天数。至于习惯追踪器,请查看100 天挑战模板GitHub 上的 repo。
这两个 repos 应该能给你足够的灵感和代码,让你知道如何开始。如果你继续你的项目,请分享一个更新,因为它看起来非常有趣。
答案2
geometry
以及正确页面设置的类别选项babel
以及translator
本地化名称tikz
对于...TikZext.calendar-plus
为了周数
第一页是空的,然后每个偶数(左)页都只是网格,而每个奇数(右)页都是带有非常专业的节点和钩子的日历。
网格设置为 5mm,而日期列宽为 1cm。这些节点的高度需要根据此进行设置,以便列内的网格与日期右侧以及对面页面的网格对齐。
您需要自己计算出第一周的星期一以及周数。(是的,我们可以计算这个,但您只需要在下一个日历中每年计算一次,所以何必呢?)
代码
\documentclass[a5paper, twoside, ngerman]{article}
\usepackage[margin=5mm]{geometry}
\usepackage{babel, translator}
\usepackage{tikz}
\usetikzlibrary{ext.calendar-plus}
\newcommand*\STARTDATE{2023-01-02}% ← Woohoo! Set first Monday of calendar here.
\setlength{\parindent}{0pt}% no \noindent
\tikzset{
every picture/.append style={
trim left=+0pt, trim right=+\textwidth, baseline=+.3\baselineskip},
every grid/.append style={
line cap=round, dash pattern=on +0pt off +\pgfkeysvalueof{/tikz/grid size},
xstep=+\pgfkeysvalueof{/tikz/grid size}, ystep=+0mm},
every line/.append style={gray},
every diag line/.style={gray, very thin, shorten >=+2mm, shorten <=+2mm},
day width/.initial=1cm,
grid size/.initial=5mm,
execute at begin day scope={
\tikzset{shift=(@.north east)}
\draw[every line] (0,0) --++(down:\textheight);},
execute after day scope={%
\coordinate (@) at ([xshift=\pgfkeysvalueof{/tikz/day width}]@);
\ifdate{Sunday}{
\node[every week];
\draw[every line] (@d.north east) --++(down:\textheight);
\draw[every grid] (@d.north east) grid (O-|@w); }{}},
every day/.style={
outer sep=+0pt, minimum height=+6mm, % hard-coded
text width=
\pgfkeysvalueof{/tikz/day width}-2*(\pgfkeysvalueof{/pgf/inner xsep}},
every day (day)/.style={
every day, align=left,
at=(@), anchor=north west,
name=@d, node contents={\%d=}},
every day (month)/.style={
every day, align=right,
at=(@d.south west), anchor=north west, yshift=+2mm, % hard-coded
name=@m, node contents={\%m=}},
every weekday/.style={
at=(@m.south west), anchor=north west,
minimum width=\pgfkeysvalueof{/tikz/day width},
minimum height=\pgfkeysvalueof{/tikz/grid size},
text depth=+0pt, name=@wd, node contents={\%w.}},
every week/.style={
at={(\textwidth,\textheight)}, anchor=north east,
name=@w, node contents={\%n=}},
day code={
\node[every day (day)];
\node[every day (month)];
\node[every weekday];
\draw[every diag line] (@m.south west) -- (@d.north east);
\draw[every grid] (@wd|-0,-4*\pgfkeysvalueof{/tikz/grid size})
-- (O-|@wd);},
/pgf/calendar/German holidays/.style={
equals/.list={01-01, 05-01, 10-03, 12-25, 12-26},
Easter/.list={-2, 1, 39, 50}}, % Karfr, Ostermo, Chr. Himfrt, Pfingstmo
/pgf/calendar/German maybe holidays/.style={
equals/.list={01-06, 03-08, 08-15, 10-31, 11-01, 11-23},
Easter/.list={0, 49, 60}}, % Oster-/Pfingstso, Fronleichnam
}
\begin{document}
\thispagestyle{empty}
\null % cover empty
\foreach \WEEK in {0, ..., 52}{%
\clearpage
\tikz\draw[every grid] (0,0) grid (\textwidth, \textheight);%
\clearpage
\begin{tikzpicture}
\coordinate (O) at (0,0);
\coordinate (@) at (0,\textheight) (@);
\calendar[
dates/.expanded=\STARTDATE+\pgfinteval{\WEEK*7}
to \STARTDATE+\pgfinteval{\WEEK*7+6},
] if (German holidays) [red]
if (German maybe holidays) [red!75!black];
\end{tikzpicture}%
}
\end{document}