| 1 |
% !TeX root = tcolorbox.tex |
| 2 |
% include file of tcolorbox.tex (manual of the LaTeX package tcolorbox) |
| 3 |
\clearpage |
| 4 |
\section{Library \mylib{magazine}}\label{sec:magazine}% |
| 5 |
\tcbset{external/prefix=external/magazine_}% |
| 6 |
\newboxarray{myarticle} |
| 7 |
|
| 8 |
\begin{tcolorbox}[ |
| 9 |
enhanced jigsaw, |
| 10 |
size=small,width=6cm, |
| 11 |
title=Example Article, |
| 12 |
fonttitle=\bfseries,center title, |
| 13 |
fontupper=\small, |
| 14 |
%height fixed for=first and middle, |
| 15 |
watermark text=\arabic{tcbbreakpart}, |
| 16 |
breakable, |
| 17 |
break at=8.5\baselineskip/9\baselineskip, |
| 18 |
reset and store to box array=myarticle, |
| 19 |
colframe=green!50!black, |
| 20 |
colback=green!10, |
| 21 |
pad at break=5mm, |
| 22 |
] |
| 23 |
This is an example for an article which starts right here and |
| 24 |
is continued to the following pages. |
| 25 |
The body text for the article is written inside a single |
| 26 |
|tcolorbox|. This box is split into parts using the tools from |
| 27 |
this section, namely \refKey{/tcb/reset and store to box array} |
| 28 |
with a new box array |myarticle| which was created by |
| 29 |
|\newboxarray{myarticle}|. |
| 30 |
|
| 31 |
The resulting parts are distributed throughout this |
| 32 |
\zvref{sec:magazine} using \refCom{consumetcboxarray} |
| 33 |
at the appropriate places you see. |
| 34 |
The linking texts like \emph{continued on page x} are created |
| 35 |
by \refKey{/tcb/finish} commands for the embedding \refCom{tcbox}. |
| 36 |
To label the box parts, \refKey{/tcb/phantomlabel} is used. |
| 37 |
|
| 38 |
These quite small partial boxes are for demonstration purposes. |
| 39 |
With the tools of this section, a magazine type document could be |
| 40 |
created, but this still needs a lot of manual control. |
| 41 |
\end{tcolorbox} |
| 42 |
|
| 43 |
\newtcolorbox{articleside}[1][]{blanker,sidebyside,sidebyside gap=5mm,sidebyside align=top seam, |
| 44 |
parbox=false,righthand width=6cm, |
| 45 |
goto/.style={finish={\node[above=-2pt,color=green!50!black] at (frame.south) |
| 46 |
{\slshape\scriptsize --- continued on page~\hypersetup{linkcolor=green!50!black}\pageref{myarticle-##1}\ \textcolor{green!50!black}{---}};}}, |
| 47 |
from/.style={finish={\node[below=-1pt,color=green!50!black] at (frame.north) |
| 48 |
{\slshape\scriptsize --- continued from page~\hypersetup{linkcolor=green!50!black}\pageref{myarticle-##1}\ \textcolor{green!50!black}{---}};}}, |
| 49 |
#1} |
| 50 |
|
| 51 |
\begin{articleside}[after skip=6pt] |
| 52 |
The main purpose of this library is to store a |tcolorbox| into an array |
| 53 |
of box registers for later usage. |
| 54 |
|
| 55 |
If the |tcolorbox| is not breakable, there is not much add-on |
| 56 |
compared to usual \TeX/\LaTeX\ box storage and usage (and you do not really need this |
| 57 |
library for that use case). |
| 58 |
For a breakable |tcolorbox|, this library allows to capture all partial boxes |
| 59 |
into a sequence of registers. The partial boxes can be used anywhere in |
| 60 |
arbitrary order. |
| 61 |
\tcblower\consumetcboxarray[myarticle]{1}{blanker,nobeforeafter,phantomlabel=myarticle-one,goto=two} |
| 62 |
\end{articleside} |
| 63 |
|
| 64 |
The name of this library indicates \emph{magazine} in the sense of storage, |
| 65 |
but also in the sense of a journal where an article often is \emph{continued on page x}. |
| 66 |
An example for this kind of application is given throughout this section starting |
| 67 |
on the right hand side. The creation of this library was motivated by |
| 68 |
Ulrike Fischer and Steven B.~Segletes. |
| 69 |
|
| 70 |
The library is loaded by a package option or inside the preamble by: |
| 71 |
\begin{dispListing} |
| 72 |
\tcbuselibrary{magazine} |
| 73 |
\end{dispListing} |
| 74 |
This also loads the library \mylib{breakable}, see \zvref{sec:breakable}. |
| 75 |
|
| 76 |
\begin{marker} |
| 77 |
The box register operations of this library are global. \TeX\ grouping will |
| 78 |
not clear the registers when leaving the current group. Also be aware that |
| 79 |
extensive use of large box arrays may eat up \TeX's available memory and |
| 80 |
registers. |
| 81 |
\end{marker} |
| 82 |
|
| 83 |
\subsection{Creation and Resetting of Box Arrays}\label{subsec:magazine_creation} |
| 84 |
|
| 85 |
\begin{docCommand}[doc new=2015-07-13]{newboxarray}{\marg{name}} |
| 86 |
This creates a new box array called \meta{name}. There already is a |
| 87 |
box array available with name |default| which can be used directly. |
| 88 |
Note that the creation is a global operation. |
| 89 |
\begin{dispListing} |
| 90 |
\newboxarray{myarray} |
| 91 |
\end{dispListing} |
| 92 |
\end{docCommand} |
| 93 |
|
| 94 |
|
| 95 |
\begin{docCommand}[doc new=2015-07-13]{boxarrayreset}{\oarg{name}} |
| 96 |
Resets the size counter of a box array \meta{name} to zero. |
| 97 |
If \meta{name} is not provided, |default| is used as name. |
| 98 |
Use this or \refKey{/tcb/reset box array} before |
| 99 |
you apply \refKey{/tcb/store to box array}. Otherwise, all boxes would |
| 100 |
be appended to the already existing boxes. |
| 101 |
This command does not clear box registers. |
| 102 |
\begin{dispListing} |
| 103 |
\boxarrayreset % resets `default' |
| 104 |
\boxarrayreset{myarray} % resets `myarray' |
| 105 |
\end{dispListing} |
| 106 |
\end{docCommand} |
| 107 |
|
| 108 |
\enlargethispage*{20mm} |
| 109 |
|
| 110 |
\begin{docTcbKey}[][doc new=2015-07-13]{reset box array}{\colOpt{=\meta{name}}}{default |default|, initially unset} |
| 111 |
Resets the size counter of a box array \meta{name} to zero. |
| 112 |
Use this or \refCom{boxarrayreset} (which does the same) before |
| 113 |
you apply \refKey{/tcb/store to box array}. |
| 114 |
\begin{dispListing} |
| 115 |
\tcbset{ |
| 116 |
reset box array, % resets `default' |
| 117 |
reset box array=myarray, % resets `myarray' |
| 118 |
} |
| 119 |
\end{dispListing} |
| 120 |
\end{docTcbKey} |
| 121 |
|
| 122 |
\clearpage |
| 123 |
\begin{docCommand}[doc new=2015-07-13]{boxarrayclear}{\oarg{name}} |
| 124 |
Works like \refCom{boxarrayreset} to reset the size counter of a |
| 125 |
box array \meta{name} to zero. Additionally, all allocated box registers |
| 126 |
of the box array are cleared of their content. |
| 127 |
Note that the allocated box registers stay allocated. So, this may be |
| 128 |
useful to clear memory, but not to free registers for other applications. |
| 129 |
If \refCom{consumeboxarray} or \refCom{consumetcboxarray} was used to |
| 130 |
apply the stored boxes, there is no advantage in using \refCom{boxarrayclear}. |
| 131 |
\begin{dispListing} |
| 132 |
\boxarrayclear % clears `default' |
| 133 |
\boxarrayclear[myarray] % clears `myarray' |
| 134 |
\end{dispListing} |
| 135 |
\end{docCommand} |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
\subsection{Storing Content}\label{subsec:magazine_storing} |
| 140 |
|
| 141 |
\begin{docTcbKey}[][doc new=2015-07-13]{store to box array}{\colOpt{=\meta{name}}}{default |default|, initially unset} |
| 142 |
Stores a |tcolorbox| or all parts of a break sequence of a |tcolorbox| into |
| 143 |
a box array \meta{name}. If no \meta{name} is given, the already existing |default| |
| 144 |
box array is used. Otherwise, the box array has to be created beforehand |
| 145 |
with \refCom{newboxarray}. Note that the box has to be \refKey{/tcb/breakable}, |
| 146 |
if the box shall break into several parts. |
| 147 |
Typically, manual break points are additionally defined by \refKey{/tcb/break at}. |
| 148 |
Otherwise, the box parts will have a length of about |\textheight|. |
| 149 |
For most use cases, a \refKey{/tcb/reset box array} should be applied |
| 150 |
to reset the box array counter.\enlargethispage*{2cm} |
| 151 |
|
| 152 |
\begin{exdispExample}{storetoboxarray_1} |
| 153 |
% \usepackage{lipsum} |
| 154 |
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=4cm, |
| 155 |
colback=yellow!10,colframe=yellow!10!black, |
| 156 |
enforce breakable,% use only breakable in the real world! |
| 157 |
break at=7cm/4cm, |
| 158 |
height fixed for=all, |
| 159 |
watermark text=\arabic{tcbbreakpart}, |
| 160 |
reset box array, |
| 161 |
store to box array |
| 162 |
] |
| 163 |
\lipsum[1] |
| 164 |
\end{tcolorbox} |
| 165 |
|
| 166 |
\useboxarray{1}\hfill |
| 167 |
\begin{tabular}[b]{cc} |
| 168 |
\multicolumn{2}{c}{\includegraphics[width=7cm]{Basilica_5.png}}\\ |
| 169 |
\useboxarray{2} & \useboxarray{3} |
| 170 |
\end{tabular} |
| 171 |
\end{exdispExample} |
| 172 |
|
| 173 |
\clearpage |
| 174 |
If the first box part should fill the rest of the available space of |
| 175 |
the current page, you can use |\pagegoal-\pagetotal| minus some distance for |
| 176 |
the first element of \refKey{/tcb/break at}. You may want to have some |
| 177 |
additional distance to the preceding text. |
| 178 |
|
| 179 |
\begin{dispListing} |
| 180 |
% \usepackage{lipsum} |
| 181 |
\begin{tcolorbox}[enhanced,breakable, |
| 182 |
reset box array, |
| 183 |
store to box array, |
| 184 |
break at=\pagegoal-\pagetotal-5mm/0pt, |
| 185 |
height fixed for=first and middle] |
| 186 |
\lipsum[1-15] |
| 187 |
\end{tcolorbox}% |
| 188 |
% |
| 189 |
\consumetcboxarray{1}{blanker,before=\par\vfill\noindent} |
| 190 |
\end{dispListing} |
| 191 |
|
| 192 |
|
| 193 |
\begin{exdispExample}{storetoboxarray_2} |
| 194 |
\begin{tcolorbox}[blanker,width=4cm, |
| 195 |
fontupper=\footnotesize, |
| 196 |
enforce breakable,% use only breakable in the real world! |
| 197 |
break at=4cm, |
| 198 |
height fixed for=all, |
| 199 |
watermark text=\arabic{tcbbreakpart}, |
| 200 |
reset box array, |
| 201 |
store to box array |
| 202 |
] |
| 203 |
\includegraphics[width=\linewidth]{Basilica_5.png}\par |
| 204 |
\lipsum[1-2] |
| 205 |
\end{tcolorbox} |
| 206 |
|
| 207 |
\begin{tcbitemize}[raster columns=3,raster equal height, |
| 208 |
size=small,halign=center,sharp corners,colback=blue!5] |
| 209 |
\tcbitem\consumeboxarray{5} |
| 210 |
\tcbitem\consumeboxarray{6} |
| 211 |
\tcbitem\consumeboxarray{1} |
| 212 |
\tcbitem\consumeboxarray{2} |
| 213 |
\tcbitem\consumeboxarray{3} |
| 214 |
\tcbitem\consumeboxarray{4} |
| 215 |
\end{tcbitemize} |
| 216 |
\end{exdispExample} |
| 217 |
\end{docTcbKey} |
| 218 |
|
| 219 |
|
| 220 |
\begin{docTcbKey}[][doc new=2015-07-13]{reset and store to box array}{\colOpt{=\meta{name}}}{style, default |default|, initially unset} |
| 221 |
Combination of \refKey{/tcb/reset box array} and \refKey{/tcb/store to box array}. |
| 222 |
\end{docTcbKey} |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
\begin{docTcbKey}[][doc new=2015-07-13]{do not store to box array}{}{style, no default, initially set} |
| 227 |
Disables the \refKey{/tcb/store to box array} option, if set before. |
| 228 |
\end{docTcbKey} |
| 229 |
|
| 230 |
|
| 231 |
\begin{docEnvironment}[doc new=2015-07-13]{boxarraystore}{\marg{name}} |
| 232 |
Stores the environment content into a box array \meta{name}. |
| 233 |
This corresponds to the standard \LaTeX\ environment |lrbox|, but |
| 234 |
the storage operation is global. As long as \refCom{boxarrayreset} is |
| 235 |
not used, every new \refEnv{boxarraystore} adds a further box to |
| 236 |
the array. |
| 237 |
|
| 238 |
\begin{dispExample} |
| 239 |
\boxarrayreset |
| 240 |
\begin{boxarraystore}{default}\fbox{Mary}\end{boxarraystore} |
| 241 |
\begin{boxarraystore}{default}\fbox{Had}\end{boxarraystore} |
| 242 |
\begin{boxarraystore}{default}\fbox{a}\end{boxarraystore} |
| 243 |
\begin{boxarraystore}{default}\fbox{Little}\end{boxarraystore} |
| 244 |
\begin{boxarraystore}{default}\fbox{Lamb}\end{boxarraystore} |
| 245 |
\useboxarray{5}\useboxarray{4}\useboxarray{3}\useboxarray{2}\useboxarray{1}\hfill |
| 246 |
\useboxarray{1}\useboxarray{5} |
| 247 |
\end{dispExample} |
| 248 |
\end{docEnvironment} |
| 249 |
|
| 250 |
\subsection{Retrieving Content}\label{subsec:magazine_retrieve} |
| 251 |
|
| 252 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygetsize}{\oarg{name}\marg{macro}} |
| 253 |
\begin{articleside}[before skip=5pt] |
| 254 |
Stores the current size of a box array \meta{name} into a given \meta{macro}. |
| 255 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 256 |
\begin{dispExample} |
| 257 |
\boxarraygetsize{\mysize} |
| 258 |
Current size of the default box array: |
| 259 |
\mysize. |
| 260 |
\end{dispExample} |
| 261 |
\tcblower\consumetcboxarray[myarticle]{2}{blanker,nobeforeafter,phantomlabel=myarticle-two,from=one,goto=three} |
| 262 |
\end{articleside} |
| 263 |
\end{docCommand} |
| 264 |
|
| 265 |
\begin{docCommand}[doc new=2015-07-13]{useboxarray}{\oarg{name}\marg{index}} |
| 266 |
Typesets the box with the given \meta{index} number from the box array \meta{name}. |
| 267 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 268 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 269 |
It is silently ignored, if the \meta{index} is out of range. |
| 270 |
Note that \refCom{useboxarray} corresponds to the standard |\usebox| macro, |
| 271 |
respectively, |\copy|. |
| 272 |
\begin{dispExample} |
| 273 |
\boxarraygetsize{\mysize} |
| 274 |
\foreach \n in {1,...,\mysize} { \useboxarray{\n} } |
| 275 |
\end{dispExample} |
| 276 |
\end{docCommand} |
| 277 |
|
| 278 |
\clearpage |
| 279 |
\begin{docCommand}[doc new=2015-07-13]{usetcboxarray}{\oarg{name}\marg{index}\marg{options}} |
| 280 |
Typesets the box with the given \meta{index} number from the box array \meta{name} |
| 281 |
using \refCom{useboxarray} as content of a \refCom{tcbox}. |
| 282 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 283 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 284 |
It is silently ignored, if the \meta{index} is out of range. |
| 285 |
The \refCom{tcbox} can be customized by |tcolorbox| \meta{options}. |
| 286 |
\begin{dispExample} |
| 287 |
\boxarraygetsize{\mysize} |
| 288 |
\foreach \n in {1,...,\mysize} { \usetcboxarray{\n}{on line,colframe=yellow, |
| 289 |
colback=yellow!10} } |
| 290 |
\end{dispExample} |
| 291 |
\end{docCommand} |
| 292 |
|
| 293 |
|
| 294 |
\begin{docCommand}[doc new=2015-07-13]{consumeboxarray}{\oarg{name}\marg{index}} |
| 295 |
Typesets the box with the given \meta{index} number from the box array \meta{name}. |
| 296 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 297 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 298 |
It is silently ignored, if the \meta{index} is out of range. |
| 299 |
In contrast to \refCom{useboxarray}, |
| 300 |
\refCom{consumeboxarray} corresponds to the standard |\box| macro, i.\,e., |
| 301 |
after typesetting the box register is cleared and cannot be used again. |
| 302 |
\begin{dispExample} |
| 303 |
\boxarraygetsize{\mysize} |
| 304 |
First run: \foreach \n in {1,...,\mysize} { \consumeboxarray{\n} } |
| 305 |
\par |
| 306 |
Second run: \foreach \n in {1,...,\mysize} { \consumeboxarray{\n} } |
| 307 |
\end{dispExample} |
| 308 |
\end{docCommand} |
| 309 |
|
| 310 |
|
| 311 |
\begin{docCommand}[doc new=2015-07-13]{consumetcboxarray}{\oarg{name}\marg{index}\marg{options}} |
| 312 |
\begin{articleside}[before skip=5pt] |
| 313 |
Typesets the box with the given \meta{index} number from the box array \meta{name} |
| 314 |
using \refCom{consumeboxarray} as content of a \refCom{tcbox}. |
| 315 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 316 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 317 |
It is silently ignored, if the \meta{index} is out of range. |
| 318 |
The \refCom{tcbox} can be customized by |tcolorbox| \meta{options}. |
| 319 |
After typesetting the box register is cleared and cannot be used again. |
| 320 |
\tcblower\consumetcboxarray[myarticle]{3}{blanker,nobeforeafter,phantomlabel=myarticle-three,,from=two,goto=four} |
| 321 |
\end{articleside} |
| 322 |
\begin{exdispExample}{consumetcboxarray} |
| 323 |
% \usepackage{lipsum} |
| 324 |
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=6cm, |
| 325 |
colback=yellow!10,colframe=yellow!10!black, |
| 326 |
enforce breakable,% use only breakable in the real world! |
| 327 |
break at=5cm, |
| 328 |
watermark text=\arabic{tcbbreakpart}, |
| 329 |
reset and store to box array |
| 330 |
] |
| 331 |
\lipsum[1] |
| 332 |
\end{tcolorbox} |
| 333 |
|
| 334 |
\consumeboxarray{2} \hfill \consumeboxarray{1} \hfill \consumeboxarray{1} |
| 335 |
\end{exdispExample} |
| 336 |
\end{docCommand} |
| 337 |
|
| 338 |
|
| 339 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygetbox}{\oarg{name}\marg{macro}\marg{index}} |
| 340 |
Assigns the box with the given \meta{index} number from the box array \meta{name} |
| 341 |
to a \meta{macro}. |
| 342 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 343 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 344 |
If the \meta{index} is out of range, the \meta{macro} will be undefined. |
| 345 |
\begin{exdispExample}{boxarraygetbox} |
| 346 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 347 |
reset and store to box array]{Test} |
| 348 |
|
| 349 |
\boxarraygetsize{\mysize} Array size: \mysize |
| 350 |
|
| 351 |
\boxarraygetbox{\mybox}{1} |
| 352 |
Box width: \the\wd\mybox |
| 353 |
\quad\usebox{\mybox} |
| 354 |
\end{exdispExample} |
| 355 |
\end{docCommand} |
| 356 |
|
| 357 |
|
| 358 |
\begin{docCommand}[doc new=2017-06-27]{ifboxarrayempty}{\oarg{name}\marg{index}\marg{true}\marg{false}} |
| 359 |
Tests the box with the given \meta{index} number from the box array \meta{name} |
| 360 |
for emptiness be empty and executes \meta{true} if it is empty, and \meta{false} otherwise. |
| 361 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 362 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 363 |
\begin{exdispExample}{ifboxarrayempty} |
| 364 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 365 |
reset and store to box array]{Test} |
| 366 |
|
| 367 |
\ifboxarrayempty{1}{no Box~1}{Box~1: \useboxarray{1}}, |
| 368 |
\ifboxarrayempty{2}{no Box~2}{Box~2: \useboxarray{2}} |
| 369 |
\end{exdispExample} |
| 370 |
\end{docCommand} |
| 371 |
|
| 372 |
|
| 373 |
\clearpage |
| 374 |
\subsection{Box Dimensions}\label{subsec:magazine_dimensions} |
| 375 |
|
| 376 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygetwidth}{\oarg{name}\marg{macro}\marg{index}} |
| 377 |
Assigns the width of the box with the given \meta{index} number from the box array \meta{name} |
| 378 |
to a \meta{macro}. |
| 379 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 380 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 381 |
If the \meta{index} is out of range, the \meta{macro} will be set to |0pt|. |
| 382 |
\begin{exdispExample}{boxarraygetwidth} |
| 383 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 384 |
reset and store to box array]{Test} |
| 385 |
|
| 386 |
\begin{tabular}{ll} |
| 387 |
\useboxarray{1} & width of box 1: \boxarraygetwidth{\mylen}{1} \mylen\\ |
| 388 |
\useboxarray{2} & width of box 2: \boxarraygetwidth{\mylen}{2} \mylen |
| 389 |
\end{tabular} |
| 390 |
\end{exdispExample} |
| 391 |
\end{docCommand} |
| 392 |
|
| 393 |
|
| 394 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygetheight}{\oarg{name}\marg{macro}\marg{index}} |
| 395 |
Assigns the height of the box with the given \meta{index} number from the box array \meta{name} |
| 396 |
to a \meta{macro}. |
| 397 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 398 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 399 |
If the \meta{index} is out of range, the \meta{macro} will be set to |0pt|. |
| 400 |
\begin{exdispExample}{boxarraygetheight} |
| 401 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 402 |
reset and store to box array]{Test} |
| 403 |
|
| 404 |
\begin{tabular}{ll} |
| 405 |
\useboxarray{1} & height of box 1: \boxarraygetheight{\mylen}{1} \mylen\\ |
| 406 |
\useboxarray{2} & height of box 2: \boxarraygetheight{\mylen}{2} \mylen |
| 407 |
\end{tabular} |
| 408 |
\end{exdispExample} |
| 409 |
\end{docCommand} |
| 410 |
|
| 411 |
|
| 412 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygetdepth}{\oarg{name}\marg{macro}\marg{index}} |
| 413 |
Assigns the depth of the box with the given \meta{index} number from the box array \meta{name} |
| 414 |
to a \meta{macro}. |
| 415 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 416 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 417 |
If the \meta{index} is out of range, the \meta{macro} will be set to |0pt|. |
| 418 |
\begin{exdispExample}{boxarraygetdepth} |
| 419 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 420 |
reset and store to box array]{Test} |
| 421 |
|
| 422 |
\begin{tabular}{ll} |
| 423 |
\useboxarray{1} & depth of box 1: \boxarraygetdepth{\mylen}{1} \mylen\\ |
| 424 |
\useboxarray{2} & depth of box 2: \boxarraygetdepth{\mylen}{2} \mylen |
| 425 |
\end{tabular} |
| 426 |
\end{exdispExample} |
| 427 |
\end{docCommand} |
| 428 |
|
| 429 |
|
| 430 |
\clearpage |
| 431 |
\begin{docCommand}[doc new=2015-07-13]{boxarraygettotalheight}{\oarg{name}\marg{macro}\marg{index}} |
| 432 |
\begin{articleside}[before skip=5pt] |
| 433 |
Assigns the total height of the box with the given \meta{index} number from the box array \meta{name} |
| 434 |
to a \meta{macro}. |
| 435 |
If no \meta{name} is given, the already existing |default| box array is used. |
| 436 |
It is considered an error, if a not existing box array \meta{name} is used. |
| 437 |
If the \meta{index} is out of range, the \meta{macro} will be set to |0pt|. |
| 438 |
\tcblower\consumetcboxarray[myarticle]{4}{blanker,nobeforeafter,phantomlabel=myarticle-four,from=three} |
| 439 |
\end{articleside} |
| 440 |
\begin{exdispExample}{boxarraygettotalheight} |
| 441 |
\boxarrayreset |
| 442 |
\tcbox[size=small,colframe=blue!20,colback=yellow!5,on line, |
| 443 |
store to box array]{Test} |
| 444 |
|
| 445 |
\begin{tabular}{ll} |
| 446 |
\useboxarray{1} & total height of box 1: \boxarraygettotalheight{\mylen}{1} \mylen\\ |
| 447 |
\useboxarray{2} & total height of box 2: \boxarraygettotalheight{\mylen}{2} \mylen |
| 448 |
\end{tabular} |
| 449 |
\end{exdispExample} |
| 450 |
\end{docCommand} |
| 451 |
|
| 452 |
\clearpage |
| 453 |
\subsection{Leaflet Example} |
| 454 |
The following full application example can be used to create leaflets. |
| 455 |
Obviously, the code can be adapted and customized in many ways. |
| 456 |
|
| 457 |
\begin{tcblisting}{ |
| 458 |
enhanced jigsaw,lower separated=false,breakable, |
| 459 |
listing style=mydocumentation,base example, |
| 460 |
listing and comment, |
| 461 |
pdf comment,freeze pdf, |
| 462 |
comment style={raster columns=1}, |
| 463 |
compilable listing, |
| 464 |
run pdflatex} |
| 465 |
\documentclass[a4paper,landscape]{article} |
| 466 |
\usepackage[noheadfoot,margin=0pt]{geometry} |
| 467 |
\usepackage[skins,raster,magazine]{tcolorbox} |
| 468 |
\usepackage{lipsum} |
| 469 |
|
| 470 |
\newenvironment{leaflet}[1][]{% |
| 471 |
\begin{tcolorbox}[nobeforeafter,empty,colback=white, |
| 472 |
sharp corners,size=minimal,left=10mm,right=10mm,top=10mm,bottom=10mm, |
| 473 |
width=\textwidth/3, |
| 474 |
breakable, |
| 475 |
break at=\textheight, |
| 476 |
height fixed for=all, |
| 477 |
reset box array, |
| 478 |
store to box array,#1]} |
| 479 |
{\end{tcolorbox}% |
| 480 |
\begin{tcbitemize}[raster columns=3,raster equal skip=0pt,blankest] |
| 481 |
\tcbitem\consumeboxarray{5} |
| 482 |
\tcbitem\consumeboxarray{6} |
| 483 |
\tcbitem\consumeboxarray{1} |
| 484 |
\tcbitem\consumeboxarray{2} |
| 485 |
\tcbitem\consumeboxarray{3} |
| 486 |
\tcbitem\consumeboxarray{4} |
| 487 |
\end{tcbitemize}% |
| 488 |
} |
| 489 |
|
| 490 |
\pagestyle{empty} |
| 491 |
\begin{document} |
| 492 |
|
| 493 |
\begin{leaflet}[underlay={\node[above=5mm,font=\footnotesize] |
| 494 |
at (frame.south) {- \arabic{tcbbreakpart} -};}] |
| 495 |
\includegraphics[width=\linewidth]{Basilica_5.png} |
| 496 |
\begin{center} |
| 497 |
\bfseries\LARGE Example |
| 498 |
\end{center} |
| 499 |
|
| 500 |
\section{Introduction} |
| 501 |
\lipsum[1] |
| 502 |
|
| 503 |
\section{Main Part A} |
| 504 |
\lipsum[2-8] |
| 505 |
|
| 506 |
\section{Main Part B} |
| 507 |
\lipsum[9-15] |
| 508 |
|
| 509 |
\section{Conclusion} |
| 510 |
\lipsum[16-18] |
| 511 |
\end{leaflet} |
| 512 |
|
| 513 |
\end{document} |
| 514 |
\end{tcblisting} |
| 515 |
|
| 516 |
|