\documentclass[12pt,a4paper]{report}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse}
\tcbset{%
colback=white,
tikz={opacity=0.1,transparency group},
colframe=black,
title filled=false,
% bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
auto counter,
number within=section
]{example}{ +O{}mo }{%
fonttitle = \bfseries,
breakable,
title = {Example~\thetcbcounter:~ #2},
before lower = {\textbf{Solution~\thetcbcounter:\quad}},
lowerbox = invisible, %invisible/ignored
% after title/after upper
IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
#1
}%
\begin{document}
\begin{example}
test
\end{example}
\end{document}
我该如何改变,以便我可以使用包breakable
中的功能tcolorbox
。
答案1
请将选项放入breakable
,\tcbuselibrary
例如
\tcbuselibrary{skins,xparse,breakable}
修改MWE
为:
\documentclass[12pt,a4paper]{report}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse,breakable}
\tcbset{%
colback=white,
tikz={opacity=0.1,transparency group},
colframe=black,
title filled=false
% bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
auto counter,
number within=section
]{example}{ +O{}mo }{%
fonttitle = \bfseries,
title = {Example~\thetcbcounter:~ #2},
before lower = {\textbf{Solution~\thetcbcounter:\quad}},
lowerbox = invisible, %invisible/ignored
% after title/after upper
IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
#1
}%
\begin{document}
\begin{example}
test
\end{example}
\end{document}