我定义了一个用于证明的案例环境。通常,我发现嵌套案例的缩进会增加。我觉得这给文本留下的空间太小了。我在某处看到用垂直线可视化的嵌套,我尝试实现它。
最后的代码基本达到了预期的效果(我使用的tcolorbox
版本3.21
):
- 为什么创建的文档第一页几乎是空白的?
- 定义这样的案例环境(而不是例如
\newtheorem
或)有什么缺点吗description
?
\documentclass{article}
\usepackage{amsthm,thmtools,amsmath}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\tcbuselibrary{breakable}
\newtcolorbox{tcbcase}[1][]{%
empty,
title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
coltitle=black,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
breakable,pad at break=0mm,
overlay ={\draw[gray,line width=1pt]
([yshift=-1pt]frame.north west) -- (frame.south west);
},%
}
\newtcolorbox{tcbsubcase}[1][]{%
empty,
title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
coltitle=black,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
breakable,pad at break=0mm,
overlay ={\draw[gray,line width=1pt]
([yshift=-1pt]frame.north west) -- (frame.south west);
},%
}
\newtcolorbox{tcbsubsubcase}[1][]{%
empty,
title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
coltitle=black,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
breakable,pad at break=0mm,
overlay ={\draw[gray,line width=1pt]
([yshift=-1pt]frame.north west) -- (frame.south west);
},%
}
\begin{document}
\begin{proof}
\begin{tcbcase}[Case $\phi = \mathit{true}$]
\lipsum[1]
\begin{tcbsubcase}[Case $\phi = P$]
\lipsum[1]
\begin{tcbsubsubcase}[Case $\phi = \lnot P$]
\lipsum[3]
\end{tcbsubsubcase}
\lipsum[1]
\end{tcbsubcase}
\end{tcbcase}
\end{proof}
\end{document}