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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
|
% Copyright 2019 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 pic types for creating paper-folding diagrams. Many
thanks to Nico van Cleemput for providing most of the code.
\end{tikzlibrary}
Here is a big example that produces a diagram for a calendar:
%
\begin{codeexample}[
leave comments,
preamble={\usetikzlibrary{calendar,folding}},
]
\sffamily\scriptsize
\tikz \pic [
transform shape,
every calendar/.style={
at={(-8ex,4ex)},
week list,
month label above centered,
month text=\bfseries\textcolor{red}{\%mt} \%y0,
if={(Sunday) [black!50]}
},
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];}
] {dodecahedron folding};
\end{codeexample}
The foldings are sorted by number of faces.
\begin{pictype}{tetrahedron folding}{}
This pic type draws a folding diagram for a tetrahedron. The following keys
influence the pic:
%
\begin{key}{/tikz/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.
\end{key}
%
\begin{key}{/tikz/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.
\end{key}
%
\begin{key}{/tikz/face 2=\meta{code}}
Same as |face 1|, but for the second face.
\end{key}
%
\begin{key}{/tikz/face 3=\meta{code}}
\end{key}
%
\begin{key}{/tikz/face 4=\meta{code}}
\end{key}
%
There are further similar options for more faces (for commands shown
later).
Here is a simple example:
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [
transform shape,
folding line length=6mm,
face 1={ \node[red] {1};},
face 2={ \node {2};},
face 3={ \node {3};},
face 4={ \node {4};}
] {tetrahedron folding};
\end{codeexample}
The appearance of the cut and folding lines can be influenced using the
following styles:
%
\begin{stylekey}{/tikz/every cut (initially \normalfont empty)}
Executed for every line that should be cut using scissors.
\end{stylekey}
%
\begin{stylekey}{/tikz/every fold (initially help lines)}
Executed for every line that should be folded.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic[
every cut/.style=red,
every fold/.style=dotted,
folding line length=6mm
] { tetrahedron folding };
\end{codeexample}
\end{stylekey}
There is one style that is mainly useful for the present documentation:
%
\begin{stylekey}{/tikz/numbered faces}
Sets |face |\meta{i} to |\node {|\meta{i}|};| for all~$i$.
\end{stylekey}
\end{pictype}
\begin{pictype}{tetrahedron truncated folding}{}
A folding of a truncated tetrahedron.
%
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ tetrahedron truncated folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{cube folding}{}
A folding of a cube.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ cube folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{cube truncated folding}{}
A folding of a truncated cube.
%
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ cube truncated folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{octahedron folding}{}
A folding of an octahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ octahedron folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{octahedron folding}{}
A folding of a truncated octahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ octahedron truncated folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{dodecahedron folding}{}
A folding of a dodecahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ dodecahedron folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{dodecahedron' folding}{}
This is an alternative folding of a dodecahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ dodecahedron' folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{dodecahedron rhombic folding}{}
A rhombic dodecahedron, based on square-of-two rhombi.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ dodecahedron rhombic folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{dodecahedron golden folding}{}
An alternative rhombic dodecahedron, flat laying, based on golden rhombi.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ dodecahedron golden folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{cuboctahedron folding}{}
A folding of a cuboctahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ cuboctahedron folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{cuboctahedron truncated folding}{}
A folding of a truncated cuboctahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ cuboctahedron truncated folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{icosahedron folding}{}
A folding of an icosahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ icosahedron folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{rhombicuboctahedron folding}{}
A folding of an rhombicuboctahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ rhombicuboctahedron folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{snub cube folding}{}
A folding of a snub cube.
%
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ snub cube folding };
\end{codeexample}
%
\end{pictype}
\begin{pictype}{icosidodecahedron folding}{}
A folding of an icosidodecahedron.
%
\begin{codeexample}[preamble={\usetikzlibrary{folding}}]
\tikz \pic [folding line length=6mm, numbered faces, transform shape]
{ icosidodecahedron folding };
\end{codeexample}
%
\end{pictype}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "pgfmanual-pdftex-version"
%%% End:
|