% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.


\section{Paper Folding Diagrams Library}

\label{section-calender-folding}

\begin{tikzlibrary}{folding}
  This library defines commands for creating paper folding
  diagrams. Currently, it just contains a single command for creating
  a single diagram, but that one is really useful for creating
  calendars for your (real) desktop.
\end{tikzlibrary}

\begin{command}{\tikzfoldingdodecahedron|[|\meta{options}|];|}
  This command draws a folding diagram for a dodecahedron. The syntax
  is intended to remind of the |\path| command, but (currently) you
  must specify the \meta{options} and nothing else may be specified
  between the command name and the closing semicolon.

  The following \meta{options} apply:
  \begin{itemize}
    \itemoption{folding line length}|=|\meta{dimension} sets the length
    of the base line for folding. For the dodecahedron this is the
    length of all the sides of the pentagons.
    \itemoption{face 1}|=|\meta{code}
    The \meta{code} is executed for the first face of the
    dodecahedron. When it is executed, the coordinate system will have
    been shifted and rotated such that it lies at the middle of the
    first face of the dodecahedron.
    \itemoption{face 2}|=|\meta{code}
    Same as |face 1|, but for the second face.
    \itemoption{face 3}|=|\meta{code}
    Same as |face 1|, but for the third face.
    
    There are further similar options, ending with the following:
    \itemoption{face 12}|=|\meta{code}
    Same as |face 1|, but for the last face.
  \end{itemize}

  Here is a simple example:
\begin{codeexample}[]
\begin{tikzpicture}[transform shape]
  \tikzfoldingdodecahedron
  [folding line length=6mm,
  face 1={ \node[red] {1};},
  face 2={ \node      {2};},
  face 3={ \node      {3};},
  face 4={ \node      {4};},
  face 5={ \node      {5};},
  face 6={ \node      {6};},
  face 7={ \node      {7};},
  face 8={ \node      {8};},
  face 9={ \node      {9};},
  face 10={\node      {10};},
  face 11={\node      {11};},
  face 12={\node      {12};}];
\end{tikzpicture}
\end{codeexample}

  The appearance of the cut and folding lines can be influenced using
  the following styles:
  \begin{itemize}
  \itemstyle{every cut} Executed for every line that should be cut using
  scissors. Empty by default.
  \itemstyle{every fold} Executed for every line that should be
  folded. Equal to |help lines| by default.
\begin{codeexample}[]
\begin{tikzpicture}
  \tikzstyle{every cut}=[red]
  \tikzstyle{every fold}=[dotted]
  \tikzfoldingdodecahedron[folding line length=6mm];
\end{tikzpicture}
\end{codeexample}
  \end{itemize}
\end{command}

Here is a big example that produces a diagram for a calendar:

\begin{codeexample}[leave comments]
\sffamily\scriptsize
\begin{tikzpicture}[transform shape]
  \tikzstyle{every calendar}=
  [
    at={(-8ex,4ex)},
    week list,
    month label above centered,
    month text=\bfseries\textcolor{red}{\%mt} \%y0,
    if={(Sunday) [black!50]}
  ]
  \tikzfoldingdodecahedron
  [
    folding line length=2.5cm,
    face 1={ \calendar [dates=\the\year-01-01 to \the\year-01-last];},
    face 2={ \calendar [dates=\the\year-02-01 to \the\year-02-last];},
    face 3={ \calendar [dates=\the\year-03-01 to \the\year-03-last];},
    face 4={ \calendar [dates=\the\year-04-01 to \the\year-04-last];},
    face 5={ \calendar [dates=\the\year-05-01 to \the\year-05-last];},
    face 6={ \calendar [dates=\the\year-06-01 to \the\year-06-last];},
    face 7={ \calendar [dates=\the\year-07-01 to \the\year-07-last];},
    face 8={ \calendar [dates=\the\year-08-01 to \the\year-08-last];},
    face 9={ \calendar [dates=\the\year-09-01 to \the\year-09-last];},
    face 10={\calendar [dates=\the\year-10-01 to \the\year-10-last];},
    face 11={\calendar [dates=\the\year-11-01 to \the\year-11-last];},
    face 12={\calendar [dates=\the\year-12-01 to \the\year-12-last];}
  ];
\end{tikzpicture}
\end{codeexample}




%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "pgfmanual-pdftex-version"
%%% End: 
