我正在尝试克隆上图所示的框。但是我无法复制标题框的样式。标题框位于框内,但我不知道如何将其放在框中。我该如何解决这个问题?
\documentclass[a4paper]{memoir}
\usepackage[most]{tcolorbox}
\usepackage{amsmath,amssymb}
\newtcolorbox{opening}[1][]{
boxsep=1mm,
left=1mm,
sharp corners,
colback=green!15!white,
fonttitle=\bfseries\sffamily,
colbacktitle=green!65!black, enhanced,
title=OPENING PROBLEM,
frame hidden,#1}
\newenvironment{thinkabout}{Things to think about:\begin{enumerate}}{\end{enumerate}}
\begin{document}
\begin{opening}
The population of rodents on an island is currently $500$. Its graowth rate is expected to be given by $\dfrac{dP}{dt}=0.1P\left( 1-\dfrac{P}{3000} \right) $, where $t$ is the time in years from now.
\begin{thinkabout}
\item How would we describe the relationship between the variables $P$ and $t$ ?
\item What would the graph of $P$ against $t$ look like?
\item How can we write $P$ as a function of $t$?
\item Can you find:
\begin{enumerate}
\item the expected population after $8 $ years
\item the expected time taken for the population to increase to $2000$
\item the maximum population which the island can sustain?
\end{enumerate}
\end{thinkabout}
\end{opening}
\end{document}
答案1
不要隐藏框架,而是使其与背景颜色相同,标题看起来就像在框内一样:
\documentclass[a4paper]{memoir}
\usepackage[most]{tcolorbox}
\usepackage{amsmath,amssymb}
\newtcolorbox{opening}[1][]{
boxsep=1mm,
left=1mm,
sharp corners,
colback=green!15!white,
fonttitle=\bfseries\sffamily,
colbacktitle=green!65!black, enhanced,
title=OPENING PROBLEM,
colframe=green!15!white,
boxrule=5pt,titlerule=5pt,
,#1}
\newenvironment{thinkabout}{Things to think about:\begin{enumerate}}{\end{enumerate}}
\begin{document}
\begin{opening}
The population of rodents on an island is currently $500$. Its graowth rate is expected to be given by $\dfrac{dP}{dt}=0.1P\left( 1-\dfrac{P}{3000} \right) $, where $t$ is the time in years from now.
\begin{thinkabout}
\item How would we describe the relationship between the variables $P$ and $t$ ?
\item What would the graph of $P$ against $t$ look like?
\item How can we write $P$ as a function of $t$?
\item Can you find:
\begin{enumerate}
\item the expected population after $8 $ years
\item the expected time taken for the population to increase to $2000$
\item the maximum population which the island can sustain?
\end{enumerate}
\end{thinkabout}
\end{opening}
\end{document}