您amsthm
可以轻松更改定理前后的空间。这可以用tcolorbox
定理来实现吗?如果可以,怎么做?我在文档中找不到任何内容。
最小示例:
\documentclass{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}
\begin{document}
Add space below this text.
\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number.
\end{mytheo}
Add space above this text.
\end{document}
答案1
before skip
并after skip
提供这样的空间。如果空间太小,你就不会注意到它们。
\documentclass{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries,before
skip=20pt plus 2pt,after skip=20pt plus 2pt}{th}
\begin{document}
Add space below this text.
\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number.
\end{mytheo}
Add space above this text.
\end{document}
答案2
before
和after
选项对您有用吗?它们在章节中进行了解释4.15 融入周围环境,第 75 页。
\documentclass{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries, before={\vspace{2cm}}, after={\vspace{1cm}}}{th}
\begin{document}
Add space below this text.
\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number.
\end{mytheo}
Add space above this text.
\end{document}