我希望能够将我的证明格式化为“水平树”。由于图片胜于文字,因此我想这样做:
Proof :
To prove the big theorem, we first
need to prove that XXX:
| To prove XXX, let's begin to prove
| YYY:
| | YYY is trivial when you consider the
| | lemma 42, which is usable because of
| | the hypothesis 1.0. So YYY is true!
| Now, we would like also the property ZZZ
| Let's proove it !
| | To prove ZZZ, we can build a path and "paf !"
| | ZZZ becomes trivial !
| Let's now notice that applying YYY inside the
| | property YYY will let us conclude on the
| | validity of XXX.
□
因此,我们的想法是将证明缩进几个级别,以便始终清楚我们要证明什么,并在左侧用垂直边框显示缩进。结果应该看起来像您在 While/If 块中输入时得到的结果algorithm2e 包(但我当然不想要 If/While 字):
感谢您的帮助 !
编辑
请参阅这个更现代的答案以获得半工作解决方案在跨越多页的文本左侧添加边框
答案1
我发现的一个解决方案是使用 mdframed 包(非常完整的包和文档!),并为此创建一个特殊的框。以下是示例:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{enumitem} % To avoid "Too deeply nested error"
\usepackage{mdframed}
% For the subproof
\newmdenv[linecolor=black
,topline=false
,bottomline=false
,rightline=false
,leftline=true
,leftmargin=0.1cm
,linewidth=0.02cm
,skipabove=0cm
,innerbottommargin=0.05cm
,skipbelow=0.05cm
]{subproof}
% Avoid alignement problem
\setlength{\parindent}{0cm}
% For the theorem environment
\declaretheorem[name=Theorem]{theorem}
\begin{document}
\begin{theorem}[My great theorem]
Hello, here is the best theorem ever
\end{theorem}
\begin{proof}
Let's begin the proof !
To prove the big theorem, we first need to prove XXX:
\begin{subproof}
To prove XXX, let's begin to prove YYY:
\begin{subproof}
YYY is trivial when you consider the lemma 42, which is usable because of the hypothesis 1.0. So YYY is true!
\end{subproof}
Now, we would like also the property ZZZ
Let's prove it !
\begin{subproof}
To prove ZZZ, we can build a path and "paf !" ZZZ becomes trivial !
\end{subproof}
Which ends the proof of XXX.
\end{subproof}
\end{proof}
\end{document}
如果不设置,就会出现对齐问题\setlength{\parindent}{0cm}
(我反正总是设置)。如果使用一个,我不知道是否可以检测上面的段落中是否只有一行,所以我会使用两个环境,其中一个包含leftmargin=0.7cm
...
此外,它对长达数页的证明也存在问题......