## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Add a Frame to a Proof

Information and discussion about graphics, figures & tables in LaTeX documents.
TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm

### Add a Frame to a Proof

Hey,

In university I learned to write theorems and proofs as shown in the attached picture. Now I started typing my own lecture notes and was wondering how one could accomplish such a "frame" around the edges of the proof.

Thanks for your help.
Attachments
theorem-frame.jpg (49.4 KiB) Viewed 5584 times
Last edited by localghost on Wed Feb 13, 2013 11:22 am, edited 1 time in total.
Reason: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.

Tags:

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
I'd do this kind of things with mdframed. when used with framemethod=tikz the corners of the environment can be accessed with TikZ. Details on the package can be read in the documentation (mdframed).

\documentclass{article} \usepackage{amsmath,amsthm}% upright instead of italic text in the theorem:% \theoremstyle{definition}% new theorem:\newtheorem{thm}{Theorem} % closed box instead of open box for the qed symbol:\newcommand*\closedbox{%   \leavevmode\hbox to.77778em{\hfil\rule{.675em}{.675em}\hfil}}\let\qedsymbol\closedbox  \usepackage[framemethod=tikz]{mdframed}% new mdframed style that places the edges at the corners:\mdfdefinestyle{proof}{   skipabove         = .5\baselineskip ,   skipbelow         = .5\baselineskip ,   leftmargin        = 0pt ,   rightmargin       = 0pt ,   innermargin       = 0pt ,   innertopmargin    = .5em ,   innerleftmargin   = .5em ,   innerrightmargin  = 0pt ,   innerbottommargin = 0pt ,   hidealllines      = true ,   singleextra       = {     \draw (O) -- ++(0,.675em) (O) -- ++(.675em,0) ;     \draw (P-|O) -- ++(0,-.675em) (P-|O) -- ++(.675em,0) ;   },   firstextra        = {     \draw (P-|O) -- ++(0,-.675em) (P-|O) -- ++(.675em,0) ;   },   secondextra       = {     \draw (O) -- ++(0,.675em) (O) -- ++(.675em,0) ;   },}% put the new mdframed style around the proof environment:\surroundwithmdframed[style=proof]{proof} \usepackage{lipsum}% dummy text \begin{document}     \begin{thm}  \lipsum[2]\end{thm} \begin{proof}  \lipsum[2]\end{proof} \end{document}

proof.png (46.46 KiB) Viewed 5578 times

Regards
site moderator & package author

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm
Thanks a lot for your reply. But is there an equivalent for Miktex?

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
TesTT wrote:But is there an equivalent for Miktex?

I don't understand... why would it be any different with MiKTeX than any other TeX distribution? This code is independent of the TeX distribution as long it is up to date (and possibly complete).

Regards
site moderator & package author

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm
Well, I received the following error messages when I tried your code. Hence I assumed it could only be used with certain latex libraries (since you mentioned TikZ). :/
Attachments
tex_error_screen.jpg (182.99 KiB) Viewed 5546 times

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
I guess you need to update your distribution. The current version of mdframed is 1.6d. Yours seems to be too old (can't say definitely -- you should be able to find the information in the log file, though).

Regards
site moderator & package author

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm
Thanks for the tip. It works perfectly now.

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm
Just one little additional question: how can i indent the text after the first line (as shown in the screenshot), i.e. keep the red-shaded areas clear of any text?
Attachments
indent.jpg (61.48 KiB) Viewed 5538 times