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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
|
% !TeX root = tcolorbox.tex
% include file of tcolorbox.tex (manual of the LaTeX package tcolorbox)
\clearpage
\section{Library \mylib{raster}}\label{sec:raster}%
\tcbset{external/prefix=external/raster_}%
The library is loaded by a package option or inside the preamble by:
\begin{dispListing}
\tcbuselibrary{raster}
\end{dispListing}
%This also loads the package |xparse| \cite{latexproject:2015a}.
%The purpose of this library is to give comfortable access to the
%powerful document command production with |xparse| for |tcolorbox|.
%See the |xparse| package documentation \cite{latexproject:2015a}
%for details about the argument \meta{specification} used in this section.
\subsection{Concept of Rasters}\label{subsec:raster_overview}
A \emph{raster} is used to align several colored boxes in a regular way.
It can be seen as a far related counterpart to the |matrix| construct
of \tikzname, but it differs in many aspects.
In principle, |tcolorbox|es are arranged in rows and columns when put
inside a \refEnv{tcbraster} environment. The boxes are fluently added to the
raster like adding text to a paragraph.
Especially, line/row breaks are done
automatically and one cannot end a line/row ahead of schedule.
Further, a \emph{raster} is not restricted to a single page but may
break into an arbitrary series of pages.
\bigskip
\begin{tcolorbox}[enhanced,size=tight,boxrule=0pt,frame hidden,
top=5mm,bottom=5mm,colback=yellow!20!white,
borderline={0.4pt}{0pt}{dashed,yellow!50!black},
finish={
\draw[thick,<->] ([yshift=-1.3cm]frame.north west)-- node[below]{\refKey{/tcb/raster width}}
([yshift=-1.3cm]frame.north east);
\draw[thick,<->] ([xshift=5mm,yshift=-5mm]frame.north east)-- node[left,pos=.75]{\refKey{/tcb/raster height}}
([xshift=5mm,yshift=5mm]frame.south east);
}]
\begin{tcbitemize}[enhanced,fontupper=\tiny,
title={Box \#\thetcbrasternum},
colframe=red!50!black!30!white,colback=red!10!white!40!white,
colupper=black!20!white,
raster equal height=rows,
raster left skip=5mm,raster right skip=5mm,
raster before skip=5mm,raster after skip=5mm,
raster row skip=3mm,raster column skip=3mm,
]
\tcbitem[finish={%
\draw[thick,<->] (frame.west)-- node[below right]{\refKey{/tcb/raster left skip}}+(-0.5,0);
\draw[thick,<->] (frame.north)-- node[right]{\refKey{/tcb/raster before skip}} +(0,0.5);
\draw[thick,<->] (frame.south)-- node[above]{\refKey{/tcb/raster row skip}} +(0,-0.3);
}] \lipsum[1]
\tcbitem[finish={
\draw[thick,<->] (frame.east)-- node[below left]{\refKey{/tcb/raster right skip}}+(0.5,0);
\draw[thick,<->] ([yshift=5mm]frame.south west)-- node[above]{\refKey{/tcb/raster column skip}}+(-0.3,0);
}] \lipsum[2]
\tcbitem[finish={%
\draw[thick,<->] (frame.south)-- node[right]{\refKey{/tcb/raster after skip}} +(0,-0.5);
}] \lipsum[3]
\tcbitem \lipsum[4]
\end{tcbitemize}
\end{tcolorbox}
\clearpage
\begin{tcboutputlisting}
\begin{tcbraster}[raster columns=3,raster rows=3,raster height=\linewidth,
enhanced,size=small,sharp corners,arc=8mm,colframe=red!50!black,
colback=yellow!10!white,watermark overzoom=1.0,fit algorithm=hybrid* ]
\begin{tcolorbox}[rounded corners=northwest,boxrule=0pt,
watermark graphics=lichtspiel.jpg]\end{tcolorbox}
\tcboxfit{\lipsum[1]}
\begin{tcolorbox}[rounded corners=northeast,boxrule=0pt,
watermark graphics=goldshade.png]\end{tcolorbox}
\tcboxfit{\lipsum[2]}
\begin{tcolorbox}[valign=center,halign=center]Nine Boxes.\end{tcolorbox}
\tcboxfit{\lipsum[3]}
\begin{tcolorbox}[rounded corners=southwest,boxrule=0pt,
watermark graphics=goldshade.png]\end{tcolorbox}
\tcboxfit{\lipsum[4]}
\begin{tcolorbox}[rounded corners=southeast,boxrule=0pt,
watermark graphics=lichtspiel.jpg]\end{tcolorbox}
\end{tcbraster}
\end{tcboutputlisting}
\tcbinputlisting{base example,listing only,listing style=mydocumentation}
\bigskip
{\tcbuselistingtext}
\clearpage
\subsection{Macros of the Library}\label{subsec:raster_macros}
\begin{docEnvironment}[doc new and updated={2014-11-10}{2017-02-01}]{tcbraster}{\oarg{options}}
A raster arranges enclosed boxes in a regular way, mainly into rows and
columns. The \meta{options} are used to control the raster
parameters and to set the properties for the enclosed boxes.
\begin{itemize}
\item The \emph{raster} is only allowed to contain a series of
\refEnv{tcolorbox} environments or derived constructs.
With some small restrictions, boxes created with \refCom{tcboxfit} can also be added.
Boxes created with \refCom{tcbox} are not reasonable here, but may be
used to a certain degree.
\item Do not add anything else between the boxes inside the raster with
exception of white\-space. Especially, do not use |\\| or |\par| to end
a row; row breaks are done automatically.
\item The boxes inside a raster are numbered automatically.
\docAuxCommand{thetcbrasternum} may be used inside a box to access
this number.
\end{itemize}
\begin{dispExample}
\begin{tcbraster}[raster columns=3, raster equal height,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
title={Box \# \thetcbrasternum}]
\begin{tcolorbox}First box\end{tcolorbox}
\begin{tcolorbox}Second box\end{tcolorbox}
\begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
\begin{tcolorbox}Another box\end{tcolorbox}
\begin{tcolorbox}A box again\end{tcolorbox}
\end{tcbraster}
\end{dispExample}
\begin{dispExample}
\begin{tcbraster}[raster columns=2, raster equal height=rows,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
title={Box \# \thetcbrasternum}]
\begin{tcolorbox}First box\end{tcolorbox}
\begin{tcolorbox}Second box\end{tcolorbox}
\begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
\begin{tcolorbox}Another box\end{tcolorbox}
\begin{tcolorbox}A box again\end{tcolorbox}
\end{tcbraster}
\end{dispExample}
\end{docEnvironment}
\clearpage
\begin{docEnvironment}[doc new=2014-11-10]{tcbitemize}{\oarg{options}}
This is a special case of a \refEnv{tcbraster} with the given \meta{options}.
\begin{itemize}
\item Here, the enclosed boxes are created using \refCom{tcbitem}.
\item There has to be at least one \refCom{tcbitem}.
\item One cannot use anything else than \refCom{tcbitem} to add something
to the \emph{raster}.
\end{itemize}
This leads to a very compact syntax.
\begin{dispExample}
\begin{tcbitemize}[raster columns=2, raster equal height=rows,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
title={Box \# \thetcbrasternum}]
\tcbitem First box
\tcbitem Second box
\tcbitem This is a box\\with a second line
\tcbitem[colback=yellow,colbacktitle=yellow!50!black] Another box
\tcbitem A box again
\end{tcbitemize}
\end{dispExample}
\begin{marker}
\refEnv{tcbitemize} has more restrictions than \refEnv{tcbraster}.
Especially, the \refKey{/tcb/capture} mode has to be \docValue{minipage}.
For example, \refKey{/tcb/fit} cannot be used safely.
If \refKey{/tcb/fit} should be used, turn over to \refEnv{tcbraster}.
\end{marker}
\end{docEnvironment}
\begin{docCommand}[doc new=2014-11-10]{tcbitem}{\oarg{options}}
Used inside \refEnv{tcbitemize} to create a new \refEnv{tcolorbox}
with the given \meta{options}.
\end{docCommand}
\clearpage
\begin{docEnvironment}[doc new=2016-02-19]{tcboxedraster}{\oarg{raster options}\marg{box options}}
This is a convenience environment which combines a \refEnv{tcolorbox} with
an embedded \refEnv{tcbraster}. The \meta{box options} are given to the
outer \refEnv{tcolorbox}, while the \meta{raster options} are given to the
embedded \refEnv{tcbraster}.
This environment is especially useful for rasters inside rasters.
\begin{dispExample}
\begin{tcboxedraster}[raster columns=3, raster equal height,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
title={Box \# \thetcbrasternum}]
{colback=yellow!10,fonttitle=\bfseries,title=Boxed Raster}
\begin{tcolorbox}First box\end{tcolorbox}
\begin{tcolorbox}Second box\end{tcolorbox}
\begin{tcolorbox}This is a box\\with a second line\end{tcolorbox}
\begin{tcolorbox}Another box\end{tcolorbox}
\begin{tcolorbox}A box again\end{tcolorbox}
\end{tcboxedraster}
\end{dispExample}
\begin{dispExample}
% \tcbuselibrary{skins}
\begin{tcbraster}[raster columns=2, raster equal height,
raster every box/.style={size=small,colframe=red!50!black,colback=red!10!white,
valign=center,halign=center}]
\begin{tcolorbox}One\end{tcolorbox}
\begin{tcolorbox}Two\end{tcolorbox}
\begin{tcboxedraster}{blankest}
\begin{tcolorbox}Three\end{tcolorbox}
\begin{tcolorbox}Four\end{tcolorbox}
\begin{tcolorbox}Five\end{tcolorbox}
\begin{tcolorbox}Six\end{tcolorbox}
\end{tcboxedraster}
\begin{tcolorbox}Seven\end{tcolorbox}
\end{tcbraster}
\end{dispExample}
\end{docEnvironment}
\clearpage
\begin{docEnvironment}[doc new=2016-04-27]{tcboxeditemize}{\oarg{raster options}\marg{box options}}
This is a convenience environment which combines a \refEnv{tcolorbox} with
an embedded \refEnv{tcbitemize}. The \meta{box options} are given to the
outer \refEnv{tcolorbox}, while the \meta{raster options} are given to the
embedded \refEnv{tcbitemize}.
This environment is especially useful for rasters inside rasters.
\begin{dispExample}
\begin{tcboxeditemize}[raster columns=3, raster equal height,
size=small,colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
title={Box \# \thetcbrasternum}]
{colback=yellow!10,fonttitle=\bfseries,title=Boxed Itemize}
\tcbitem First box
\tcbitem Second box
\tcbitem This is a box\\with a second line
\tcbitem Another box
\tcbitem A box again
\end{tcboxeditemize}
\end{dispExample}
\end{docEnvironment}
\clearpage
\subsection{Option Keys of the Library}\label{subsec:raster_options}
\begin{docTcbKey}[][doc new=2014-11-10]{raster columns}{=\meta{number}}{no default, initially |2|}
Sets the \meta{number} of columns for a \emph{raster}.
\begin{dispExample}
\begin{tcbitemize}[raster columns=3,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\begin{tcbitemize}[raster columns=4,
size=small,colframe=blue!50!black,colback=blue!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster rows}{=\meta{number}}{no default, initially |2|}
Sets the \meta{number} of rows for a \emph{raster}.
Note that this is only relevant in connection with setting \refKey{/tcb/raster height}
to a value greater than |0pt|. Then, it defines the number of rows \emph{per} given
height.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster width}{=\meta{length}}{no default, initially \cs{linewidth}}
Sets the total raster width to the given \meta{length}.
\refKey{/tcb/raster left skip} and \refKey{/tcb/raster right skip} are part
of the total width.
\begin{dispExample}
\begin{tcbitemize}[raster width=\linewidth/2,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2014-11-10]{raster height}{=\meta{length}}{no default, initially |0pt|}
Sets the raster height \emph{per} \refKey{/tcb/raster rows} to the given \meta{length}.
This forces an appropriate height for the enclosed boxes.
\refKey{/tcb/raster before skip} and \refKey{/tcb/raster after skip}
are not part of this calculation.
If the \meta{length} is set to |0pt|, this feature is deactivated.
\begin{dispExample}
\begin{tcbitemize}[raster height=4cm, raster rows=2,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem[enhanced,
finish={\draw[blue,very thick,<->] (frame.south)
-- node[right,pos=.75]{4cm} +(0,4); }]
Three
\tcbitem Four
\tcbitem Five
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new and updated={2014-11-10}{2014-12-16}]{raster before skip}{=\meta{glue}}{no default, initially |2mm|}
Space of the given \meta{glue} is inserted vertically before the \emph{raster}.
This space is discardable.
\end{docTcbKey}
\begin{docTcbKey}[][doc new and updated={2014-11-10}{2014-12-16}]{raster after skip}{=\meta{glue}}{no default, initially |2mm|}
Space of the given \meta{glue} is inserted vertically after the \emph{raster}.
This space is discardable.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2015-01-08]{raster equal skip}{=\meta{length}}{style, no default}
Shortcut to set
\refKey{/tcb/raster before skip},
\refKey{/tcb/raster after skip},
\refKey{/tcb/raster column skip}, and
\refKey{/tcb/raster row skip}
to the same \meta{length} value.
\begin{dispExample}
\begin{tcbitemize}[raster equal skip=4mm,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2014-11-10]{raster left skip}{=\meta{length}}{no default, initially |0pt|}
Space of the given \meta{length} is inserted horizontally left of the \emph{raster}.
\begin{dispExample}
\begin{tcbitemize}[raster left skip=2cm,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster right skip}{=\meta{length}}{no default, initially |0pt|}
Space of the given \meta{length} is inserted horizontally right of the \emph{raster}.
\begin{dispExample}
\begin{tcbitemize}[raster right skip=2cm,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\enlargethispage*{1cm}
\begin{docTcbKey}[][doc new=2014-11-10]{raster column skip}{=\meta{length}}{no default, initially |2mm|}
Space of the given \meta{length} is inserted horizontally between the columns.
\begin{dispExample}
\begin{tcbitemize}[raster column skip=2cm,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster row skip}{=\meta{length}}{no default, initially |2mm|}
Space of the given \meta{length} is inserted vertically between the rows.
\begin{dispExample}
\begin{tcbitemize}[raster row skip=0pt,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2014-11-10]{raster halign}{=\meta{alignment}}{no default, initially \docValue{left}}
Defines the horizontal alignment for the boxes of the rows of a \emph{raster},
if these rows are not completely filled (mainly: the last one).
Feasible values for \meta{alignment} are:
\begin{itemize}
\item\docValue{left}: align to the left side,
\item\docValue{center}: align to the center,
\item\docValue{right}: align to the right side.
\end{itemize}
\begin{dispExample}
\begin{tcbitemize}[raster halign=center,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem Three
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster valign}{=\meta{alignment}}{no default, initially \docValue{center}}
Defines the vertical alignment for the boxes of a row,
if the boxes do not have equal height. This sets the
\refKey{/tcb/box align} option.
Feasible values for \meta{alignment} are:
\begin{itemize}
\item\docValue{top}: align to the top side,
\item\docValue{center}: align to the center,
\item\docValue{bottom}: align to the bottom side.
\end{itemize}
\begin{dispExample}
\begin{tcbitemize}[raster valign=top, raster columns=3,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem \Huge One
\tcbitem \Large Two
\tcbitem Three
\end{tcbitemize}
\begin{tcbitemize}[raster valign=center, raster columns=3,
size=small,colframe=blue!50!black,colback=blue!10!white]
\tcbitem \Huge One
\tcbitem \Large Two
\tcbitem Three
\end{tcbitemize}
\begin{tcbitemize}[raster valign=bottom, raster columns=3,
size=small,colframe=green!50!black,colback=green!10!white]
\tcbitem \Huge One
\tcbitem \Large Two
\tcbitem Three
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2014-11-10]{raster equal height}{=\meta{type}}{default \docValue{all}, initially \docValue{none}}
Puts the enclosed boxes into a common \refKey{/tcb/equal height group}.
The \meta{id} of the equal height group is chosen automatically, but
it may be set manually by \refKey{/tcb/raster equal height group}.
Also see \refKey{/tcb/minimum for current equal height group}.
Feasible values for \meta{type} are:
\begin{itemize}
\item\docValue{none}: no equal height setting,
\item\docValue{rows}: all boxes in a row are set to equal height,
\item\docValue{all}: all boxes in the raster are set to equal height.
\end{itemize}
Note that you have to compile twice to see changes.
\begin{dispExample}
\begin{tcbitemize}[raster equal height=rows,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem \Huge Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\begin{dispExample}
\begin{tcbitemize}[raster equal height,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem \Huge Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster equal height group}{=\meta{id}}{no default}
Overwrites the automatically chosen id with the given \meta{id}.
If this is used to share a common height between the \emph{raster} and
another raster or box, the \refKey{/tcb/raster equal height} option
should be set to \docValue{all}.
\begin{dispExample}
\tcbset{size=small,colframe=red!50!black,colback=red!10!white}
\begin{tcolorbox}[equal height group=raster-manual-id]
A single box
\end{tcolorbox}
\begin{tcbitemize}[raster equal height,raster equal height group=raster-manual-id]
\tcbitem One
\tcbitem \Huge Two
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2014-11-10]{raster force size}{\colOpt{=true\textbar false}}{default |true|, initially |true|}
Enforces the raster size computations onto the enclosed boxes.
If set to \docValue{false}, individual settings can be used (for the better or worse).
\begin{dispExample}
\begin{tcbitemize}[raster force size=false, raster halign=center,
size=small,colframe=red!50!black,colback=red!10!white]
\tcbitem One
\tcbitem Two
\tcbitem[add to width=-3cm] Three
\tcbitem[add to width=-3cm] Four
\tcbitem[add to width=-3cm] Five
\tcbitem[add to width=3cm] Six
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster reset}{}{no value}
Sets all raster settings back to their default values.
Note that \refKey{/tcb/reset} does not execute this option.
Style settings like \refKey{/tcb/raster odd column} etc. are not
touched by \refKey{/tcb/raster reset}.
\end{docTcbKey}
\subsection{Adding Styles for Specific Boxes}\label{subsec:raster_styles}
The following styles can be defined to address certain boxes inside
a \emph{raster}. Note that such style definitions are not removed by
\refKey{/tcb/reset} or \refKey{/tcb/raster reset}.
The style definitions are used in the order given below.
\begin{docTcbKey}[][doc new=2014-11-24]{raster every box}{}{style}
This style is used for every box.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster odd column}{}{style}
This style is used for every box in an odd column.
\begin{dispExample}
\begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
raster odd column/.style={colframe=blue!50!black,colback=blue!10!white}]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster even column}{}{style}
This style is used for every box in an even column.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster column n}{}{style}
This style is used for every box in the |n|-th column.
|n| has to be replaced by a number.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster odd row}{}{style}
This style is used for every box in an odd row.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster even row}{}{style}
This style is used for every box in an even row.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster row m}{}{style}
This style is used for every box in the |m|-th row.
|m| has to be replaced by a number.
\begin{dispExample}
\begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
raster row 2/.style={colframe=blue!50!black,colback=blue!10!white}]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster odd number}{}{style}
This style is used for every box with an odd number.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster even number}{}{style}
This style is used for every box with an even number.
\begin{dispExample}
\begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
raster columns=3,
raster even number/.style={colframe=blue!50!black,colback=blue!10!white}]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\tcbitem Five
\tcbitem Six
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster row m column n}{}{style}
This style is used for the box in the
|m|-th row and |n|-th column.
|m| and |n| have to be replaced by numbers.
\end{docTcbKey}
\begin{docTcbKey}[][doc new=2014-11-10]{raster number n}{}{style}
This style is used for the box with number |n|.
|n| has to be replaced by a number.
\begin{dispExample}
\begin{tcbitemize}[size=small,colframe=red!50!black,colback=red!10!white,
raster number 4/.style={colframe=blue!50!black,colback=blue!10!white}]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\subsection{Combining Columns or Rows}\label{subsec:raster_multicolrow}
\begin{docTcbKey}[][doc new=2016-02-19]{raster multicolumn}{=\meta{number}}{no default, initially unset}
This option has to be set inside the option list of a \refEnv{tcolorbox}
inside a \refEnv{tcbraster} or inside \refCom{tcbitem} inside \refEnv{tcbitemize}.
It merges the given \meta{number} of boxes into one single box
on the same line. The resulting box gets the \docAuxCommand{thetcbrasternum}
of the first box.
If there are not enough boxes available on the current line, this option
is ignored and a warning is given.
\begin{dispExample}
\begin{tcbitemize}[raster equal height=rows,raster columns=3,
title=\thetcbrasternum,colframe=red!50!black,colback=red!10!white]
\tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=1]
multicolumn=1
\tcbitem
\tcbitem
\tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2]
multicolumn=2
\tcbitem
\tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=3]
multicolumn=3
\tcbitem
\tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2]
multicolumn=2
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\begin{docTcbKey}[][doc new=2016-02-19]{raster multirow}{=\meta{number}}{no default, initially unset}
This option has to be set inside the option list of a \refEnv{tcolorbox}
inside a \refEnv{tcbraster} or inside \refCom{tcbitem} inside \refEnv{tcbitemize}.
This option not really merges boxes, but simply sizes the current box to fit
the space of \meta{number} rows.
\begin{marker}
\refKey{/tcb/raster multirow} needs \refKey{/tcb/raster height} to be set.
How to achieve a similar result for boxes without fixed \refKey{/tcb/raster height}
is shown afterwards.
\end{marker}
\begin{dispExample}
\begin{tcbitemize}[raster rows=3,raster columns=3,raster height=6cm,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem
\tcbitem
\tcbitem
\tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multirow=2]
multirow=2
\tcbitem[raster multicolumn=2,raster multirow=2,blankest]
\begin{tcbitemize}[raster rows=2,raster columns=2,raster height=\tcbtextheight]
\tcbitem
\tcbitem
\tcbitem
\tcbitem
\end{tcbitemize}
\end{tcbitemize}
\end{dispExample}
\clearpage
For rasters without fixed \refKey{/tcb/raster height}, \refKey{/tcb/raster multirow}
cannot be used. Note that \refCom{tcbtextheight} also cannot be used like
in the previous example.
But, with combination of \refKey{/tcb/raster equal height} and
\refKey{/tcb/space to}, a similar effect can be created:
\begin{dispExample}
\begin{tcbitemize}[raster columns=3,raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem
\tcbitem
\tcbitem
\tcbitem[colframe=blue!50!black,colback=blue!10!white]
\lipsum[2]
\tcbitem[raster multicolumn=2,blankest,space to=\myspace]
\begin{tcbitemize}[raster columns=2]
\tcbitem This is a box of the inner raster.
\tcbitem
\tcbitem[height=\myspace]
\tcbitem[height=\myspace]
\end{tcbitemize}
\end{tcbitemize}
\end{dispExample}
\end{docTcbKey}
\clearpage
\subsection{Rasters inside Rasters}\label{subsec:raster_insideraster}
A \emph{raster} inside a \emph{raster} cannot be used directly, because
a \emph{raster} can only contain a \emph{tcolorbox} or something
derived from a \emph{tcolorbox}. So, a \emph{raster} can be put inside
a \emph{tcolorbox} inside a \emph{raster}.
Some examples for such constructions can be found at \refEnv{tcboxedraster},
\refKey{/tcb/raster multicolumn},
\refKey{/tcb/raster multirow}.
\subsubsection{Raster Setup}
The intermediating \refEnv{tcolorbox} can be made invisible by using
\refKey{/tcb/blankest}.
\begin{dispExample}
\begin{tcbraster}[raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\begin{tcolorbox}[blankest]
\begin{tcbraster}[raster columns=1]
\begin{tcolorbox}One\end{tcolorbox}
\begin{tcolorbox}Two\end{tcolorbox}
\end{tcbraster}
\end{tcolorbox}
\begin{tcolorbox}raster+tcolorbox+raster\end{tcolorbox}
\end{tcbraster}
\end{dispExample}
\enlargethispage*{1cm}
\begin{dispExample}
\begin{tcbraster}[raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\begin{tcboxedraster}[raster columns=1]{blankest}
\begin{tcolorbox}One\end{tcolorbox}
\begin{tcolorbox}Two\end{tcolorbox}
\end{tcboxedraster}
\begin{tcolorbox}raster+tcboxedraster\end{tcolorbox}
\end{tcbraster}
\end{dispExample}
\begin{dispExample}
\begin{tcbitemize}[raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem[blankest]
\begin{tcbitemize}[raster columns=1]
\tcbitem One
\tcbitem Two
\end{tcbitemize}
\tcbitem tcbitemize+tcbitem+tcbitemize
\end{tcbitemize}
\end{dispExample}
\subsubsection{Placing Spaces}
If the heights of boxes inside staggered rasters should be matched, the
space has to be distributed accordingly.
\begin{itemize}
\item For fixed height boxes/rasters using \refKey{/tcb/raster height},
the height of boxes is available by \refCom{tcbtextheight}. This can be
used to size deeper layered boxes/rasters.
\item For boxes/rasters layed out using \refKey{/tcb/raster equal height},
space can be distributed by \refKey{/tcb/space to}.
It can take several compilations until all spaces are distributed correctly.
\end{itemize}
\begin{dispExample}
\begin{tcbitemize}[raster rows=2,raster height=6cm,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem[blankest]
\begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
\tcbitem One
\tcbitem Two
\end{tcbitemize}
\tcbitem This is a fixed height box.
\tcbitem Three
\tcbitem Four
\end{tcbitemize}
\end{dispExample}
\begin{dispExample}
\begin{tcbitemize}[raster columns=4,raster rows=4,raster height=0.8\linewidth,
raster every box/.style={size=small,beamer,
colframe=blue!75!yellow,colback=red!75!yellow!20,
center title,title=Box}]
\tcbitem One
\tcbitem Two
\tcbitem Three
\tcbitem Four
\tcbitem[raster multirow=2,blankest]
\begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
\tcbitem Twelve
\tcbitem Eleven
\end{tcbitemize}
\tcbitem[raster multirow=2,raster multicolumn=2,
colframe=red!75!yellow,colback=blue!75!yellow!20]
This is an example with fixed height boxes.
\tcbitem[raster multirow=2,blankest]
\begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight]
\tcbitem Five
\tcbitem Six
\end{tcbitemize}
\tcbitem Ten
\tcbitem Nine
\tcbitem Eight
\tcbitem Seven
\end{tcbitemize}
\end{dispExample}
\begin{dispExample}
\begin{tcbitemize}[raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem[blankest,space to=\myspace]
\begin{tcbitemize}[raster columns=1]
\tcbitem One
\tcbitem[add to natural height=\myspace]
This box will adapt its height.
\end{tcbitemize}
\tcbitem This is a flexible height box.
\tcbitem \lipsum[4]
\tcbitem[blankest,space to=\myspace]
\begin{tcbitemize}[raster columns=1]
\tcbitem One
\tcbitem[add to natural height=\myspace]
This box will adapt its height.
\end{tcbitemize}
\end{tcbitemize}
\end{dispExample}
\begin{dispExample}
\begin{tcbitemize}[raster equal height=rows,
raster every box/.style={colframe=red!50!black,colback=red!10!white}]
\tcbitem[blankest,space to=\myspace]
\begin{tcbitemize}[raster columns=1]
\tcbitem One
\tcbitem[add to natural height=\myspace]
This box will adapt its height.
\tcbitem \lipsum[4]
\end{tcbitemize}
\tcbitem[blankest,space to=\myspace]
\begin{tcbitemize}[raster columns=1]
\tcbitem[blankest]\includegraphics[width=\linewidth]{goldshade.png}
\tcbitem[add to natural height=\myspace]
This box will adapt its height.
\end{tcbitemize}
\end{tcbitemize}
\end{dispExample}
|