diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex | 202 |
1 files changed, 115 insertions, 87 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex index fda9a875d75..679a22a0332 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-calendar.tex @@ -10,7 +10,7 @@ \section{Calendar Library} -\label{section-calender-snakes} +\label{section-calender} \begin{tikzlibrary}{calendar} The library defines the |\calendar| command, which can be used to @@ -62,17 +62,17 @@ environments (similar to, say, the |\draw| command). \end{itemize} At the beginning of every calendar, the following style is used: - \begin{itemize} - \itemstyle{every calendar} This style is empty be default. - \end{itemize} + \begin{stylekey}{/tikz/every calendar (initially \normalfont empty)} + This style is used with every calendar. + \end{stylekey} \medskip \textbf{The date range.} The overall effect of the |\calendar| command is to execute code for each day of a range of dates. This range of dates is set using the following option: - \begin{itemize} - \itemoption{dates}|=|\meta{start date}| to |\meta{end date} This + \begin{key}{/tikz/dates=\meta{start date}| to |\meta{end date}} + This option specifies the date range. Both the start and end date are specified as described on page~\pageref{calendar-date-format}. In short: You can provide ISO-format type dates like |2006-01-02|, you @@ -80,7 +80,7 @@ environments (similar to, say, the |\draw| command). month (so |2006-02-last| is the same as |2006-02-28|), and you can add a plus sign followed by a number to specify an offset (so |2006-01-01+-1| is the same as |2005-12-31|). - \end{itemize} + \end{key} It will be useful to fix two pieces of terminology for the following descriptions: The |\calendar| command iterates over the dates in the range. The \emph{current date} refers to the current date the @@ -109,23 +109,28 @@ environments (similar to, say, the |\draw| command). In the above calendar, the spacing between the days is determined by the numerous options. Most arrangement do not use all of these options, but only those that apply naturally. - \begin{itemize} - \itemoption{day xshift}|=|\meta{dimension} specifies the + \begin{key}{/tikz/day xshift=\meta{dimension} (initially 3.5ex)} + Specifies the horizontal shift between days. This is not the gap between days, - but the shift between the anchors of their nodes. The default is - |3.5ex|. + but the shift between the anchors of their nodes. \begin{codeexample}[] \tikz \calendar[dates=2000-01-01 to 2000-01-31,week list,day xshift=3ex]; \end{codeexample} - \itemoption{day yshift}|=|\meta{dimension} specifies the + \end{key} + \begin{key}{/tikz/day yshift=\meta{dimension} (initially 3ex)} + Specifies the vertical shift between days. Again, this is the shift between the - anchors of their nodes. The default is |3ex|. + anchors of their nodes. \begin{codeexample}[] \tikz \calendar[dates=2000-01-01 to 2000-01-31,week list,day yshift=2ex]; \end{codeexample} - \itemoption{month xshift}|=|\meta{dimension} specifies an - additional horizontal shift between different months. - \itemoption{month yshift}|=|\meta{dimension} specifies an + \end{key} + \begin{key}{/tikz/month xshift=\meta{dimension}} + Specifies an additional horizontal shift between different + months. + \end{key} + \begin{key}{/tikz/month yshift=\meta{dimension}} + Specifies an additional vertical shift between different months. \begin{codeexample}[] \tikz \calendar[dates=2000-01-01 to 2000-02-last,week list, @@ -135,7 +140,7 @@ environments (similar to, say, the |\draw| command). \tikz \calendar[dates=2000-01-01 to 2000-02-last,week list, month yshift=1cm]; \end{codeexample} - \end{itemize} + \end{key} \medskip \textbf{Changing the position of the calendar.} @@ -176,8 +181,7 @@ environments (similar to, say, the |\draw| command). the coordinate system will have been setup appropriately to place the day of the month correctly. You can change both the code and its appearance using the following options. - \begin{itemize} - \itemoption{day code}|=|\meta{code} + \begin{key}{/tikz/day code=\meta{code} (initially \normalfont see below)} This option allows you to change the code that is executed for each day. The default is to create a node with an appropriate name, but you can change this: @@ -207,8 +211,9 @@ environments (similar to, say, the |\draw| command). \draw[red] (mycal-2000-01-20) circle (4pt); \end{tikzpicture} \end{codeexample} + \end{key} - \itemoption{day text}|=|\meta{text} + \begin{key}{/tikz/day text=\meta{text}} This option changes the setting of the |\tikzdaytext|. By default, this macro simply yields the current day of month, but you can change it arbitrarily. Here is a silly example: @@ -239,19 +244,18 @@ environments (similar to, say, the |\draw| command). \tikz \calendar[dates=2000-01-01 to 2000-01-31,week list, day text=\%d0]; \end{codeexample} - \itemstyle{every day} - This style is executed by the default node code for each day. The - default setting is -\begin{codeexample}[code only] -anchor=base east -\end{codeexample} + \end{key} + + \begin{stylekey}{/tikz/every day (initially anchor=base east)} + This style is executed by the default node code for each day. The |every day| style is useful for changing the way days look. For example, let us make all days red: \begin{codeexample}[leave comments] -\tikzstyle{every day}+=[red] -\tikz \calendar[dates=2000-01-01 to 2000-01-31,week list]; +\tikz[every day/.style=red] + \calendar[dates=2000-01-01 to 2000-01-31,week list]; \end{codeexample} - \end{itemize} + \end{stylekey} + \medskip \textbf{Changing the appearance of month and year labels.} @@ -267,8 +271,7 @@ anchor=base east The following options change the appearance of the month and year label: - \begin{itemize} - \itemoption{month code}|=|\meta{code} + \begin{key}{/tikz/month code=\meta{code} (initially \normalfont see below)} This option allows you to specify what the macro |\tikzmonthcode| should expand to. @@ -277,7 +280,9 @@ anchor=base east \node[every month]{\tikzmonthtext}; \end{codeexample} Note that this node is not named by default. - \itemoption{month text}|=|\meta{text} + \end{key} + + \begin{key}{/tikz/month text=\meta{text}} This option allows you to change the macro |\tikzmonthtext|. By default, the month text is a long textual presentation of the current month being typeset. @@ -286,16 +291,25 @@ anchor=base east month label above centered, month text=\textcolor{red}{\%mt} \%y-]; \end{codeexample} - \itemstyle{every month} - This style, which is empty by default, can be used to change the + \end{key} + + \begin{stylekey}{/tikz/every month (initially \normalfont empty)} + This style can be used to change the appearance of month labels. - \itemoption{year code}|=|\meta{code} Works like |month code|, - only for years. - \itemoption{year text}|=|\meta{text} Works like |month text|, - only for years. - \itemstyle{every year} Works like |every month|, - only for years. - \end{itemize} + \end{stylekey} + + \begin{key}{/tikz/year code=\meta{code}} + Works like |month code|, only for years. + \end{key} + + \begin{key}{/tikz/year text=\meta{text}} + Works like |month text|, only for years. + \end{key} + + + \begin{key}{/tikz/every year} + Works like |every month|, only for years. + \end{key} \medskip \textbf{Date ifs.} @@ -307,14 +321,14 @@ anchor=base east code or options}. You can have multiple such conditionals (but you cannot nest them in this simple manner). The second way is to use the following option: - \begin{itemize} - \itemoption{if}|=(|\meta{coditions}|)|\meta{code or - options}\opt{|else|\meta{else code or options}} This option has + \begin{key}{/tikz/if=|(|\meta{coditions}|)|\meta{code or + options}\opt{|else|\meta{else code or options}}} + This option has the same effect as giving a corresponding if in the \meta{calendar specification}. The option is mostly useful for use in the |every calendar| style, where you cannot provide if conditionals otherwise. - \end{itemize} + \end{key} Now, regardless of how you specify a conditional, it has the following effect (individually and independently for each date in the calendar): @@ -370,8 +384,7 @@ anchor=base east label uses the |base east| anchor, which shifts the label up and right. To overcome this problem we can change the anchor: \begin{codeexample}[] -\tikzstyle{every day}=[anchor=mid] -\tikz +\tikz [every day/.style={anchor=mid}] \calendar [dates=2000-01-01 to 2000-01-31,week list] if (Sunday) [red] @@ -424,24 +437,27 @@ anchor=base east By cleverly adjusting the different codes, all sorts of different day arrangements are possible. - \begin{itemize} - \itemoption{execute before day scope}|=|\meta{code} This - code is executed before everything else for each date. Multiple + \begin{key}{/tikz/execute before day scope=\meta{code}} + The \meta{code} is executed before everything else for each + date. Multiple calls of this option have an accumulative effect. Thus, if you use this option twice, the code from the first use is used first for each day, followed by the code given the second time. - \itemoption{execute at begin day scope}|=|\meta{code} + \end{key} + \begin{key}{/tikz/execute at begin day scope=\meta{code}} This code is execute before everything else inside the scope of the current date. Again, the effect is accumulative. - \itemoption{execute at end day scope}|=|\meta{code} + \end{key} + \begin{key}{/tikz/execute at end day scope=\meta{code}} This code is executed just before the day scope is closed. The effect is also accumulative, however, in reverse order. This is useful to pair, say, |\scope| and |\endscope| commands in at-begin- and at-end-code. - \itemoption{execute after day scope}|=|\meta{code} This - is executed at the very end of the current date, outside the + \end{key} + \begin{key}{/tikz/execute after day scope=\meta{code}} + This is executed at the very end of the current date, outside the scope. The accumulation is also in reverse. - \end{itemize} + \end{key} \end{command} @@ -488,7 +504,7 @@ settings to not inadventerdly ``leak outside.'' execute after day scope={\pgftransformyshift{-1em}}, execute at begin day scope= {\ifdate{day of month=1}{\tikzmonthcode}{}}, - set style={{every month}+=[anchor=base east,xshift=-2em]}]; + every month/.append style={anchor=base east,xshift=-2em}]; \end{codeexample} In the above code we used the |\ifdate|\marg{condition}\marg{then @@ -573,8 +589,7 @@ arrangements. We start with arrangements in which the days are listed in a long line. -\begin{itemize} - \itemstyle{day list downward} +\begin{stylekey}{/tikz/day list downward} This style causes the days of a month to be typeset one below the other. The shift between days is given by |day yshift|. Between month an additional shift of |month yshift| is added. @@ -583,14 +598,18 @@ line. \calendar [dates=2000-01-28 to 2000-02-03, day list downward,month yshift=1em]; \end{codeexample} - \itemstyle{day list upward} +\end{stylekey} + +\begin{stylekey}{/tikz/day list upward} works as above, only the list grows upward instead of downward. \begin{codeexample}[] \tikz \calendar [dates=2000-01-28 to 2000-02-03, day list upward,month yshift=1em]; \end{codeexample} - \itemstyle{day list right} +\end{stylekey} + +\begin{stylekey}{/tikz/day list right} This style also works as before, but the list of days grows to the right. Instead of |day yshift| and |month yshift|, the values of |day xshift| and |month xshift| are used. @@ -599,14 +618,15 @@ line. \calendar [dates=2000-01-28 to 2000-02-03, day list right,month xshift=1em]; \end{codeexample} - \itemstyle{day list left} - as above, but the list grows left. -\end{itemize} +\end{stylekey} + +\begin{stylekey}{/tikz/day list left} + As above, but the list grows left. +\end{stylekey} The next arrangement lists days weekwise. -\begin{itemize} - \itemstyle{week list} +\begin{stylekey}{/tikz/week list} This style creates one row for each week in the range. The value of |day xshift| is used for the distance between days in each week row, the value of |day yshift| is used for the distance between @@ -633,11 +653,10 @@ The next arrangement lists days weekwise. \calendar [dates=2000-01-01 to 2000-02-last,week list, month yshift=0pt]; \end{codeexample} -\end{itemize} +\end{stylekey} The following arrangement gives a very compact view of a whole year. -\begin{itemize} - \itemstyle{month list} +\begin{stylekey}{/tikz/month list} In this arrangement there is a row for each month. As for the |week list|, the |day xshift| is used for the horizontal distance. For the vertical shft, |month yshift| is used. @@ -647,7 +666,6 @@ The following arrangement gives a very compact view of a whole year. on the same day of week. Thus, the very first column contains only Mondays. If a month does not start with a Monday, its days are shifted to the right such that the days lie on the correct columns. -\end{itemize} \begin{codeexample}[] \sffamily\scriptsize \tikz @@ -655,7 +673,7 @@ The following arrangement gives a very compact view of a whole year. month list,month label left,month yshift=1.25em] if (Sunday) [black!50]; \end{codeexample} - +\end{stylekey} \subsection{Month Labels} @@ -669,8 +687,7 @@ What we have not yet covered is where these labels are placed. By default, they are not placed at all as there is no good ``default position'' for them. Instead, you can use one of the following options to specify a position for the labels: -\begin{itemize} - \itemstyle{month label left} +\begin{stylekey}{/tikz/month label left} Places the month label to the left of the first day of the month. (For |week list| and |month list| where a month does not start on a Monday, the position is chosen ``as if'' the month had @@ -681,7 +698,8 @@ to specify a position for the labels: day list downward,month yshift=1em, month label left]; \end{codeexample} - \itemstyle{month label left vertical} +\end{stylekey} +\begin{stylekey}{/tikz/month label left vertical} This style works like the above style, only the label is rotated counterclockwise by 90 degrees. \begin{codeexample}[] @@ -690,7 +708,8 @@ to specify a position for the labels: day list downward,month yshift=1em, month label left vertical]; \end{codeexample} - \itemstyle{month label right} +\end{stylekey} +\begin{stylekey}{/tikz/month label right} This style places the month label to the right of the row in which the first day of the month lies. This means that for a day list the label is to the right of the first day, for a week list it is to the @@ -702,16 +721,18 @@ to specify a position for the labels: day list downward,month yshift=1em, month label right]; \end{codeexample} - \itemstyle{month label right vertical} - as above, only the label is rotated clockwise by 90 degrees. +\end{stylekey} +\begin{stylekey}{/tikz/month label right vertical} + Works as above, only the label is rotated clockwise by 90 degrees. \begin{codeexample}[] \tikz \calendar [dates=2000-01-28 to 2000-02-03, day list downward,month yshift=1em, month label right vertical]; \end{codeexample} +\end{stylekey} - \itemstyle{month label above left} +\begin{stylekey}{/tikz/month label above left} This style places the month label above of the row of the first day, flushed left to the leftmost column. The amount by which the label is raised is fixed to |1.25em|; use the |yshift| option with the @@ -727,8 +748,9 @@ to specify a position for the labels: \calendar [dates=2000-01-20 to 2000-02-10, week list,month label above left]; \end{codeexample} - - \itemstyle{month label above centered} +\end{stylekey} + +\begin{stylekey}{/tikz/month label above centered} works as above, only the label is centered above the row containing the first day. \begin{codeexample}[] @@ -741,16 +763,18 @@ to specify a position for the labels: \calendar [dates=2000-01-20 to 2000-02-10, week list,month label above centered]; \end{codeexample} - - \itemstyle{month label above right} +\end{stylekey} + +\begin{stylekey}{/tikz/month label above right} works as above, but flushed right \begin{codeexample}[] \tikz \calendar [dates=2000-01-20 to 2000-02-10, week list,month label above right]; \end{codeexample} +\end{stylekey} - \itemstyle{month label below left} +\begin{stylekey}{/tikz/month label below left} Works like |month label above left|, only the label is placed below the row. This placement is not really useful with the |week list| arrangement, but rather with the |day list right| or |month list| @@ -760,14 +784,17 @@ to specify a position for the labels: \calendar [dates=2000-02-01 to 2000-02-last, day list right,month label below left]; \end{codeexample} - \itemstyle{month label below centered} - works like |month label above centered|, only below. +\end{stylekey} + +\begin{stylekey}{/tikz/month label below centered} + Works like |month label above centered|, only below. \begin{codeexample}[] \tikz \calendar [dates=2000-02-01 to 2000-02-last, day list right,month label below centered]; \end{codeexample} -\end{itemize} +\end{stylekey} + \subsection{Examples} @@ -832,8 +859,9 @@ The following example is a futuristic calendar that is all about circles: % arbitrary angle systems. \newcount\mycount -\begin{tikzpicture}[transform shape] - \tikzstyle{every day}=[anchor=mid,font=\fontsize{6}{6}\selectfont] +\begin{tikzpicture} + [transform shape, + every day/.style={anchor=mid,font=\fontsize{6}{6}\selectfont}] \node{\normalsize\the\year}; \foreach \month/\monthcolor in {1/winter,2/winter,3/spring,4/spring,5/spring,6/summer, |