I'm working with tcolorbox
to produce boxes and highlight answers to a document with questions.
The following MWE shows the box I created, separating the title into another box.
\documentclass[12pt]{article}
\usepackage[papersize={5.5in,8.5in},margin=1.5cm]{geometry}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc}
\tcbuselibrary{skins}
\newtcolorbox{resp}[1][]{%
enhanced jigsaw,%
colback=gray!20!white,%
colframe=gray!80!black,%
size=small,%
boxrule=1pt,%
title=\textbf{\textit{Answer}},%
halign title=flush center,%
coltitle=black,%
breakable,%
drop shadow=black!50!white,%
attach boxed title to top left={xshift=1cm,yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},%
minipage boxed title=3cm,%
boxed title style={%
colback=white,%
size=fbox,%
boxrule=1pt,%
boxsep=2pt,%
underlay={%
\coordinate (dotA) at ($(interior.west) + (-0.5pt,0)$);
\coordinate (dotB) at ($(interior.east) + (0.5pt,0)$);
\begin{scope}[gray!80!black]
\fill (dotA) circle (2pt);
\fill (dotB) circle (2pt);
\end{scope}
}%
},%
#1%
}
\begin{document}
\begin{resp}
An exciting text {\ttfamily:)}
\end{resp}
\vspace{1cm}
\begin{resp}[boxed title style={drop shadow=black!50!white}]
Another box with shadow {\ttfamily:/}
\end{resp}
\end{document}
Result of compiling the above code:
Thanks to the documentation, I could add a shadow to the text box (the one without the title), and as the second box shows, I could do the same with the second box. Unfortunately, the title box shadow overlaps with the text box, and I wanted it to be at the same level to the text box shadow (i.e. behind the text box).
How can I apply a shadow to both boxes as a group, so the shadows of both the title and the text box could be one, and behind the text box?
:(
tikzpicture
. Even if you applypgfonlayer
it will not help. But there is a workaround discussed in tex.stackexchange.com/questions/24140/…