| 1 |
% !TeX spellcheck = en_US |
| 2 |
% !TeX root = tikz-ext-manual.tex |
| 3 |
% Copyright 2022 by Qrrbrbirlbel |
| 4 |
% |
| 5 |
% This file may be distributed and/or modified |
| 6 |
% |
| 7 |
% 1. under the LaTeX Project Public License and/or |
| 8 |
% 2. under the GNU Free Documentation License. |
| 9 |
% |
| 10 |
|
| 11 |
\section{Calendar} |
| 12 |
\begin{tikzlibrary}{ext.calendar-plus} |
| 13 |
This library extends the \tikzname\space library \referenceLibraryandIndexO{calendar}. |
| 14 |
\inspiration{WeekNum-Q,CalCond-Q,CalMath-Q}{WeekNum-A,CalCond-A,CalMath-A} |
| 15 |
\end{tikzlibrary} |
| 16 |
|
| 17 |
\begin{multicols}{2} |
| 18 |
|
| 19 |
\subsection{Value-keys and nestable \texttt{if} key} |
| 20 |
\begin{keylist}[/tikz]{% |
| 21 |
day xshift (initially 3ex), |
| 22 |
day yshift (initially 3.5ex), |
| 23 |
month xshift (initially 9ex), |
| 24 |
month yshift (initially 9ex)} |
| 25 |
The values of these keys are originally stored in some macros that are not |
| 26 |
accessible by the user. These are now simple value-keys. |
| 27 |
The |@|-protected macros are still available, of course. |
| 28 |
\end{keylist} |
| 29 |
|
| 30 |
\begin{key}{/tikz/if=|(|\meta{conditions}|)|\meta{code or options}\opt{|else|\meta{else code or options}}} |
| 31 |
It is now also possible to nest |/tikz/if| occurrences. |
| 32 |
\end{key} |
| 33 |
|
| 34 |
\subsection{\pgfname math functions} |
| 35 |
\begin{math-function}{ext\textunderscore weeksinmonthofyear(\mvar{first weekday}, \mvar{month}, \mvar{year})} |
| 36 |
\mathcommand[extweeksinmonthofyear(\mvar{first weekday}, \mvar{month}, \mvar{year})] |
| 37 |
Returns the number of (partial) weeks in the month \mvar{month} of year \mvar{year} |
| 38 |
when this month begins on a \mvar{first weekday}. |
| 39 |
\end{math-function} |
| 40 |
\begin{math-function}{ext\textunderscore lastdayinmonthofyear(\mvar{month}, \mvar{year})} |
| 41 |
\mathcommand[extlastdayinmonthofyear(\mvar{month}, \mvar{year})] |
| 42 |
Returns the last day (28, 29, 30 or 31) of month \mvar{month} of year \mvar{year}. |
| 43 |
\end{math-function} |
| 44 |
|
| 45 |
\subsection{Week numbering (ISO~8601)} |
| 46 |
|
| 47 |
The actual week number algorithm is implemented by the |pgfcalendar-ext| package/module in section~\ref{calendar:weeknumbering}. |
| 48 |
\begin{key}{/\tikzext/week code=\meta{code}}\keycompat{tikz} |
| 49 |
Works like |/tikz/day code| or |/tikz/month code|, only for weeks.\indexKeyO{day code}\indexKeyO{month code} |
| 50 |
\end{key} |
| 51 |
|
| 52 |
\begin{key}{/\tikzext/week text=\meta{text}}\keycompat{tikz} |
| 53 |
Works like |/tikz/day text| or |/tikz/month text|, only for weeks.\indexKeyO{day text}\indexKeyO{month text} |
| 54 |
\end{key} |
| 55 |
|
| 56 |
\begin{stylekey}{/\tikzext/every week}\keycompat{tikz} |
| 57 |
Works like |/tikz/every day| or |/tikz/every month|, only for weeks.\indexKeyO{every day}\indexKeyO{every month} |
| 58 |
\end{stylekey} |
| 59 |
|
| 60 |
\begin{stylekey}{/\tikzext/week label left}\keycompat{tikz} |
| 61 |
Places the week label to the left of the first day of the month. (For |
| 62 |
|week list| and |month list| where a week does not start on a Monday, the |
| 63 |
position is chosen ``as if'' the week had started on a Monday -- which is |
| 64 |
usually exactly what you want.) |
| 65 |
% |
| 66 |
\begin{codeexample}[preamble={\usetikzlibrary{ext.calendar-plus}}] |
| 67 |
\tikz |
| 68 |
\calendar[ |
| 69 |
week list, month label above centered, |
| 70 |
dates=2022-07-01 to 2022-07-31, |
| 71 |
ext/week label left, |
| 72 |
ext/every week/.append style={ |
| 73 |
gray!50!black, font=\sffamily}]; |
| 74 |
\end{codeexample} |
| 75 |
% |
| 76 |
\end{stylekey} |
| 77 |
|
| 78 |
\end{multicols} |
| 79 |
\endinput |