summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-calendar.tex
blob: 88a3567c1a41b037e87caa99b96ec270c8ab3ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
% !TeX spellcheck = en_US
% !TeX root = tikz-ext-manual.tex
% Copyright 2022 by Qrrbrbirlbel
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%

\section{Calendar: Weeknumbers and more conditionals}
\begin{package}{calendar-ext}
  This package adds week numbers and more conditionals to the PGF package |pgfcalendar|.
  (Despite the code example above, this package is not set up to work with Con\TeX t.)
\end{package}

%This package extends the |pgfcalendar| package.

\begin{multicols}{2}

\subsection{Extensions}

The following tests are added.
\begin{itemize}
\itemcalendaroption{Jan} This test is passed by all dates that are in the month of January.
\itemcalendaroption{Feb} as above.
\itemcalendaroption{Mar} as above.
\itemcalendaroption{Apr} as above.
\itemcalendaroption{May} as above.
\itemcalendaroption{Jun} as above.
\itemcalendaroption{Jul} as above.
\itemcalendaroption{Aug} as above.
\itemcalendaroption{Sep} as above.
\itemcalendaroption{Oct} as above.
\itemcalendaroption{Nov} as above.
\itemcalendaroption{Dec} as above.
\itemcalendaroption{leap year}\opt{|=|\meta{year}}
    This test checks whether the given year is a leap year. If
    \meta{year} is omitted, it checks the year of the current date.
\itemcalendaroption{and}|=|\marg{tests}
    This test passes when all \meta{tests} pass.
\itemcalendaroption{not}|=|\marg{tests}
    This test passes when \meta{tests} do not pass.
\itemcalendaroption{yesterday}|=|\marg{tests}
    This test passes when the previous day passes \meta{tests}.
\itemcalendaroption{week}|=|\meta{num}
    This test passes when the current week of the year equals \marg{num}.
\end{itemize}

The shorthands for |d-| and |m-| are slightly changed so that they are
expandable. This makes it possible to use these shorthands inside of PGFmath.
The shorthands for the week (see section~\ref{calendar:weeknumbering})
are added. These are
\begin{itemize}
\item |n-| (shortest numerical representation),
\item |n=| (shortest but added horizontal space) and
\item |n0| (leading zero when below 10).
\end{itemize}

\subsection{Week numbering (ISO~8601)}
\label{calendar:weeknumbering}
\begin{command}{\pgfcalendarjulianyeartoweek\marg{Julian day}\marg{year}\marg{week counter}}
  This command calculates the week for the \meta{Julian day} of \meta{year}.
  The \meta{week counter} must be a \TeX\space counter.

  The calculation follows the rule of ISO~8601 where the first week has that
  year's first Thursday in it.
\end{command}

Inside of |\pgfcalendar|\indexCommandO\pgfcalendar the command |\pgfcalendarcurrentweek| will be available.
\begin{command}{\pgfcalendarcurrentweek}
  This command returns the current week number (always two digits -- use shorthand |n.|
  to strip the leading zero).
\end{command}

Inside of |\ifdate|\indexCommandO\ifdate the command |\pgfcalendarifdateweek| will be available.
\begin{command}{\pgfcalendarifdateweek}
  This command returns the week number (always two digits).
\end{command}
\end{multicols}