[Tex/LaTex] Creating a particular environment with a left-side rule

environmentsrulestheorems

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?

Best Answer

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.