4

I'm trying to get a box style (more or less) like this:

Espected

But with the rounded edges and shadow (that image is my best effort with Gimp ...)

I've been trying to adapt an example of the tcolorbox documentation. This is my MWE:

\documentclass{standalone}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}

\begin{tcolorbox}[enhanced,title=Example 123,drop fuzzy shadow= lightgray,%
colframe=gray,colback=white,colbacktitle=white,fonttitle=\small\sffamily,boxrule=0.2mm,%
coltitle=black,attach boxed title to top right=
{yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},%
boxed title style={boxrule=0.2mm,drop fuzzy shadow= lightgray,%
frame code={ \path[tcb fill frame] ([xshift=-0mm]frame.west)
-- (frame.north west) -- (frame.north east) -- ([xshift=-2mm]frame.east)
-- (frame.south east) -- (frame.south west) -- cycle; },
interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)
-- (interior.north west) -- (interior.north east)
-- ([xshift=0mm]interior.east) -- (interior.south east) -- (interior.south west)
-- cycle;} }]
\lipsum[2]
\end{tcolorbox}

\end{document}

And that's what the output looks like: Current

It looks something (well, but, well away) like what I'm looking for. How do I get this box?

1 Answer 1

6

It might be the simplest to just draw everything with the frame code.

\documentclass[border=2mm]{standalone}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usetikzlibrary{calc}
\usepackage{lipsum}
\begin{document}

\begin{tcolorbox}[enhanced,title=Example 123,drop fuzzy shadow= lightgray,%
colframe=gray,colback=white,colbacktitle=white,fonttitle=\small\sffamily,
boxrule=0mm,%
coltitle=black,
attach boxed title to top right=
{yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},%
boxed title style={empty,arc=0pt,outer arc=0pt,boxrule=0pt},
frame code={
\draw[rounded corners=2pt,line width=0.4pt]  let \p1=($(title.north)-(frame.north)$) in
(title.north) --  (title.north west) -- ++ (-\y1+0.2pt,-\y1+0.2pt) -|
([xshift=-0.2pt,yshift=-0.2pt]frame.south west) -| ([xshift=0.2pt]frame.east)   |- ([xshift=1em]title.north) [rounded corners=0pt] -- cycle ;}]
\lipsum[2]
\end{tcolorbox}
\end{document}

enter image description here

1
  • 1
    You are the one, every time I see one of your answers you make things look very simple...Thanks again Apr 5, 2020 at 22:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .