2022-2023/tools/calendar/calendar.tex
Bertrand Benjamin fad94321d7
All checks were successful
continuous-integration/drone Build is passing
Feat: ajoute le calendrier de l'année
2022-08-18 14:46:17 +02:00

118 lines
4.1 KiB
TeX

\documentclass[tikz,border=5]{standalone}
\renewcommand\familydefault\sfdefault
\usetikzlibrary{positioning,calendar}
\colorlet{darkgreen}{green!50!black}
\colorlet{holiday}{green!50}
\colorlet{sunday}{black!50}
\newcommand{\calrow}[1]{\node[anchor=base east](Mon){L};
\node[base right=of Mon](Tue){M}; \node[base right=of Tue](Wed){M};
\node[base right=of Wed](Thu){J}; \node[base right=of Thu](Fri){V};
\node[base right=of Fri](Sat){S}; \node[base right=of Sat](Sun){D};
\node[darkgreen, above=of Thu]{\textbf{#1}};}
\newcommand{\calperiod}[2][\currentyear]{%
\calendar[dates=\currentyear-#2-01 to \currentyear-#2-last]
if (Sunday) [sunday]
\holidays;%
}
\newcommand{\calperiodN}[2][\nextyear]{%
\calendar[dates=\nextyear-#2-01 to \nextyear-#2-last]
if (Sunday) [sunday]
\holidays;%
}
\edef\currentyear{\the\year}
\newcommand\holidaystyle{[holiday] \draw[rounded corners=0,color=black!20, fill=black!20] (0, 0.35) rectangle (-0.55, -0.15);}
\newcommand{\holidays}{% holidays in Italy
if (between=10-22 and 11-06) \holidaystyle%
if (between=12-17 and 12-31) \holidaystyle%
if (between=01-01 and 01-02) \holidaystyle%
if (between=02-04 and 02-19) \holidaystyle%
if (between=04-08 and 04-23) \holidaystyle%
if (between=05-18 and 05-21) \holidaystyle%
if (between=07-08 and 08-31) \holidaystyle%
if (equals=11-01) \holidaystyle
if (equals=11-11) \holidaystyle
if (equals=04-10) \holidaystyle
if (equals=05-01) \holidaystyle
if (equals=05-08) \holidaystyle
if (equals=05-29) \holidaystyle
}
\begin{document}
\begin{tikzpicture}[every calendar/.style={
week list,
},
year label/.style={
fill=white,text=darkgreen,font=\bfseries\Large
},
current year/.store in=\currentyear,
current year=2022,
next year/.store in=\nextyear,
next year=2023,
]
\matrix[%
row 1/.style={darkgreen,node distance=.3ex},%
row 3/.style={darkgreen,node distance=.3ex},
row 5/.style={darkgreen,node distance=.3ex},
row 7/.style={darkgreen,node distance=.3ex},
column sep=1ex,%
draw=darkgreen,thick,rounded corners=5pt,%
append after command={
\pgfextra{\edef\matrixname{\tikzlastnode}}
node [year label/.try, right=1ex of \matrixname.south west] {\nextyear}
node [year label/.try, right=1ex of \matrixname.north west] {\currentyear}
}
]{%
% third row: week day and month
\calrow{Septembre} & \calrow{Octobre} & \calrow{Novembre} \\
\calperiod{09} & \calperiod{10} & \calperiod{11} \\[1ex]
% forth row: calendar
\calrow{Décembre} & \calrow{Janvier} & \calrow{Février} \\
\calperiod{12} & \calperiodN{01} & \calperiodN{02} \\[1ex]\\
};
\end{tikzpicture}
\begin{tikzpicture}[every calendar/.style={
week list,
},
year label/.style={
fill=white,text=darkgreen,font=\bfseries\Large
},
current year/.store in=\currentyear,
current year=2023,
]
\matrix[%
row 1/.style={darkgreen,node distance=.3ex},%
row 3/.style={darkgreen,node distance=.3ex},
row 5/.style={darkgreen,node distance=.3ex},
row 7/.style={darkgreen,node distance=.3ex},
column sep=1ex,%
draw=darkgreen,thick,rounded corners=5pt,%
append after command={
\pgfextra{\edef\matrixname{\tikzlastnode}}
node [year label/.try, right=1ex of \matrixname.south west] {\currentyear}
node [year label/.try, right=1ex of \matrixname.north west] {\currentyear}
}
]{%
% third row: week day and month
\calrow{Mars} & \calrow{Avril} & \calrow{Mai} \\
\calperiod{03} & \calperiod{04} & \calperiod{05} \\[1ex]
% forth row: calendar
\calrow{Juin} & \calrow{Juillet} & \calrow{Aout} \\
\calperiod{06} & \calperiod{07} & \calperiod{08} \\[1ex]\\
};
\end{tikzpicture}
\end{document}