1

I would like to reproduce the fancy box below.

enter image description here

I tried to adapt some codes from the manual Sec 10.2 and made adjustment as below.

\documentclass[openany]{book}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}
\newcommand*\mycirc[1]{%
\begin{tikzpicture}[baseline=(char.base)]
\node[shape=circle,fill=white,inner sep=1pt,minimum size=2ex](char) {#1}; 
\end{tikzpicture}}
\newtcolorbox[auto counter]{myex}[2]{ 
colback=white,
enhanced,
colframe=white,fonttitle=\Large\bfseries,
colbacktitle=purple,enhanced,
attach boxed title to top left={yshift=-2mm}, 
boxed title style={% 
enhanced,
colframe=purple,
colback=purple,
arc=12pt,
sharp corners, 
varwidth boxed title*=-3cm, 
rounded corners=west 
},
title= Example \mycirc{\textcolor{black}{\thetcbcounter}}, 
}
\begin{document}
\begin{myex}{SKILLS}{Problem-Solving}
The diameters of a metal pin produced by a 
\end{myex}
\end{document}

Resulting into

enter image description here

Any kind help is highly welcomed.

3
  • You could create a whole new environment in TikZ.
    – SebGlav
    Oct 2, 2021 at 18:41
  • @SebGlav any tip that will help me make sense of the design is much welcome.
    – Kidegalize
    Oct 4, 2021 at 10:32
  • Absolutely, see my answer below.
    – SebGlav
    Oct 4, 2021 at 15:18

1 Answer 1

3

A quick starting point on how to create a custom title with a counter. It's possible to do way better but you get the idea.

title model

\documentclass[12pt]{article}
\usepackage{tikz,lipsum}
\usetikzlibrary{shapes.symbols,positioning}

\newcounter{examp}
\setcounter{examp}{0}

\newcommand{\mytitle}[2]%
    {%
    \stepcounter{examp}
    \begin{tikzpicture}[font=\sffamily]
        \def\cola{pink!50!purple}
        \def\colb{cyan!80!blue}
        \node[circle,fill=\cola,minimum size=8mm] at (0,0) {};
        \node[fill=\cola,anchor=west,minimum height=8mm,minimum width=2cm] at (0,0) {};
        \node[fill=white,line width=2pt,circle,draw=\cola,minimum size=1cm] at (2.1,0) {\theexamp};
        \node[text=white,anchor=west] at (-0.2,0) {Example};
        \node[fill=\colb,signal,signal to=east,text=white,minimum height=8mm] (arg1) at (4,0) {#1};
        \node[right=2mm of arg1,\colb] (arg2) {#2};
    \end{tikzpicture}
    }

\begin{document}
    \mytitle{SKILLS}{PROBLEM-SOLVING}
    
    \lipsum[1]
    \medskip
    
    \mytitle{OTHER}{WHAT YOU NEED}
    
    \lipsum[2-3]
\end{document}
3
  • 1
    much respect for this nice Tikz
    – Kidegalize
    Oct 4, 2021 at 16:52
  • 1
    You're very welcome. It's just a raw code, and can be optimized.
    – SebGlav
    Oct 4, 2021 at 17:19
  • I approved your excellent code.
    – Sebastiano
    Oct 5, 2021 at 20:42

You must log in to answer this question.

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