Debian Codegraph @

texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.raster.tex

raw
1 % !TeX root = tcolorbox.tex
2 % include file of tcolorbox.tex (manual of the LaTeX package tcolorbox)
3 \clearpage
4 \section{Library \mylib{raster}}\label{sec:raster}%
5 \tcbset{external/prefix=external/raster_}%
6 The library is loaded by a package option or inside the preamble by:
7 \begin{dispListing}
8 \tcbuselibrary{raster}
9 \end{dispListing}
10
11 \subsection{Concept of Rasters}\label{subsec:raster_overview}
12
13 A \emph{raster} is used to align several colored boxes in a regular way.
14 It can be seen as a far related counterpart to the |matrix| construct
15 of \tikzname, but it differs in many aspects.
16
17 In principle, |tcolorbox|es are arranged in rows and columns when put
18 inside a \refEnv{tcbraster} environment. The boxes are fluently added to the
19 raster like adding text to a paragraph.
20 Especially, line/row breaks are done
21 automatically and one cannot end a line/row ahead of schedule.
22 Further, a \emph{raster} is not restricted to a single page but may
23 break into an arbitrary series of pages.
24
25 \bigskip
26 \begin{tcolorbox}[enhanced,size=tight,boxrule=0pt,frame hidden,
27 top=5mm,bottom=5mm,colback=yellow!20!white,
28 borderline={0.4pt}{0pt}{dashed,yellow!50!black},
29 finish={
30 \draw[thick,<->] ([yshift=-1.3cm]frame.north west)-- node[below]{\refKey{/tcb/raster width}}
31 ([yshift=-1.3cm]frame.north east);
32 \draw[thick,<->] ([xshift=5mm,yshift=-5mm]frame.north east)-- node[left,pos=.75]{\refKey{/tcb/raster height}}
33 ([xshift=5mm,yshift=5mm]frame.south east);
34 }]
35 \begin{tcbitemize}[enhanced,fontupper=\tiny,
36 title={Box \#\thetcbrasternum},
37 colframe=red!50!black!30!white,colback=red!10!white!40!white,
38 colupper=black!20!white,
39 raster equal height=rows,
40 raster left skip=5mm,raster right skip=5mm,
41 raster before skip=5mm,raster after skip=5mm,
42 raster row skip=3mm,raster column skip=3mm,
43 ]
44 \tcbitem[finish={%
45 \draw[thick,<->] (frame.west)-- node[below right]{\refKey{/tcb/raster left skip}}+(-0.5,0);
46 \draw[thick,<->] (frame.north)-- node[right]{\refKey{/tcb/raster before skip}} +(0,0.5);
47 \draw[thick,<->] (frame.south)-- node[above]{\refKey{/tcb/raster row skip}} +(0,-0.3);
48 }] \lipsum[1]
49 \tcbitem[finish={
50 \draw[thick,<->] (frame.east)-- node[below left]{\refKey{/tcb/raster right skip}}+(0.5,0);
51 \draw[thick,<->] ([yshift=5mm]frame.south west)-- node[above]{\refKey{/tcb/raster column skip}}+(-0.3,0);
52 }] \lipsum[2]
53 \tcbitem[finish={%
54 \draw[thick,<->] (frame.south)-- node[right]{\refKey{/tcb/raster after skip}} +(0,-0.5);
55 }] \lipsum[3]
56 \tcbitem \lipsum[4]
57 \end{tcbitemize}
58 \end{tcolorbox}
59
60 \clearpage
61 \begin{tcboutputlisting}
62 \begin{tcbraster}[raster columns=3,raster rows=3,raster height=\linewidth,
63 enhanced,size=small,sharp corners,arc=8mm,colframe=red!50!black,
64 colback=yellow!10!white,watermark overzoom=1.0,fit algorithm=hybrid* ]
65 \begin{tcolorbox}[rounded corners=northwest,boxrule=0pt,
66 watermark graphics=lichtspiel.jpg]\end{tcolorbox}
67 \tcboxfit{\lipsum[1]}
68 \begin{tcolorbox}[rounded corners=northeast,boxrule=0pt,
69 watermark graphics=goldshade.png]\end{tcolorbox}
70 \tcboxfit{\lipsum[2]}
71 \begin{tcolorbox}[valign=center,halign=center]Nine Boxes.\end{tcolorbox}
72 \tcboxfit{\lipsum[3]}
73 \begin{tcolorbox}[rounded corners=southwest,boxrule=0pt,
74 watermark graphics=goldshade.png]\end{tcolorbox}
75 \tcboxfit{\lipsum[4]}
76 \begin{tcolorbox}[rounded corners=southeast,boxrule=0pt,
77 watermark graphics=lichtspiel.jpg]\end{tcolorbox}
78 \end{tcbraster}
79 \end{tcboutputlisting}
80
81 \tcbinputlisting{base example,listing only,listing style=mydocumentation}
82
83 \bigskip
84 {\tcbuselistingtext}
85
86 \clearpage
87 \subsection{Macros of the Library}\label{subsec:raster_macros}
88
89 \begin{docEnvironment}[doc new and updated={2014-11-10}{2017-02-01}]{tcbraster}{\oarg{options}}
90 A raster arranges enclosed boxes in a regular way, mainly into rows and
91 columns. The \meta{options} are used to control the raster
92 parameters and to set the properties for the enclosed boxes.
93 \begin{itemize}
94 \item The \emph{raster} is only allowed to contain a series of
95 \refEnv{tcolorbox} environments or derived constructs.
96 With some small restrictions, boxes created with \refCom{tcboxfit} can also be added.
97 Boxes created with \refCom{tcbox} are not reasonable here, but may be
98 used to a certain degree.
99 \item Do not add anything else between the boxes inside the raster with
100 exception of white\-space. Especially, do not use |\\| or |\par| to end
101 a row; row breaks are done automatically.
102 \item The boxes inside a raster are numbered automatically.
103 \docAuxCommand{thetcbrasternum} may be used inside a box to access
104 this number.
105 The \LaTeX\ counter \docCounter{tcbrastercolumn} holds the current column,
106 the counter \docCounter{tcbrasterrow} holds the current row,
107 and the counter \docCounter{tcbrasternum} holds the current box number.
108 \end{itemize}
109
110 \enlargethispage*{1cm}
111
112 \begin{dispExample}
113 \begin{tcbraster}[raster columns=3, raster equal height,
114 size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
115 title={Box \# \thetcbrasternum}]
116 \begin{tcolorbox}First box\end{tcolorbox}
117 \begin{tcolorbox}Second box\end{tcolorbox}
118 \begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
119 \begin{tcolorbox}Another box\end{tcolorbox}
120 \begin{tcolorbox}A box again\end{tcolorbox}
121 \end{tcbraster}
122 \end{dispExample}
123
124 \begin{dispExample}
125 \begin{tcbraster}[raster columns=2, raster equal height=rows,
126 size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
127 title={Box \# \thetcbrasternum}]
128 \begin{tcolorbox}First box\end{tcolorbox}
129 \begin{tcolorbox}Second box\end{tcolorbox}
130 \begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
131 \begin{tcolorbox}Another box\end{tcolorbox}
132 \begin{tcolorbox}A box again\end{tcolorbox}
133 \end{tcbraster}
134 \end{dispExample}
135 \end{docEnvironment}
136
137
138 \clearpage
139
140 \begin{docEnvironment}[doc new=2014-11-10]{tcbitemize}{\oarg{options}}
141 This is a special case of a \refEnv{tcbraster} with the given \meta{options}.
142 \begin{itemize}
143 \item Here, the enclosed boxes are created using \refCom{tcbitem}.
144 \item There has to be at least one \refCom{tcbitem}.
145 \item One cannot use anything else than \refCom{tcbitem} to add something
146 to the \emph{raster}.
147 \end{itemize}
148 This leads to a very compact syntax.
149
150 \begin{dispExample}
151 \begin{tcbitemize}[raster columns=2, raster equal height=rows,
152 size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
153 title={Box \# \thetcbrasternum}]
154 \tcbitem First box
155 \tcbitem Second box
156 \tcbitem This is a box\\with a second line
157 \tcbitem[colback=yellow,colbacktitle=yellow!50!black] Another box
158 \tcbitem A box again
159 \end{tcbitemize}
160 \end{dispExample}
161
162 \begin{marker}
163 \refEnv{tcbitemize} has more restrictions than \refEnv{tcbraster}.
164 Especially, the \refKey{/tcb/capture} mode has to be \docValue{minipage}.
165 For example, \refKey{/tcb/fit} cannot be used safely.
166 If \refKey{/tcb/fit} should be used, turn over to \refEnv{tcbraster}.
167 \end{marker}
168 \end{docEnvironment}
169
170
171 \begin{docCommand}[doc new=2014-11-10]{tcbitem}{\oarg{options}}
172 Used inside \refEnv{tcbitemize} to create a new \refEnv{tcolorbox}
173 with the given \meta{options}.
174 \end{docCommand}
175
176
177 \clearpage
178 \begin{docEnvironment}[doc new=2016-02-19]{tcboxedraster}{\oarg{raster options}\marg{box options}}
179 This is a convenience environment which combines a \refEnv{tcolorbox} with
180 an embedded \refEnv{tcbraster}. The \meta{box options} are given to the
181 outer \refEnv{tcolorbox}, while the \meta{raster options} are given to the
182 embedded \refEnv{tcbraster}.
183 This environment is especially useful for rasters inside rasters.
184
185 \begin{dispExample}
186 \begin{tcboxedraster}[raster columns=3, raster equal height,
187 size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
188 title={Box \# \thetcbrasternum}]
189 {colback=yellow!10,fonttitle=\bfseries,title=Boxed Raster}
190 \begin{tcolorbox}First box\end{tcolorbox}
191 \begin{tcolorbox}Second box\end{tcolorbox}
192 \begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
193 \begin{tcolorbox}Another box\end{tcolorbox}
194 \begin{tcolorbox}A box again\end{tcolorbox}
195 \end{tcboxedraster}
196 \end{dispExample}
197
198 \begin{dispExample}
199 % \tcbuselibrary{skins}
200 \begin{tcbraster}[raster columns=2, raster equal height,
201 raster every box/.style={size=small,colframe=red!50!black,colback=red!10!white,
202 valign=center,halign=center}]
203 \begin{tcolorbox}One\end{tcolorbox}
204 \begin{tcolorbox}Two\end{tcolorbox}
205 \begin{tcboxedraster}{blankest}
206 \begin{tcolorbox}Three\end{tcolorbox}
207 \begin{tcolorbox}Four\end{tcolorbox}
208 \begin{tcolorbox}Five\end{tcolorbox}
209 \begin{tcolorbox}Six\end{tcolorbox}
210 \end{tcboxedraster}
211 \begin{tcolorbox}Seven\end{tcolorbox}
212 \end{tcbraster}
213 \end{dispExample}
214 \end{docEnvironment}
215
216
217 \clearpage
218 \begin{docEnvironment}[doc new=2016-04-27]{tcboxeditemize}{\oarg{raster options}\marg{box options}}
219 This is a convenience environment which combines a \refEnv{tcolorbox} with
220 an embedded \refEnv{tcbitemize}. The \meta{box options} are given to the
221 outer \refEnv{tcolorbox}, while the \meta{raster options} are given to the
222 embedded \refEnv{tcbitemize}.
223 This environment is especially useful for rasters inside rasters.
224
225 \begin{dispExample}
226 \begin{tcboxeditemize}[raster columns=3, raster equal height,
227 size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
228 title={Box \# \thetcbrasternum}]
229 {colback=yellow!10,fonttitle=\bfseries,title=Boxed Itemize}
230 \tcbitem First box
231 \tcbitem Second box
232 \tcbitem This is a box\\with a second line
233 \tcbitem Another box
234 \tcbitem A box again
235 \end{tcboxeditemize}
236 \end{dispExample}
237 \end{docEnvironment}
238
239
240 \clearpage
241 \subsection{Option Keys of the Library}\label{subsec:raster_options}
242
243 \begin{docTcbKey}[][doc new=2014-11-10]{raster columns}{=\meta{number}}{no default, initially |2|}
244 Sets the \meta{number} of columns for a \emph{raster}.
245 \begin{dispExample}
246 \begin{tcbitemize}[raster columns=3,
247 size=small,colframe=red!50!black,colback=red!10!white]
248 \tcbitem One
249 \tcbitem Two
250 \tcbitem Three
251 \tcbitem Four
252 \end{tcbitemize}
253 \begin{tcbitemize}[raster columns=4,
254 size=small,colframe=blue!50!black,colback=blue!10!white]
255 \tcbitem One
256 \tcbitem Two
257 \tcbitem Three
258 \tcbitem Four
259 \end{tcbitemize}
260 \end{dispExample}
261 \end{docTcbKey}
262
263 \begin{docTcbKey}[][doc new=2014-11-10]{raster rows}{=\meta{number}}{no default, initially |2|}
264 Sets the \meta{number} of rows for a \emph{raster}.
265 Note that this is only relevant in connection with setting \refKey{/tcb/raster height}
266 to a value greater than |0pt|. Then, it defines the number of rows \emph{per} given
267 height.
268 \end{docTcbKey}
269
270
271 \begin{docTcbKey}[][doc new=2014-11-10]{raster width}{=\meta{length}}{no default, initially \cs{linewidth}}
272 Sets the total raster width to the given \meta{length}.
273 \refKey{/tcb/raster left skip} and \refKey{/tcb/raster right skip} are part
274 of the total width. Note that both skip values are not changed by this option.
275 \begin{dispExample}
276 \begin{tcbitemize}[raster width=\linewidth/2,
277 size=small,colframe=red!50!black,colback=red!10!white]
278 \tcbitem One
279 \tcbitem Two
280 \tcbitem Three
281 \tcbitem Four
282 \end{tcbitemize}
283 \end{dispExample}
284 \end{docTcbKey}
285
286
287 \clearpage
288 \begin{docTcbKey}[][doc new=2018-11-30]{raster width flush left}{=\meta{length}}{style, no default}
289 Sets the total \refKey{/tcb/raster width} to \cs{linewidth} and adapts
290 \refKey{/tcb/raster left skip} and \refKey{/tcb/raster right skip} to
291 place the raster on the left hand side
292 with a visual width of the given \meta{length}.
293 \begin{dispExample}
294 \begin{tcbitemize}[raster width flush left=\linewidth/2,
295 size=small,colframe=red!50!black,colback=red!10!white]
296 \tcbitem One
297 \tcbitem Two
298 \tcbitem Three
299 \tcbitem Four
300 \end{tcbitemize}
301 \end{dispExample}
302 Note that the results of \refKey{/tcb/raster width} and \refKey{/tcb/raster width flush left}
303 look identical, but differ on technical side since the later always fills
304 the available \cs{linewidth}.
305 \end{docTcbKey}
306
307
308 \begin{docTcbKey}[][doc new=2018-11-30]{raster width center}{=\meta{length}}{style, no default}
309 Sets the total \refKey{/tcb/raster width} to \cs{linewidth} and adapts
310 \refKey{/tcb/raster left skip} and \refKey{/tcb/raster right skip} to center
311 the raster with a visual width of the given \meta{length}.
312 \begin{dispExample}
313 \begin{tcbitemize}[raster width center=\linewidth/2,
314 size=small,colframe=red!50!black,colback=red!10!white]
315 \tcbitem One
316 \tcbitem Two
317 \tcbitem Three
318 \tcbitem Four
319 \end{tcbitemize}
320 \end{dispExample}
321 \end{docTcbKey}
322
323
324 \begin{docTcbKey}[][doc new=2018-11-30]{raster width flush right}{=\meta{length}}{style, no default}
325 Sets the total \refKey{/tcb/raster width} to \cs{linewidth} and adapts
326 \refKey{/tcb/raster left skip} and \refKey{/tcb/raster right skip} to
327 place the raster on the right hand side
328 with a visual width of the given \meta{length}.
329 \begin{dispExample}
330 \begin{tcbitemize}[raster width flush right=\linewidth/2,
331 size=small,colframe=red!50!black,colback=red!10!white]
332 \tcbitem One
333 \tcbitem Two
334 \tcbitem Three
335 \tcbitem Four
336 \end{tcbitemize}
337 \end{dispExample}
338 \end{docTcbKey}
339
340
341 \clearpage
342 \begin{docTcbKey}[][doc new=2014-11-10]{raster height}{=\meta{length}}{no default, initially |0pt|}
343 Sets the raster height \emph{per} \refKey{/tcb/raster rows} to the given \meta{length}.
344 This forces an appropriate height for the enclosed boxes.
345 \refKey{/tcb/raster before skip} and \refKey{/tcb/raster after skip}
346 are not part of this calculation.
347 If the \meta{length} is set to |0pt|, this feature is deactivated.
348 \begin{dispExample}
349 \begin{tcbitemize}[raster height=4cm, raster rows=2,
350 size=small,colframe=red!50!black,colback=red!10!white]
351 \tcbitem One
352 \tcbitem Two
353 \tcbitem[enhanced,
354 finish={\draw[blue,very thick,<->] (frame.south)
355 -- node[right,pos=.75]{4cm} +(0,4); }]
356 Three
357 \tcbitem Four
358 \tcbitem Five
359 \end{tcbitemize}
360 \end{dispExample}
361 \end{docTcbKey}
362
363
364 \begin{docTcbKey}[][doc new and updated={2014-11-10}{2014-12-16}]{raster before skip}{=\meta{glue}}{no default, initially |2mm|}
365 Space of the given \meta{glue} is inserted vertically before the \emph{raster}.
366 This space is discardable.
367 \end{docTcbKey}
368
369 \begin{docTcbKey}[][doc new and updated={2014-11-10}{2014-12-16}]{raster after skip}{=\meta{glue}}{no default, initially |2mm|}
370 Space of the given \meta{glue} is inserted vertically after the \emph{raster}.
371 This space is discardable.
372 \end{docTcbKey}
373
374
375 \begin{docTcbKey}[][doc new=2015-01-08]{raster equal skip}{=\meta{length}}{style, no default}
376 Shortcut to set
377 \refKey{/tcb/raster before skip},
378 \refKey{/tcb/raster after skip},
379 \refKey{/tcb/raster column skip}, and
380 \refKey{/tcb/raster row skip}
381 to the same \meta{length} value.
382 \begin{dispExample}
383 \begin{tcbitemize}[raster equal skip=4mm,
384 size=small,colframe=red!50!black,colback=red!10!white]
385 \tcbitem One
386 \tcbitem Two
387 \tcbitem Three
388 \tcbitem Four
389 \end{tcbitemize}
390 \end{dispExample}
391 \end{docTcbKey}
392
393
394 \clearpage
395
396 \begin{docTcbKey}[][doc new=2014-11-10]{raster left skip}{=\meta{length}}{no default, initially |0pt|}
397 Space of the given \meta{length} is inserted horizontally left of the \emph{raster}.
398 \begin{dispExample}
399 \begin{tcbitemize}[raster left skip=2cm,
400 size=small,colframe=red!50!black,colback=red!10!white]
401 \tcbitem One
402 \tcbitem Two
403 \tcbitem Three
404 \tcbitem Four
405 \end{tcbitemize}
406 \end{dispExample}
407 \end{docTcbKey}
408
409
410 \begin{docTcbKey}[][doc new=2014-11-10]{raster right skip}{=\meta{length}}{no default, initially |0pt|}
411 Space of the given \meta{length} is inserted horizontally right of the \emph{raster}.
412 \begin{dispExample}
413 \begin{tcbitemize}[raster right skip=2cm,
414 size=small,colframe=red!50!black,colback=red!10!white]
415 \tcbitem One
416 \tcbitem Two
417 \tcbitem Three
418 \tcbitem Four
419 \end{tcbitemize}
420 \end{dispExample}
421 \end{docTcbKey}
422
423 \enlargethispage*{1cm}
424
425 \begin{docTcbKey}[][doc new=2014-11-10]{raster column skip}{=\meta{length}}{no default, initially |2mm|}
426 Space of the given \meta{length} is inserted horizontally between the columns.
427 \begin{dispExample}
428 \begin{tcbitemize}[raster column skip=2cm,
429 size=small,colframe=red!50!black,colback=red!10!white]
430 \tcbitem One
431 \tcbitem Two
432 \tcbitem Three
433 \tcbitem Four
434 \end{tcbitemize}
435 \end{dispExample}
436 \end{docTcbKey}
437
438 \begin{docTcbKey}[][doc new=2014-11-10]{raster row skip}{=\meta{length}}{no default, initially |2mm|}
439 Space of the given \meta{length} is inserted vertically between the rows.
440 \begin{dispExample}
441 \begin{tcbitemize}[raster row skip=0pt,
442 size=small,colframe=red!50!black,colback=red!10!white]
443 \tcbitem One
444 \tcbitem Two
445 \tcbitem Three
446 \tcbitem Four
447 \end{tcbitemize}
448 \end{dispExample}
449 \end{docTcbKey}
450
451 \clearpage
452
453 \begin{docTcbKey}[][doc new=2014-11-10]{raster halign}{=\meta{alignment}}{no default, initially \docValue{left}}
454 Defines the horizontal alignment for the boxes of the rows of a \emph{raster},
455 if these rows are not completely filled (mainly: the last one).
456
457 Feasible values for \meta{alignment} are:
458 \begin{itemize}
459 \item\docValue{left}: align to the left side,
460 \item\docValue{center}: align to the center,
461 \item\docValue{right}: align to the right side.
462 \end{itemize}
463
464 \begin{dispExample}
465 \begin{tcbitemize}[raster halign=center,
466 size=small,colframe=red!50!black,colback=red!10!white]
467 \tcbitem One
468 \tcbitem Two
469 \tcbitem Three
470 \end{tcbitemize}
471 \end{dispExample}
472 \end{docTcbKey}
473
474
475 \begin{docTcbKey}[][doc new=2014-11-10]{raster valign}{=\meta{alignment}}{no default, initially \docValue{center}}
476 Defines the vertical alignment for the boxes of a row,
477 if the boxes do not have equal height. This sets the
478 \refKey{/tcb/box align} option.
479
480 Feasible values for \meta{alignment} are:
481 \begin{itemize}
482 \item\docValue{top}: align to the top side,
483 \item\docValue{center}: align to the center,
484 \item\docValue{bottom}: align to the bottom side.
485 \end{itemize}
486
487 \begin{dispExample}
488 \begin{tcbitemize}[raster valign=top, raster columns=3,
489 size=small,colframe=red!50!black,colback=red!10!white]
490 \tcbitem \Huge One
491 \tcbitem \Large Two
492 \tcbitem Three
493 \end{tcbitemize}
494 \begin{tcbitemize}[raster valign=center, raster columns=3,
495 size=small,colframe=blue!50!black,colback=blue!10!white]
496 \tcbitem \Huge One
497 \tcbitem \Large Two
498 \tcbitem Three
499 \end{tcbitemize}
500 \begin{tcbitemize}[raster valign=bottom, raster columns=3,
501 size=small,colframe=green!50!black,colback=green!10!white]
502 \tcbitem \Huge One
503 \tcbitem \Large Two
504 \tcbitem Three
505 \end{tcbitemize}
506 \end{dispExample}
507 \end{docTcbKey}
508
509
510 \clearpage
511 \begin{docTcbKey}[][doc new and updated={2014-11-10}{2017-02-28}]{raster equal height}{=\meta{type}}{default \docValue{all}, initially \docValue{none}}
512 Puts the enclosed boxes into a common \refKey{/tcb/equal height group}.
513 The \meta{id} of the equal height group is chosen automatically, but
514 it may be set manually by \refKey{/tcb/raster equal height group}.
515 Also see \refKey{/tcb/minimum for current equal height group}.
516
517 Feasible values for \meta{type} are:
518 \begin{itemize}
519 \item\docValue{none}: no equal height setting,
520 \item\docValue{rows}: all boxes in a row are set to equal height,
521 \item\docValue{all}: all boxes in the raster are set to equal height.
522 \end{itemize}
523 Note that you have to compile twice to see changes.
524
525 \begin{dispExample}
526 \begin{tcbitemize}[raster equal height=rows,
527 size=small,colframe=red!50!black,colback=red!10!white]
528 \tcbitem One
529 \tcbitem \Huge Two
530 \tcbitem Three
531 \tcbitem Four
532 \end{tcbitemize}
533 \end{dispExample}
534 \begin{dispExample}
535 \begin{tcbitemize}[raster equal height,
536 size=small,colframe=red!50!black,colback=red!10!white]
537 \tcbitem One
538 \tcbitem \Huge Two
539 \tcbitem Three
540 \tcbitem Four
541 \end{tcbitemize}
542 \end{dispExample}
543 \end{docTcbKey}
544
545
546 \begin{docTcbKey}[][doc new=2014-11-10]{raster equal height group}{=\meta{id}}{no default}
547 Overwrites the automatically chosen id with the given \meta{id}.
548 If this is used to share a common height between the \emph{raster} and
549 another raster or box, the \refKey{/tcb/raster equal height} option
550 should be set to \docValue{all}.
551 \begin{dispExample}
552 \tcbset{size=small,colframe=red!50!black,colback=red!10!white}
553 \begin{tcolorbox}[equal height group=raster-manual-id]
554 A single box
555 \end{tcolorbox}
556 \begin{tcbitemize}[raster equal height,raster equal height group=raster-manual-id]
557 \tcbitem One
558 \tcbitem \Huge Two
559 \end{tcbitemize}
560 \end{dispExample}
561 \end{docTcbKey}
562
563
564 \clearpage
565
566 \begin{docTcbKey}[][doc new=2014-11-10]{raster force size}{\colOpt{=true\textbar false}}{default |true|, initially |true|}
567 Enforces the raster size computations onto the enclosed boxes.
568 If set to \docValue{false}, individual settings can be used (for the better or worse).
569 \begin{dispExample}
570 \begin{tcbitemize}[raster force size=false, raster halign=center,
571 size=small,colframe=red!50!black,colback=red!10!white]
572 \tcbitem One
573 \tcbitem Two
574 \tcbitem[add to width=-3cm] Three
575 \tcbitem[add to width=-3cm] Four
576 \tcbitem[add to width=-3cm] Five
577 \tcbitem[add to width=3cm] Six
578 \end{tcbitemize}
579 \end{dispExample}
580 \end{docTcbKey}
581
582
583
584 \begin{docTcbKey}[][doc new=2014-11-10]{raster reset}{}{no value}
585 Sets all raster settings back to their default values.
586 Note that \refKey{/tcb/reset} does not execute this option.
587 Style settings like \refKey{/tcb/raster odd column} etc. are not
588 touched by \refKey{/tcb/raster reset}.
589 \end{docTcbKey}
590
591
592
593 \subsection{Adding Styles for Specific Boxes}\label{subsec:raster_styles}
594
595 The following styles can be defined to address certain boxes inside
596 a \emph{raster}. Note that such style definitions are not removed by
597 \refKey{/tcb/reset} or \refKey{/tcb/raster reset}.
598 The style definitions are used in the order given below.
599
600 \begin{docTcbKey}[][doc new=2014-11-24]{raster every box}{}{style}
601 This style is used for every box.
602 \end{docTcbKey}
603
604 \begin{docTcbKey}[][doc new=2014-11-10]{raster odd column}{}{style}
605 This style is used for every box in an odd column.
606 \begin{dispExample}
607 \begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
608 raster odd column/.style={colframe=blue!50!black,colback=blue!10!white}]
609 \tcbitem One
610 \tcbitem Two
611 \tcbitem Three
612 \tcbitem Four
613 \end{tcbitemize}
614 \end{dispExample}
615 \end{docTcbKey}
616
617 \begin{docTcbKey}[][doc new=2014-11-10]{raster even column}{}{style}
618 This style is used for every box in an even column.
619 \end{docTcbKey}
620
621
622 \begin{docTcbKey}[][doc new=2014-11-10]{raster column n}{}{style}
623 This style is used for every box in the |n|-th column.
624 |n| has to be replaced by a number.
625 \end{docTcbKey}
626
627
628 \begin{docTcbKey}[][doc new=2014-11-10]{raster odd row}{}{style}
629 This style is used for every box in an odd row.
630 \end{docTcbKey}
631
632 \begin{docTcbKey}[][doc new=2014-11-10]{raster even row}{}{style}
633 This style is used for every box in an even row.
634 \end{docTcbKey}
635
636
637 \begin{docTcbKey}[][doc new=2014-11-10]{raster row m}{}{style}
638 This style is used for every box in the |m|-th row.
639 |m| has to be replaced by a number.
640 \begin{dispExample}
641 \begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
642 raster row 2/.style={colframe=blue!50!black,colback=blue!10!white}]
643 \tcbitem One
644 \tcbitem Two
645 \tcbitem Three
646 \tcbitem Four
647 \end{tcbitemize}
648 \end{dispExample}
649 \end{docTcbKey}
650
651 \begin{docTcbKey}[][doc new=2014-11-10]{raster odd number}{}{style}
652 This style is used for every box with an odd number.
653 \end{docTcbKey}
654
655 \begin{docTcbKey}[][doc new=2014-11-10]{raster even number}{}{style}
656 This style is used for every box with an even number.
657 \begin{dispExample}
658 \begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
659 raster columns=3,
660 raster even number/.style={colframe=blue!50!black,colback=blue!10!white}]
661 \tcbitem One
662 \tcbitem Two
663 \tcbitem Three
664 \tcbitem Four
665 \tcbitem Five
666 \tcbitem Six
667 \end{tcbitemize}
668 \end{dispExample}
669 \end{docTcbKey}
670
671
672 \begin{docTcbKey}[][doc new=2014-11-10]{raster row m column n}{}{style}
673 This style is used for the box in the
674 |m|-th row and |n|-th column.
675 |m| and |n| have to be replaced by numbers.
676 \end{docTcbKey}
677
678
679 \begin{docTcbKey}[][doc new=2014-11-10]{raster number n}{}{style}
680 This style is used for the box with number |n|.
681 |n| has to be replaced by a number.
682 \begin{dispExample}
683 \begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
684 raster number 4/.style={colframe=blue!50!black,colback=blue!10!white}]
685 \tcbitem One
686 \tcbitem Two
687 \tcbitem Three
688 \tcbitem Four
689 \end{tcbitemize}
690 \end{dispExample}
691 \end{docTcbKey}
692
693
694 \clearpage
695 \subsection{Combining Columns or Rows}\label{subsec:raster_multicolrow}
696
697 \begin{docTcbKey}[][doc new=2016-02-19]{raster multicolumn}{=\meta{number}}{no default, initially unset}
698 This option has to be set inside the option list of a \refEnv{tcolorbox}
699 inside a \refEnv{tcbraster} or inside \refCom{tcbitem} inside \refEnv{tcbitemize}.
700 It merges the given \meta{number} of boxes into one single box
701 on the same line. The resulting box gets the \docAuxCommand{thetcbrasternum}
702 of the first box.
703 If there are not enough boxes available on the current line, this option
704 is ignored and a warning is given.
705
706 \begin{dispExample}
707 \begin{tcbitemize}[raster equal height=rows,raster columns=3,
708 title=\thetcbrasternum,colframe=red!50!black,colback=red!10!white]
709 \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=1]
710 multicolumn=1
711 \tcbitem
712 \tcbitem
713 \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2]
714 multicolumn=2
715 \tcbitem
716 \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=3]
717 multicolumn=3
718 \tcbitem
719 \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2]
720 multicolumn=2
721 \end{tcbitemize}
722 \end{dispExample}
723 \end{docTcbKey}
724
725
726 \clearpage
727 \begin{docTcbKey}[][doc new=2016-02-19]{raster multirow}{=\meta{number}}{no default, initially unset}
728 This option has to be set inside the option list of a \refEnv{tcolorbox}
729 inside a \refEnv{tcbraster} or inside \refCom{tcbitem} inside \refEnv{tcbitemize}.
730 This option not really merges boxes, but simply sizes the current box to fit
731 the space of \meta{number} rows.
732
733 \begin{marker}
734 \refKey{/tcb/raster multirow} needs \refKey{/tcb/raster height} to be set.
735 How to achieve a similar result for boxes without fixed \refKey{/tcb/raster height}
736 is shown afterwards.
737 \end{marker}
738
739 \begin{dispExample}
740 \begin{tcbitemize}[raster rows=3,raster columns=3,raster height=6cm,
741 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
742 \tcbitem
743 \tcbitem
744 \tcbitem
745 \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multirow=2]
746 multirow=2
747 \tcbitem[raster multicolumn=2,raster multirow=2,blankest]
748 \begin{tcbitemize}[raster rows=2,raster columns=2,raster height=\tcbtextheight]
749 \tcbitem
750 \tcbitem
751 \tcbitem
752 \tcbitem
753 \end{tcbitemize}
754 \end{tcbitemize}
755 \end{dispExample}
756
757
758 \clearpage
759 For rasters without fixed \refKey{/tcb/raster height}, \refKey{/tcb/raster multirow}
760 cannot be used. Note that \refCom{tcbtextheight} also cannot be used like
761 in the previous example.
762
763 But, with combination of \refKey{/tcb/raster equal height} and
764 \refKey{/tcb/space to}, a similar effect can be created:
765
766 \begin{dispExample}
767 \begin{tcbitemize}[raster columns=3,raster equal height=rows,
768 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
769 \tcbitem
770 \tcbitem
771 \tcbitem
772 \tcbitem[colframe=blue!50!black,colback=blue!10!white]
773 \lipsum[2]
774 \tcbitem[raster multicolumn=2,blankest,space to=\myspace]
775 \begin{tcbitemize}[raster columns=2]
776 \tcbitem This is a box of the inner raster.
777 \tcbitem
778 \tcbitem[height=\myspace]
779 \tcbitem[height=\myspace]
780 \end{tcbitemize}
781 \end{tcbitemize}
782 \end{dispExample}
783
784 \end{docTcbKey}
785
786
787
788 \clearpage
789 \subsection{Rasters inside Rasters}\label{subsec:raster_insideraster}
790
791 A \emph{raster} inside a \emph{raster} cannot be used directly, because
792 a \emph{raster} can only contain a \emph{tcolorbox} or something
793 derived from a \emph{tcolorbox}. So, a \emph{raster} can be put inside
794 a \emph{tcolorbox} inside a \emph{raster}.
795
796 Some examples for such constructions can be found at \refEnv{tcboxedraster},
797 \refKey{/tcb/raster multicolumn},
798 \refKey{/tcb/raster multirow}.
799
800
801 \subsubsection{Raster Setup}
802 The intermediating \refEnv{tcolorbox} can be made invisible by using
803 \refKey{/tcb/blankest}.
804
805 \begin{dispExample}
806 \begin{tcbraster}[raster equal height=rows,
807 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
808 \begin{tcolorbox}[blankest]
809 \begin{tcbraster}[raster columns=1]
810 \begin{tcolorbox}One\end{tcolorbox}
811 \begin{tcolorbox}Two\end{tcolorbox}
812 \end{tcbraster}
813 \end{tcolorbox}
814 \begin{tcolorbox}raster+tcolorbox+raster\end{tcolorbox}
815 \end{tcbraster}
816 \end{dispExample}
817
818 \enlargethispage*{1cm}
819 \begin{dispExample}
820 \begin{tcbraster}[raster equal height=rows,
821 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
822 \begin{tcboxedraster}[raster columns=1]{blankest}
823 \begin{tcolorbox}One\end{tcolorbox}
824 \begin{tcolorbox}Two\end{tcolorbox}
825 \end{tcboxedraster}
826 \begin{tcolorbox}raster+tcboxedraster\end{tcolorbox}
827 \end{tcbraster}
828 \end{dispExample}
829
830
831 \begin{dispExample}
832 \begin{tcbitemize}[raster equal height=rows,
833 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
834 \tcbitem[blankest]
835 \begin{tcbitemize}[raster columns=1]
836 \tcbitem One
837 \tcbitem Two
838 \end{tcbitemize}
839 \tcbitem tcbitemize+tcbitem+tcbitemize
840 \end{tcbitemize}
841 \end{dispExample}
842
843
844 \subsubsection{Placing Spaces}
845 If the heights of boxes inside staggered rasters should be matched, the
846 space has to be distributed accordingly.
847
848 \begin{itemize}
849 \item For fixed height boxes/rasters using \refKey{/tcb/raster height},
850 the height of boxes is available by \refCom{tcbtextheight}. This can be
851 used to size deeper layered boxes/rasters.
852 \item For boxes/rasters laid out using \refKey{/tcb/raster equal height},
853 space can be distributed by \refKey{/tcb/space to}.
854 It can take several compilations until all spaces are distributed correctly.
855 \end{itemize}
856
857
858 \begin{dispExample}
859 \begin{tcbitemize}[raster rows=2,raster height=6cm,
860 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
861 \tcbitem[blankest]
862 \begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
863 \tcbitem One
864 \tcbitem Two
865 \end{tcbitemize}
866 \tcbitem This is a fixed height box.
867 \tcbitem Three
868 \tcbitem Four
869 \end{tcbitemize}
870 \end{dispExample}
871
872
873 \begin{dispExample}
874 \begin{tcbitemize}[raster columns=4,raster rows=4,raster height=0.8\linewidth,
875 raster every box/.style={size=small,beamer,
876 colframe=blue!75!yellow,colback=red!75!yellow!20,
877 center title,title=Box}]
878 \tcbitem One
879 \tcbitem Two
880 \tcbitem Three
881 \tcbitem Four
882 \tcbitem[raster multirow=2,blankest]
883 \begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
884 \tcbitem Twelve
885 \tcbitem Eleven
886 \end{tcbitemize}
887 \tcbitem[raster multirow=2,raster multicolumn=2,
888 colframe=red!75!yellow,colback=blue!75!yellow!20]
889 This is an example with fixed height boxes.
890 \tcbitem[raster multirow=2,blankest]
891 \begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
892 \tcbitem Five
893 \tcbitem Six
894 \end{tcbitemize}
895 \tcbitem Ten
896 \tcbitem Nine
897 \tcbitem Eight
898 \tcbitem Seven
899 \end{tcbitemize}
900 \end{dispExample}
901
902
903 \begin{dispExample}
904 \begin{tcbitemize}[raster equal height=rows,
905 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
906 \tcbitem[blankest,space to=\myspace]
907 \begin{tcbitemize}[raster columns=1]
908 \tcbitem One
909 \tcbitem[add to natural height=\myspace]
910 This box will adapt its height.
911 \end{tcbitemize}
912 \tcbitem This is a flexible height box.
913 \tcbitem \lipsum[4]
914 \tcbitem[blankest,space to=\myspace]
915 \begin{tcbitemize}[raster columns=1]
916 \tcbitem One
917 \tcbitem[add to natural height=\myspace]
918 This box will adapt its height.
919 \end{tcbitemize}
920 \end{tcbitemize}
921 \end{dispExample}
922
923
924
925 \begin{dispExample}
926 \begin{tcbitemize}[raster equal height=rows,
927 raster every box/.style={colframe=red!50!black,colback=red!10!white}]
928 \tcbitem[blankest,space to=\myspace]
929 \begin{tcbitemize}[raster columns=1]
930 \tcbitem One
931 \tcbitem[add to natural height=\myspace]
932 This box will adapt its height.
933 \tcbitem \lipsum[4]
934 \end{tcbitemize}
935 \tcbitem[blankest,space to=\myspace]
936 \begin{tcbitemize}[raster columns=1]
937 \tcbitem[blankest]\includegraphics[width=\linewidth]{goldshade.png}
938 \tcbitem[add to natural height=\myspace]
939 This box will adapt its height.
940 \end{tcbitemize}
941 \end{tcbitemize}
942 \end{dispExample}
943
944
945