0% found this document useful (0 votes)
80 views2 pages

TColorBox Properties Explained

The document describes three useful macros for tcolorbox: \tcbheightspace holds the space difference between a forced box height and the natural height, and can be used in skins or overlays but not inside the box content. \tcbtextwidth describes the box content width or combined text width for sidebyside boxes, and can be used inside the box content and in skins/overlays. \tcbtextheight describes the designated box content height, is usable inside the box content only for boxes with a fixed height, and can be used in skins/overlays.

Uploaded by

jimusos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views2 pages

TColorBox Properties Explained

The document describes three useful macros for tcolorbox: \tcbheightspace holds the space difference between a forced box height and the natural height, and can be used in skins or overlays but not inside the box content. \tcbtextwidth describes the box content width or combined text width for sidebyside boxes, and can be used inside the box content and in skins/overlays. \tcbtextheight describes the designated box content height, is usable inside the box content only for boxes with a fixed height, and can be used in skins/overlays.

Uploaded by

jimusos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

9.

Useful Properties

The following macros describe certain properties which may be used for the drawing scheme, see
Section 9.4 on page 133. Sometimes, they are even available inside the box content. All of them
are considered to be read-only and should never be redefined by the user.
N 2016-02-16

\tcbheightspace
If the height of a tcolorbox is not the natural height, the space difference between the
forced and the natural size is hold by \tcbheightspace. This macro is not usable inside
the box content, but for skins or inside /tcb/underlay P. 186 , /tcb/overlay P. 69 , etc.
If such a space information is needed inside the box content, see /tcb/space to P. 57
instead.
% \tcbuselibrary{skins}
\newtcolorbox{testbox}[2][]{enhanced,size=fbox,
colframe=blue!75!black,colback=white,height=#2,
underlay={\node[above,inner sep=3pt] at (interior.south){%
\includegraphics[width=\tcbtextwidth,height=\tcbheightspace-3pt]{goldshade.png}};
},
#1}
\begin{testbox}{3cm}
This is my box. The space is filled with a picture.
\end{testbox}
\begin{testbox}{2cm}
This is my box. The space is filled with a picture.
\end{testbox}
This is my box. The space is filled with a picture.

This is my box. The space is filled with a picture.

N 2016-02-16

\tcbtextwidth
This property describes the box content width.
If there also is a lower part, it describes the width of the upper part.
For /tcb/sidebyside P. 108 boxes, it describes the combined text width plus segmentation.
This property can be used inside the box content text with exception of /tcb/fit P. 382
boxes.
\tcbtextwidth can be used for all box types for skins or inside /tcb/underlay P. 186 ,
/tcb/overlay P. 69 , etc.
\begin{tcolorbox}[colframe=blue!75!black]
Inside a box: \tcbtextwidth\ (=\the\linewidth).
\end{tcolorbox}

Inside a box: 370.74823pt (=370.74823pt).

137

N 2016-02-16

\tcbtextheight
This property describes the designated box content height. If the box is larger than the
natural height, the actual content will be smaller than \tcbtextheight.
For boxes with a fixed /tcb/height P. 52 , this property can be used inside the box
content text. For other boxes, it denotes 0pt inside the box content.
\tcbtextheight can be used for all box types for skins or inside /tcb/underlay P. 186 ,
/tcb/overlay P. 69 , etc.
% \tcbuselibrary{skins}
\begin{tcolorbox}[enhanced,colframe=blue!75!black,
underlay={\node[left,red] at (frame.east) {Here: \tcbtextheight};}]
Inside a box with natural height: \tcbtextheight.
\end{tcolorbox}
\begin{tcolorbox}[enhanced,colframe=blue!75!black,height=1cm,
underlay={\node[left,red] at (frame.east) {Here: \tcbtextheight};}]
Inside a box with fixed height: \tcbtextheight.
\end{tcolorbox}

Inside a box with natural height: 0pt.

Here: 7.95pt

Inside a box with fixed height: 8.5359pt.

Here: 8.5359pt

138

You might also like