3

How can I replicate these two results?

enter image description here

enter image description here

Thanks

Schwale
  • 2,049

1 Answers1

11

A version with tcolorbox and overlay option, providing two different options, the lamp and the fading circle of circles is drawn with TikZ.

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[most]{tcolorbox}

\usepackage[tikz]{bclogo}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{fadings}

\usepackage{blindtext}
\usepackage{XCharter}
\usepackage[T1]{fontenc}

\definecolor{titlegrammar}{RGB}{255,128,0}

\newtcolorbox{learnthis}[2][]{%
  breakable,
  enhanced jigsaw,
  coltitle={titlegrammar},
  fonttitle={\bfseries\large},
  title={\MakeUppercase{Learn this!}},
  attach title to upper={{~\bfseries\large #2}\par},
  colframe=titlegrammar,
  colback=titlegrammar!03,
  interior style={left color=titlegrammar!10, right color=titlegrammar!10,middle color=titlegrammar!03},
  overlay={%
    \draw[titlegrammar,line width=1.5pt,fill=titlegrammar!10,] ($(interior.north west) + (-0.02pt,-1cm)$) arc [start angle=90,end angle=270,radius=0.5cm] node[midway,right] (lamp) {\bclampe};
  },
  #1%
}

\definecolor{recyclecolor}{named}{Orchid}


\newtcolorbox{recyclebox}[2][]{%
  breakable,
  enhanced jigsaw,
  coltitle={recyclecolor},
  fonttitle={\bfseries\large},
  title={\MakeUppercase{Recycle!}},
  attach title to upper={{~\itshape\bfseries\large #2}\par},
  colframe=recyclecolor,
  colback=recyclecolor!03,
  interior style={left color=recyclecolor!10, right color=recyclecolor!10,middle color=recyclecolor!03},
  overlay={%
    \draw[recyclecolor,line width=1.5pt,fill=recyclecolor!10,] ($(interior.north west) + (-0.02pt,-1cm)$) arc [start angle=90,end angle=270,radius=0.5cm] node[midway] (dottedcircle) {};
    \foreach \x in {1,...,12} {%
      \draw[fill,opacity=1.0*(\x/12),recyclecolor] ($(dottedcircle)+ (0.5cm-0.02pt,0)+(120+\x*30:0.3cm)$) circle (0.04cm);
    };
  },
  #1%
}




\begin{document}

\begin{learnthis}{Past Tense}
\blindtext
\end{learnthis}


\begin{recyclebox}{There is and There are}
\blindtext
\end{recyclebox}


\end{document}

enter image description here

Update with option keys

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[most]{tcolorbox}

\usepackage[tikz]{bclogo}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{fadings}

\usepackage{blindtext}
\usepackage{XCharter}
\usepackage[T1]{fontenc}

\definecolor{recyclecolor}{named}{Goldenrod1}

\makeatletter

\tcbset{%
  decoration downshift/.store in={\decoration@downshift},
  decoration radius/.store in={\decoration@radius},
  decoration recycle radius/.store in={\decoration@recyclecircleradius},
  decoration dot radius/.store in={\decoration@dotradius},
  decoration content/.store in={\decoration@content},
  decoration colour/.store in={\decoration@colour},
}

\tcbset{recyclebox/.style={decoration radius=0.5cm,decoration downshift=-0.5cm}}

\tcbset{learnthisbox/.style={%
    decoration radius=0.5cm,
    decoration downshift=-0.5cm,
    decoration content={\bclampe},
    decoration colour=blue}
}


\newtcolorbox{recyclebox}[2][]{%
  recyclebox,
  decoration recycle radius={0.6*\decoration@radius},
  decoration dot radius={0.04*\decoration@radius},
  breakable,
  enhanced jigsaw,
  leftrule=1.5pt,
  colframe=recyclecolor,
  colback=tcbcol@frame!10,
  coltitle={tcbcol@frame},
  fonttitle={\bfseries\large},
  title={\MakeUppercase{Recycle!}},
  attach title to upper={{~\itshape\bfseries\large #2}\par},
  interior style={left color=tcbcol@back, right color=tcbcol@back,middle color=tcbcol@back!03},
  underlay unbroken and first={%
    \draw[tcbcol@frame,line width=\kvtcb@left@rule,fill=tcbcol@back] ($(frame.north west) + (\kvtcb@left@rule-0.03pt,\decoration@downshift)$) arc [start angle=90.0,end angle=270.0,radius=\decoration@radius] node[midway,inner sep=0pt] (dottedcircle) {};
    \foreach \x in {1,...,12} {%
      \draw[fill=tcbcol@back,opacity=1.0*(\x/12),tcbcol@frame] ($(dottedcircle) + (\decoration@radius,0cm)+(120+\x*30:\decoration@recyclecircleradius)$) circle (\decoration@dotradius);
    };
  },
  #1%
}


\newtcolorbox{learnthis}[2][]{%
  learnthisbox,
  breakable,
  enhanced jigsaw,
  leftrule=1.5pt,
  fonttitle={\bfseries\large},
  title={\MakeUppercase{Learn This!}},
  attach title to upper={{~\bfseries\large #2} \par},
  #1,
  interior style={left color=tcbcol@back, right color=tcbcol@back,middle color=tcbcol@back!03},
  underlay unbroken and first={%
    \draw[tcbcol@frame,line width=\kvtcb@left@rule,fill=tcbcol@back] ($(frame.north west) + (\kvtcb@left@rule-0.03pt,\decoration@downshift)$) arc [start angle=90.0,end angle=270.0,radius=\decoration@radius] node[midway,right] (dottedcircle) {\decoration@content};
  },
  % Something to be set after #1 has been red!
  colframe=\decoration@colour,
  colback=\decoration@colour!10,
  coltitle={tcbcol@frame},
}

\makeatother




\begin{document}

\begin{learnthis}[decoration content={\bccrayon}]{Past Tense}
\blindtext
\end{learnthis}


\begin{learnthis}[decoration colour=green]{Past Tense}
\blindtext
\end{learnthis}


\begin{recyclebox}[decoration radius={0.4cm},decoration dot radius=0.03cm]{There is and There are}
\blindtext[2]
\end{recyclebox}


\end{document}

enter image description here

See Changing colour border for a similar follow-up question.

  • Beautiful! Thanks a lot! Can you check my edited post? I have a new question. – Schwale Apr 03 '17 at 18:44
  • 3
    @Ustanak -- If you have a new question, it is better to ask a new question in a new post (and link back to this question/answer). Otherwise the current answer risks being irrelevant to the 'updated' question, which is somewhat unfair to the answerer, who has invested time and effort to answer the original question. – jon Apr 03 '17 at 19:02
  • @jon Thanks. I didn't do it because I though it was worthless. – Schwale Apr 03 '17 at 23:08
  • 2
    +1. Hi Christian for your excellent work. I vote always Christian :-) – Sebastiano Apr 04 '17 at 08:06