| 1 |
% Copyright 2019 by Till Tantau |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
|
| 11 |
\section{Paper-Folding Diagrams Library} |
| 12 |
\label{section-calender-folding} |
| 13 |
|
| 14 |
\begin{tikzlibrary}{folding} |
| 15 |
This library defines pic types for creating paper-folding diagrams. Many |
| 16 |
thanks to Nico van Cleemput for providing most of the code. |
| 17 |
\end{tikzlibrary} |
| 18 |
|
| 19 |
Here is a big example that produces a diagram for a calendar: |
| 20 |
% |
| 21 |
\begin{codeexample}[ |
| 22 |
leave comments, |
| 23 |
preamble={\usetikzlibrary{calendar,folding}}, |
| 24 |
] |
| 25 |
\sffamily\scriptsize |
| 26 |
\tikz \pic [ |
| 27 |
transform shape, |
| 28 |
every calendar/.style={ |
| 29 |
at={(-8ex,4ex)}, |
| 30 |
week list, |
| 31 |
month label above centered, |
| 32 |
month text=\bfseries\textcolor{red}{\%mt} \%y0, |
| 33 |
if={(Sunday) [black!50]} |
| 34 |
}, |
| 35 |
folding line length=2.5cm, |
| 36 |
face 1={ \calendar [dates=\the\year-01-01 to \the\year-01-last];}, |
| 37 |
face 2={ \calendar [dates=\the\year-02-01 to \the\year-02-last];}, |
| 38 |
face 3={ \calendar [dates=\the\year-03-01 to \the\year-03-last];}, |
| 39 |
face 4={ \calendar [dates=\the\year-04-01 to \the\year-04-last];}, |
| 40 |
face 5={ \calendar [dates=\the\year-05-01 to \the\year-05-last];}, |
| 41 |
face 6={ \calendar [dates=\the\year-06-01 to \the\year-06-last];}, |
| 42 |
face 7={ \calendar [dates=\the\year-07-01 to \the\year-07-last];}, |
| 43 |
face 8={ \calendar [dates=\the\year-08-01 to \the\year-08-last];}, |
| 44 |
face 9={ \calendar [dates=\the\year-09-01 to \the\year-09-last];}, |
| 45 |
face 10={\calendar [dates=\the\year-10-01 to \the\year-10-last];}, |
| 46 |
face 11={\calendar [dates=\the\year-11-01 to \the\year-11-last];}, |
| 47 |
face 12={\calendar [dates=\the\year-12-01 to \the\year-12-last];} |
| 48 |
] {dodecahedron folding}; |
| 49 |
\end{codeexample} |
| 50 |
|
| 51 |
The foldings are sorted by number of faces. |
| 52 |
|
| 53 |
\begin{pictype}{tetrahedron folding}{} |
| 54 |
This pic type draws a folding diagram for a tetrahedron. The following keys |
| 55 |
influence the pic: |
| 56 |
% |
| 57 |
\begin{key}{/tikz/folding line length=\meta{dimension}} |
| 58 |
Sets the length of the base line for folding. For the dodecahedron this |
| 59 |
is the length of all the sides of the pentagons. |
| 60 |
\end{key} |
| 61 |
% |
| 62 |
\begin{key}{/tikz/face 1=\meta{code}} |
| 63 |
The \meta{code} is executed for the first face of the dodecahedron. |
| 64 |
When it is executed, the coordinate system will have been shifted and |
| 65 |
rotated such that it lies at the middle of the first face of the |
| 66 |
dodecahedron. |
| 67 |
\end{key} |
| 68 |
% |
| 69 |
\begin{key}{/tikz/face 2=\meta{code}} |
| 70 |
Same as |face 1|, but for the second face. |
| 71 |
\end{key} |
| 72 |
% |
| 73 |
\begin{key}{/tikz/face 3=\meta{code}} |
| 74 |
\end{key} |
| 75 |
% |
| 76 |
\begin{key}{/tikz/face 4=\meta{code}} |
| 77 |
\end{key} |
| 78 |
% |
| 79 |
There are further similar options for more faces (for commands shown |
| 80 |
later). |
| 81 |
|
| 82 |
Here is a simple example: |
| 83 |
% |
| 84 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 85 |
\tikz \pic [ |
| 86 |
transform shape, |
| 87 |
folding line length=6mm, |
| 88 |
face 1={ \node[red] {1};}, |
| 89 |
face 2={ \node {2};}, |
| 90 |
face 3={ \node {3};}, |
| 91 |
face 4={ \node {4};} |
| 92 |
] {tetrahedron folding}; |
| 93 |
\end{codeexample} |
| 94 |
|
| 95 |
The appearance of the cut and folding lines can be influenced using the |
| 96 |
following styles: |
| 97 |
% |
| 98 |
\begin{stylekey}{/tikz/every cut (initially \normalfont empty)} |
| 99 |
Executed for every line that should be cut using scissors. |
| 100 |
\end{stylekey} |
| 101 |
% |
| 102 |
\begin{stylekey}{/tikz/every fold (initially help lines)} |
| 103 |
Executed for every line that should be folded. |
| 104 |
% |
| 105 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 106 |
\tikz \pic[ |
| 107 |
every cut/.style=red, |
| 108 |
every fold/.style=dotted, |
| 109 |
folding line length=6mm |
| 110 |
] { tetrahedron folding }; |
| 111 |
\end{codeexample} |
| 112 |
\end{stylekey} |
| 113 |
|
| 114 |
There is one style that is mainly useful for the present documentation: |
| 115 |
% |
| 116 |
\begin{stylekey}{/tikz/numbered faces} |
| 117 |
Sets |face |\meta{i} to |\node {|\meta{i}|};| for all~$i$. |
| 118 |
\end{stylekey} |
| 119 |
\end{pictype} |
| 120 |
|
| 121 |
\begin{pictype}{tetrahedron truncated folding}{} |
| 122 |
A folding of a truncated tetrahedron. |
| 123 |
% |
| 124 |
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}] |
| 125 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 126 |
{ tetrahedron truncated folding }; |
| 127 |
\end{codeexample} |
| 128 |
% |
| 129 |
\end{pictype} |
| 130 |
|
| 131 |
\begin{pictype}{cube folding}{} |
| 132 |
A folding of a cube. |
| 133 |
% |
| 134 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 135 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 136 |
{ cube folding }; |
| 137 |
\end{codeexample} |
| 138 |
% |
| 139 |
\end{pictype} |
| 140 |
|
| 141 |
\begin{pictype}{cube truncated folding}{} |
| 142 |
A folding of a truncated cube. |
| 143 |
% |
| 144 |
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}] |
| 145 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 146 |
{ cube truncated folding }; |
| 147 |
\end{codeexample} |
| 148 |
% |
| 149 |
\end{pictype} |
| 150 |
|
| 151 |
\begin{pictype}{octahedron folding}{} |
| 152 |
A folding of an octahedron. |
| 153 |
% |
| 154 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 155 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 156 |
{ octahedron folding }; |
| 157 |
\end{codeexample} |
| 158 |
% |
| 159 |
\end{pictype} |
| 160 |
|
| 161 |
\begin{pictype}{octahedron folding}{} |
| 162 |
A folding of a truncated octahedron. |
| 163 |
% |
| 164 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 165 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 166 |
{ octahedron truncated folding }; |
| 167 |
\end{codeexample} |
| 168 |
% |
| 169 |
\end{pictype} |
| 170 |
|
| 171 |
\begin{pictype}{dodecahedron folding}{} |
| 172 |
A folding of a dodecahedron. |
| 173 |
% |
| 174 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 175 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 176 |
{ dodecahedron folding }; |
| 177 |
\end{codeexample} |
| 178 |
% |
| 179 |
\end{pictype} |
| 180 |
|
| 181 |
\begin{pictype}{dodecahedron' folding}{} |
| 182 |
This is an alternative folding of a dodecahedron. |
| 183 |
% |
| 184 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 185 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 186 |
{ dodecahedron' folding }; |
| 187 |
\end{codeexample} |
| 188 |
% |
| 189 |
\end{pictype} |
| 190 |
|
| 191 |
\begin{pictype}{dodecahedron rhombic folding}{} |
| 192 |
A rhombic dodecahedron, based on square-of-two rhombi. |
| 193 |
% |
| 194 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 195 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 196 |
{ dodecahedron rhombic folding }; |
| 197 |
\end{codeexample} |
| 198 |
% |
| 199 |
\end{pictype} |
| 200 |
|
| 201 |
\begin{pictype}{dodecahedron golden folding}{} |
| 202 |
An alternative rhombic dodecahedron, flat laying, based on golden rhombi. |
| 203 |
% |
| 204 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 205 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 206 |
{ dodecahedron golden folding }; |
| 207 |
\end{codeexample} |
| 208 |
% |
| 209 |
\end{pictype} |
| 210 |
|
| 211 |
\begin{pictype}{cuboctahedron folding}{} |
| 212 |
A folding of a cuboctahedron. |
| 213 |
% |
| 214 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 215 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 216 |
{ cuboctahedron folding }; |
| 217 |
\end{codeexample} |
| 218 |
% |
| 219 |
\end{pictype} |
| 220 |
|
| 221 |
\begin{pictype}{cuboctahedron truncated folding}{} |
| 222 |
A folding of a truncated cuboctahedron. |
| 223 |
% |
| 224 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 225 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 226 |
{ cuboctahedron truncated folding }; |
| 227 |
\end{codeexample} |
| 228 |
% |
| 229 |
\end{pictype} |
| 230 |
|
| 231 |
\begin{pictype}{icosahedron folding}{} |
| 232 |
A folding of an icosahedron. |
| 233 |
% |
| 234 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 235 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 236 |
{ icosahedron folding }; |
| 237 |
\end{codeexample} |
| 238 |
% |
| 239 |
\end{pictype} |
| 240 |
|
| 241 |
\begin{pictype}{rhombicuboctahedron folding}{} |
| 242 |
A folding of an rhombicuboctahedron. |
| 243 |
% |
| 244 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 245 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 246 |
{ rhombicuboctahedron folding }; |
| 247 |
\end{codeexample} |
| 248 |
% |
| 249 |
\end{pictype} |
| 250 |
|
| 251 |
\begin{pictype}{snub cube folding}{} |
| 252 |
A folding of a snub cube. |
| 253 |
% |
| 254 |
\begin{codeexample}[width=5cm,preamble={\usetikzlibrary{folding}}] |
| 255 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 256 |
{ snub cube folding }; |
| 257 |
\end{codeexample} |
| 258 |
% |
| 259 |
\end{pictype} |
| 260 |
|
| 261 |
\begin{pictype}{icosidodecahedron folding}{} |
| 262 |
A folding of an icosidodecahedron. |
| 263 |
% |
| 264 |
\begin{codeexample}[preamble={\usetikzlibrary{folding}}] |
| 265 |
\tikz \pic [folding line length=6mm, numbered faces, transform shape] |
| 266 |
{ icosidodecahedron folding }; |
| 267 |
\end{codeexample} |
| 268 |
% |
| 269 |
\end{pictype} |
| 270 |
|
| 271 |
|
| 272 |
%%% Local Variables: |
| 273 |
%%% mode: latex |
| 274 |
%%% TeX-master: "pgfmanual-pdftex-version" |
| 275 |
%%% End: |