答案1
tcolorbox
带有和选项的版本overlay
,提供两种不同的选项,lamp
和渐变圆圈用 Ti 绘制钾Z。
\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}
使用选项键更新
\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@[email protected],\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@[email protected],\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}
看改变颜色边框类似的后续问题。