我的代码如下:
\documentclass{book}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}%
\begin{document}
\makeatletter
\newtheorem{definition}{Definition}%
\definecolor{colorthree}{cmyk}{0.16,0,0.06,0}%
\definecolor{shadestartcolor}{cmyk}{0.19,0,0.07,0.20}%
\newenvironment{defin}[1][26]{\bgroup%
\vspace{12\p@ plus3\p@ minus1\p@}%
\noindent\ignorespaces\begin{minipage}{\textwidth}%
\begin{tcolorbox}[enhanced, colback=colorthree, frame hidden,arc=6pt,
underlay vignette={draw method=clipped, size=3mm, semi fade in=shadestartcolor, east size=1.5mm, south size=1mm}]
\begin{definition}%
}{\end{definition}\end{tcolorbox}%
\end{minipage}%
\vspace{12\p@ plus3\p@ minus1\p@}%
\egroup}%
\makeatother
\begin{defin}
This is for test. This is for test. This is for test. This is for
test. This is for test. This is for test. This is for test. This is
for test.
\end{defin}
\end{document}
输出结果如下:
尽管我提到过frame hidden
我的实际要求如下所示:
答案1
为了避免边界,请添加boxrule=0pt
到tcolorbox
选项。
我不明白为什么你需要将其包含tcolorbox
在外部环境中,并包含在 中minipage
。tcolorbox
默认情况下, A 的宽度与 一样宽\textwidth
。有一个特殊的库theorems
,如果你不想使用它,命令\tcolorboxenvironment
可以将tcolorbox
方面添加到任何常规环境中。在下面的代码中,我声明了一个mydefinition
定理,其中应用了类似的 tcolorbox 参数。结果与不太复杂的代码类似。
\documentclass{book}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}%
\begin{document}
\makeatletter
\newtheorem{definition}{Definition}%
\newtheorem{mydefinition}{Definition}%
\definecolor{colorthree}{cmyk}{0.16,0,0.06,0}%
\definecolor{shadestartcolor}{cmyk}{0.19,0,0.07,0.20}%
\tcolorboxenvironment{mydefinition}{%
enhanced, colback=colorthree, frame hidden,arc=6pt,boxrule=0pt,
underlay vignette={draw method=clipped, size=3mm, semi fade in=shadestartcolor, east size=1.5mm, south size=1mm}}
\newenvironment{defin}[1][26]{\bgroup%
\vspace{12\p@ plus3\p@ minus1\p@}%
\noindent\ignorespaces\begin{minipage}{\textwidth}%
\begin{tcolorbox}[enhanced, colback=colorthree, frame hidden,arc=6pt,boxrule=0pt,
underlay vignette={draw method=clipped, size=3mm, semi fade in=shadestartcolor, east size=1.5mm, south size=1mm}]
\begin{definition}%
}{\end{definition}\end{tcolorbox}%
\end{minipage}%
\vspace{12\p@ plus3\p@ minus1\p@}%
\egroup}%
\makeatother
\begin{defin}
This is for test. This is for test. This is for test. This is for
test. This is for test. This is for test. This is for test. This is
for test.
\end{defin}
\begin{mydefinition}
This is for test. This is for test. This is for test. This is for
test. This is for test. This is for test. This is for test. This is
for test.
\end{mydefinition}
\end{document}