3

How can I replicate these two results?

enter image description here

enter image description here

Thanks

  • I think the way to go would be to define an environment for this purpose. A tool such as TikZ would likely be useful to draw and fill the boxes. Good luck ! – marsupilam Apr 2 '17 at 18:55
  • 1
    for example, with use of tcolorbox package. – Zarko Apr 2 '17 at 18:56
  • Also check this out – marsupilam Apr 2 '17 at 18:57
  • 1
    Darn ! If you could show us a MWE for what you tried, it would probably be easier to help. – marsupilam Apr 2 '17 at 19:13
  • 1
    @Ustanak: It's quite similar to your older question: tex.stackexchange.com/questions/292877/generating-grid-in-a-box – user31729 Apr 2 '17 at 19:57
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. – Alejandro Apr 3 '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 3 '17 at 19:02
  • @jon Thanks. I didn't do it because I though it was worthless. – Alejandro Apr 3 '17 at 23:08
  • 2
    +1. Hi Christian for your excellent work. I vote always Christian :-) – Sebastiano Apr 4 '17 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.