当我在可中断的 tcolorbox 中使用彩色文本 (textcolor) 时,分页后颜色会恢复为黑色。要在整个 tcolorbox 中都使用蓝色文本,必须进行哪些更改?
\documentclass[11pt,a4paper,oneside]{report}
\usepackage{color}
\usepackage{tcolorbox} % Frames
\tcbuselibrary{theorems}
\tcbuselibrary{breakable}
\usepackage{cleveref} % references in tcolorboxes
\usepackage{lipsum} % references in tcolorboxes
\newtcbtheorem[auto counter, number within = chapter,
crefname={beispiel}{example},
Crefname={Beispiel}{Example} ]
{Exa}{Beispiel}{%
breakable,
fonttitle = \bfseries,
colframe = green!35!black,
colback = green!5
}{exa}
\begin{document}
\begin{Exa}{Differenzialgleichung}{DGL}
\textcolor{blue}
{
\lipsum[1-10]
}
\end{Exa}
\end{document}
答案1
您可以使用字体颜色机制tcolorbox
并将其设置为exa
环境的可选参数:
\documentclass[11pt,a4paper,oneside]{report}
\usepackage{color}
\usepackage{tcolorbox} % Frames
\tcbuselibrary{theorems}
\tcbuselibrary{breakable}
\usepackage{cleveref} % references in tcolorboxes
\usepackage{lipsum} % references in tcolorboxes
\newtcbtheorem[auto counter, number within = chapter,
crefname={beispiel}{example},
Crefname={Beispiel}{Example} ]
{Exa}{Beispiel}{%
breakable,
fonttitle = \bfseries,
colframe = green!35!black,
colback = green!5
}{exa}
\begin{document}
\begin{Exa}[coltext=red]{Differenzialgleichung}{DGL}
\lipsum[1-10]
\end{Exa}
test
\end{document}