4

I don't have much experience in creating environments, and my understanding of them allows me to create environments which do something at the beginning and at the end (like for instance, in a "proof" environment, I can begin it with "Proof." and end it with a little square in the bottom right.

What I want to do now is slighty more complicated (so it seems to me), I just want something looking like

Proof.
|
|
| content here
|
|
| end of proof

I want those vertical dashes to be a straight line from bottom to top. Any way I could be able to do that?

Werner
  • 603,163
  • 1
    I think you'll be able to find a solution using mdframed, since it allows even for page breaking and setting particular borders. In that regard, see Double vertical bars alongside statements of theorems. – Werner Mar 08 '13 at 18:14
  • @Werner It's a good start, but the problem is that instead of putting a line where the text should be and pushing the text to the right, it puts a line to the left of the text, which is not quite what I want to do. Do you think we could tweak it so that it works? – Patrick Da Silva Mar 08 '13 at 18:23
  • Yes, things can be modified. In your image, it shows that you have the vertical rule flush with the left margin and the content here pushed to the right. That's exactly what the link does (see the image in the linked answer when you add some text before/after the theo environment). You don't want that? – Werner Mar 08 '13 at 18:39
  • @Werner : I tried what the link said, and it compiled well, but the vertical rule is to the left of the left margin, and the text is where it would've been if I had done nothing particular. It doesn't show as in the image, although if for instance I would remove the "bottomline=false,...," part of the code, it would surround the whole text with a box. – Patrick Da Silva Mar 08 '13 at 18:41
  • Should I modify the position of the left margin inside the environment to fix the problem? (I don't know how to do that by the way, that's why I ask.) – Patrick Da Silva Mar 08 '13 at 18:46
  • OH!!! Nevermind, it works. It's just because I was comparing the margins with the wrong things ; I had only written environment titles when I was testing environment, and all the titles were a little bit flushed to the right... gave me an illusion. It does work! Great thanks. (I'd be happy to accept your answer if you posted it.) – Patrick Da Silva Mar 08 '13 at 18:57

1 Answers1

7

Here is a slight modification of Double vertical bars alongside statements of theorems to accommodate for the layout of your proof environment:

enter image description here

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}% http://ctan.org/pkg/mdframed
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\newtheorem{theorem}{Theorem}
\newenvironment{proof}
  {\par\noindent\normalfont\textbf{Proof.}\par\nopagebreak%
  \begin{mdframed}[
     linewidth=1pt,
     linecolor=black,
     bottomline=false,topline=false,rightline=false,
     innerrightmargin=0pt,innertopmargin=0pt,innerbottommargin=0pt,
     innerleftmargin=1em,% Distance between vertical rule & proof content
     skipabove=.5\baselineskip
   ]}
  {\end{mdframed}}

\begin{document}

\lipsum[1]

\begin{theorem}
\lipsum[1]
\begin{proof}
\lipsum[2-4]
\end{proof}
\end{theorem}
\lipsum[1]

\end{document}

Margin adjustments in mdframed allows for a block that spans page breaks. See the mdframed documentation for more options (including colours, if needed).

Since you're using a vertical rule to define the scope of the proof environment, I don't think it's necessary to add anything else.

Werner
  • 603,163