\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{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}
\end{document}
此代码显示:
我想要文字学习这个!以另一种字体(也是粗体)显示,例如我尝试过title={\MakeUppercase{\sf Learn This!}}
但是没有用。
答案1
只需添加\sffamily
到字体键,并使用具有粗体变体的 sans 字体:
\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\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{learnthis}[2][]{%
learnthisbox,
breakable,
enhanced jigsaw,
leftrule=1.5pt,
fonttitle={\sffamily\selectfont\bfseries\large},
title={\MakeUppercase{Learn This!}},
attach title to upper={{~\sffamily\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}
\end{document}