# Package for framed boxes

I saw the following framed box in a Tex-generated PDF and was wondering what package had been used to make it:

Does anybody recognize it?

• Tikz is perfectly able to do the job, but it's not the only one. – Alenanno Jun 6 '15 at 10:07
• Either mdframed or tcolorbox, I would say – user31729 Jun 6 '15 at 10:09

Here is a quick setup with tcolorbox, using the \newtcbtheorem macro, but it can done with a normal \newtcolorbox macro as well. The special title setup requires the skin library, which is included using most option.

I applied a \newtcolorbox approach as well, to show how the options of the boxes can be changed, contrary to \newtcbtheorem.

\documentclass{article}

\usepackage[most]{tcolorbox}

coltitle=black,
top=0.3in,
attach boxed title to top left=
{xshift=1.5em,yshift=-\tcboxedtitleheight/2},
boxed title style={size=small,colback=pink}
}{summary}

coltitle=black,
top=0.3in,
attach boxed title to top left=
{xshift=1.5em,yshift=-\tcboxedtitleheight/2},
boxed title style={size=small,colback=pink},#1}

\begin{document}

\begin{Summary}{}{firstsummary}
Brontosaurs are thin at one end, thick in the middle and thin again on the other end
\end{Summary}

\begin{summary}[boxed title style={colback=yellow},colback=green]
Everything needed to decrypt the drive data is stored on the drive itself. No secret is
present in the enclosure.

$\Rightarrow$ The attacker should be able to brute-force the PIN or extract the encryption key
only in software.
\end{summary}

\end{document}


• The colours don't match! (+1) – Alenanno Jun 6 '15 at 12:07
• @Alenanno: Yes, I wanted to exaggerate and to show the configurability of tcolorbox stuff – user31729 Jun 6 '15 at 12:08
• Ahah don't worry, that was tongue in cheek. :P – Alenanno Jun 6 '15 at 12:10
• colors don't bother me, but the extra space above the text does. please make it go away. – barbara beeton Jun 6 '15 at 17:11
• @barbarabeeton: The spacings can be controlled by the top and bottom options -- it's just an example, nothing I would use for myself. – user31729 Jun 6 '15 at 17:20

Here's a version with Tikz. The box is within the frame with a margin of 1mm on either side.

## Code

\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{lipsum}

\newcommand{\mybox}[4]{
\begin{figure}[h]
\centering
\begin{tikzpicture}
\node[anchor=text,text width=\columnwidth-1.2cm, draw, rounded corners, line width=1pt, fill=#3, inner sep=5mm] (big) {\\#4};
\node[draw, rounded corners, line width=.5pt, fill=#2, anchor=west, xshift=5mm] (small) at (big.north west) {#1};
\end{tikzpicture}
\end{figure}
}

\begin{document}
\lipsum*[1]

\mybox{Summary}{red!40}{red!10}{Everything needed to decrypt the drive data is stored on the drive itself. No secret is
present in the enclosure.}

\mybox{Summary 1}{green!40}{green!10}{This is a very different box... Well, ok, just the colour.}

\lipsum*[2]
\end{document}

• @Christian Hupfer's version is a more faithful reproduction of the original, however I do prefer yours from an aesthetic standpoint (spacing, shadows). Plus, tikz ;-) – lodhb Jun 7 '15 at 8:25
• @lodhb: The shadows are there, the spacings can be changed and tcolorbox is tikz ;-) – user31729 Jun 7 '15 at 8:49