我想创建如图所示的彩色盒子。有人能帮我吗
答案1
这是第一、第二和第五个框的一个选项。第三和第四个框的代码可以在以下位置找到:my answer
到创建一个彩色盒子?。
代码:
\documentclass{article}
\usepackage[many]{tcolorbox}
\definecolor{problemblue}{RGB}{100,134,158}
\definecolor{idiomsgreen}{RGB}{0,162,0}
\definecolor{exercisebgblue}{RGB}{192,232,252}
\newtcolorbox{idioms}{
breakable,
enhanced,
colback=white,
colframe=idiomsgreen,
arc=0pt,
outer arc=0pt,
title=Idioms,
fonttitle=\bfseries\sffamily\large,
colbacktitle=idiomsgreen,
attach boxed title to top left={},
boxed title style={
enhanced,
skin=enhancedfirst jigsaw,
arc=3pt,
bottom=0pt,
interior style={fill=idiomsgreen}
}
}
\newtcolorbox[auto counter,number within=section]{praproblem}{
breakable,
enhanced,
colback=white,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
title=Practice Problem~\thetcbcounter,
fonttitle=\bfseries\sffamily\large\strut,
coltitle=problemblue,
colbacktitle=problemblue,
title style={
left color=orange!60,
right color=white,
middle color=white
},
overlay={
\draw[line width=1.5pt,problemblue] (title.north west) -- (title.north east);
}
}
\newtcolorbox[auto counter,number within=section]{tcbexercise}{
breakable,
enhanced,
colback=white,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
title=Exercise~\thetcbcounter,
fonttitle=\bfseries\sffamily\large\strut,
coltitle=problemblue,
colbacktitle=problemblue,
title style={exercisebgblue},
overlay={
\draw[line width=1.5pt,problemblue] (frame.south west) -- (frame.south east);
}
}
\begin{document}
\section{A test section}
\begin{idioms}
Some test text.
\end{idioms}\par\bigskip
\begin{tcbexercise}
Some test text.
\end{tcbexercise}\par\bigskip
\begin{praproblem}
Some test text.
\end{praproblem}
\end{document}