2

I would like to be able to format my proof "like a horizontal tree". And because pictures are better than words, here is what I would like to do :

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.
□

So the idea is to indent the proof within several levels to always be clear about what we are proving, and show the indentation with a vertical border on the left. The result should looks like what you got when you enter in a While/If block within the algorithm2e package (but of course I don't want the If/While words):

Algorithm1e display

Thank you for your help !

  • Welcome! Take a look at the LaTeX for Logicians website to see if something there meets your needs. Or post what you have so far if you are stuck. But this is very similar to the way a certain style of formal proof is laid out. Hence, I'd think looking there likely to be of more help than the typesetting of algorithms. But maybe you've tried it and I'm mistaken. – cfr Oct 13 '16 at 22:58
  • Thank you for your response. However I tried, but it's not really what I'm looking for. However I found a solution in mdframed, it works pretty well, even if I'm not sure it's the best way to proceed. – tobiasBora Oct 13 '16 at 23:04
  • I was more thinking of how they did it than precisely what they did. It is just a patterning, basically. But so long as you've found a solution, all's well. If you are happy with it, post it as an answer. If you are really asking whether it is a good way to do it or you're not happy with it, edit it into your question and explain the problem. – cfr Oct 13 '16 at 23:17
  • Well, the solution is ok for me, except a small bug of alignment that I cannot solve... – tobiasBora Oct 13 '16 at 23:20
2

One solution I found is to use the mdframed package (very complete package and documentation !), and create a special box for that. Here is an example :

\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}

Which gives : enter image description here

Their is an alignment problem if you do not set \setlength{\parindent}{0cm} (which I always do anyway). If you use one, I don't know if it's possible to detect if their is only one line in the above paragraph, so I would use two environments with one containing leftmargin=0.7cm...

  • You really have to set the left margin if you want one since the default is zero. Essentially, you are putting a box inside a list and alignment and spacing is always a bit tricky in that kind of case. As I tried to suggest above, a tabular might work here, but that would be a different approach. Also, I guess we don't know enough about things such as page breaking. Is it OK for the whole thing to be a box or not? That kind of thought .... – cfr Oct 13 '16 at 23:32
  • I'm not sure how you would use tabular here... After the spacing came from paragraph alignment, so I set it to 0 and now it's allright. And I do want that the boxed can take several pages, that's why mdframed is great. – tobiasBora Oct 13 '16 at 23:44
  • Off-topic: In the context of your text, "proof" is a noun; the corresponding verb is spelled "prove". Thus, do write "To prove the big theorem, we first need to prove XXX", etc. – Mico Oct 14 '16 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.