我想这是你想要的...其实没必要在tcb外面封装成amsthm(这让代码变得很不优雅,既然amsthm要套tcb),tcb
本身也支持计数器的使用,著名的elegantbook模板的fancy样式对定理环境的实现也只是纯tcolorbox
。我同时还把mwe更精简了一丢丢...
P.S. xparse
已经进入latex kernel
,因此不需显式调用。你可以texdoc xparse
看看参数,lshort-zh-cn
其实有简单的介绍,所谓的\NewTColorBox
也不过是tcb
版本的newenvironment
而已。
\documentclass[10pt]{ctexbook}
\usepackage[margin=1in,showframe]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{varwidth}
\usepackage{amsmath}
\usepackage{enumitem}
\setlist[enumerate]{leftmargin=1em}
\definecolor{mygreen}{RGB}{0,166,82}
\NewTColorBox[auto counter,number within=section]{theobox}{O{}}{% o省略可能的参数
enhanced,frame empty,interior empty,
coltitle=white,fonttitle=\bfseries,
colbacktitle=mygreen,rounded corners,
extras broken={frame empty,interior empty},
borderline={0.25mm}{0mm}{mygreen},
breakable,top=4mm,before skip=3.5mm,
attach boxed title to top left={yshift=-3mm,xshift=5mm},boxed title style={boxrule=0pt,sharp corners=all},varwidth boxed title,
title={考点\thetcbcounter\quad{#1}},
}
\newcommand*{\insertxt}{%
\begin{enumerate}
\item 素质教育以提高国民素质为根本宗旨。
\item 素质教育是面向全体学生的教育。
\item 素质教育是促进学生全面地、生动活泼地、可持续地发展的教育。
\item 素质教育是促进学生个性发展的教育。
\item 素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。
\end{enumerate}
}
\begin{document}
\chapter{你好}
\section{世界}
\begin{theobox}
\insertxt
\end{theobox}
\begin{theobox}[有标题]
\insertxt
\end{theobox}
\section{世界}
\begin{theobox}[有标题盒子]
\insertxt
\end{theobox}
\begin{theobox}
\insertxt
\end{theobox}
\chapter{你好}
\section{世界}
\begin{theobox}[有标题盒子]
\insertxt
\end{theobox}
\begin{theobox}
\insertxt
\end{theobox}
\begin{theobox}[有标题盒子]
\insertxt
\end{theobox}
\begin{theobox}
\insertxt
\end{theobox}
\end{document}
问 把3个参数的tcolorbox和newdocumentenvironment换成2个参数