%% Documentation of the package mdframed.sty \def\mdversion{version 0.4a} \documentclass[american,11pt]{article} \usepackage{geometry} \geometry{left=3cm,right=3cm,top=2cm,bottom=2cm} \usepackage{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \newif\ifmdframedcompile \mdframedcompiletrue %% use lucida als default \IfFileExists{lucidabr}{% \usepackage{textcomp} \ifmdframedcompile \usepackage[de,T1,altbullet]{lucidabr} \else \usepackage[T1,altbullet]{lucidabr} \fi }{% \usepackage[scaled]{libertine} } \newcommand{\origttfamily}{}% sollte noch nicht definiert sein! \let\origttfamily=\ttfamily % alte Definition von \ttfamily sichern \renewcommand{\ttfamily}{\origttfamily \hyphenchar\font=`\-} \usepackage{xcolor} \usepackage[babel]{microtype} \usepackage{array,tabularx} \usepackage{multirow} %%Load the the package itselfs \usepackage[style=1,leftmargin=20pt,rightmargin=20pt]{mdframed} \usepackage{lipsum} \usepackage{amsmath} \usepackage[amsmath,amsthm,hyperref]{ntheorem} \newtheorem{mdtheorem}{Theorem}[section] \newenvironment{theorem}{% \begin{mdframed}[leftmargin=20pt,rightmargin=20pt,linewidth=2,margin=40,backgroundcolor=yellow,linecolor=blue]% \begin{mdtheorem}% }{% \end{mdtheorem}% \end{mdframed}% } \newtheorem{mdlemma}{Lemma}[section] \newenvironment{ntheorem}{% \begin{mdframed}[ntheorem=true,leftmargin=20pt,rightmargin=40pt,linewidth=2,margin=40,backgroundcolor=yellow,linecolor=blue]% \begin{mdlemma}% }{% \end{mdlemma}% \end{mdframed}% } \definecolor{titleblue}{rgb}{0,0,0.9} \usepackage{listings} \lstnewenvironment{mdexample}[1][] {\lstset{% basicstyle=\small, xleftmargin=20pt, xrightmargin=20pt, frame=single, rulecolor=\color{titleblue}, framesep=5pt, framerule=1pt, language=[LaTeX]TeX,#1, columns=fixed, fontadjust=true,basewidth=0.5em,breakatwhitespace=true }} % morekeywords={\usepackage,\end,\begin,\lipsum,\documentclass,\newtheorem,\newenvironment,\section,\label\mbox{ }}}} {} \usepackage{hyperref} \hypersetup{% colorlinks=true, linkcolor=titleblue, urlcolor=titleblue, pdfauthor=Marco Daniel, pdftitle=Documentation of mdframed, plainpages=false } \usepackage{xspace} \usepackage{multicol} \columnseprule0.4pt \makeatletter \begingroup \text@command\relax \global\let\xspace@check@icr\check@icr \endgroup \xspaceaddexceptions{\xspace@check@icr} \renewcommand\tableofcontents{% \begin{multicols}{2}[\centering\textbf{\sffamily\Large\contentsname}] \@starttoc{toc} \end{multicols} } \makeatother \newcommand*\mdoption[1]{\textsf{\bfseries\color{titleblue}#1}} \newcommand*\mdname{\textsf{mdframed}\xspace} \newcommand*\mdpack[1]{\textsf{#1}\xspace} \newcommand*\mdsetting[1]{\textsf{#1}\xspace} \newcommand*\mdcommand[1]{\texttt{\textbackslash #1}\xspace} \setcounter{tocdepth}{1} \begin{document} \vspace*{\baselineskip} \begin{center} \color{titleblue} \Large\bfseries \sffamily The \mdname package\footnote{Extending the package \texttt{framed.sty}.} \vspace*{0.5\baselineskip} \normalfont\large\normalcolor auto-split frame environment \vspace*{.5\baselineskip} \href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}\footnote{With thanks to Heiko Oberdiek, Rolf Niepraschk, Martin Scharrer and Herbert Voss.}, \href{mailto:marco.daniel@mada-nada.de}{Elke Schubert}\qquad \mdversion\ \qquad \today \end{center} \begin{abstract} Working with the command \mdcommand{fbox} or \mdcommand{fcolorbox}, one has to handle page breaks by hand, meaning that you have to split up the \mdcommand{fbox} into two. The present package defines the environment \mdname which automatically deals with page breaks, whence the name \glqq breakable\grqq. By using \mdcommand{newenvironment} the user may choose between several individual designs. \end{abstract} \tableofcontents \section{Motivation} Many users wish to (further) emphasize lemmata, definitions, proofs etc.. The package mdframed allows to create environments with breakable frames. I think an example is the best way to demonstrate the properties. The following example gives an idea of how to use mdframed. (For the theorem environment we use the package \mdpack{amsthm}.) \begin{mdexample} \usepackage{mdframed,amsthm} \newtheorem{mdtheorem}{Theorem}[section] \newenvironment{theorem}{\begin{mdframed}% [linewidth=2,margin=40,backgroundcolor=yellow,linecolor=blue]% \begin{mdtheorem}}{\end{mdtheorem}\end{mdframed}} ... \begin{theorem}[Pythagorean theorem] In any right triangle, the area of the square whose side is the hypotenuse is equal to the sum of the areas of the squares whose sides are the two legs. \begin{equation} a^2+b^2=c^2 \end{equation} \end{theorem} \end{mdexample} \begin{theorem}[Pythagorean theorem] In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle). \begin{equation} a^2+b^2=c^2 \end{equation} \end{theorem} \section{Syntax} Load the package as usual: \begin{mdexample} \usepackage[]{mdframed} \end{mdexample} The package defines only one environment with the following syntax: \begin{mdexample} \begin{mdframed}[] \end{mdframed} \end{mdexample} \section{Options} The package allows to set global and local options which are explained below. \subsection{Global Options} The following options are only global options. \begin{center} \renewcommand{\arraystretch}{1.5} \begin{tabularx}{\linewidth}{@{}lXl@{}} \mdoption{xcolor}=& By setting this key, the package \mdpack{xcolor} will be loaded with the given value(s). Without any value \mbox{\mdname} loads the package \mdpack{color} without any options. & default=\mdsetting{none} \\ \mdoption{style}= & With this key you can change the way frames are drawn. By using \mdoption{style=0} the frames are drawn by the commands \mdcommand{vrule} and \mdcommand{rule}. By setting the key to \mdoption{style=1} the package \mdpack{tikz} will draw the frames. So you can manipulate the frames more comfortably with options like \mdoption{roundcorner} (see below). & default=\mdsetting{0} \\ \end{tabularx} \end{center} By setting one of these options locally, you get a warning like \begin{mdexample} Option `...' is already consumed(mdframed) and has no effect on input line ... \end{mdexample} \clearpage \subsection{Global and Local Options} The options listed below can be set globally or locally. \begin{center} \renewcommand{\arraystretch}{1.5} \begin{tabularx}{\linewidth}{@{}lXl@{}} \mdoption{skipabove}=& Sets an additional skip above the frame. & default=\mdsetting{0pt} \\ \mdoption{skipbelow}=& Sets an additional skip below the frame. & default=\mdsetting{0pt} \\ \mdoption{linecolor}= & Sets the color of the line around the environment to . & default=\mdsetting{black} \\ \mdoption{backgroundcolor}= & Sets the color of the background of the environment to . & default=\mdsetting{white} \\ \mdoption{fontcolor}= & Sets the color of the contents of the environment to . & default=\mdsetting{black} \\ \mdoption{margin}= & Sets the length of the margin text frame of the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{2pt} \\ \mdoption{leftmargin}= & Sets the length of the left margin of the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{2pt} \\ \mdoption{rightmargin}= & Sets the length of the right margin of the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{2pt} \\ \mdoption{linewidth}=& Sets the width of the line around the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{20pt} \\ \mdoption{ntheorem}=& Before setting this key, you have to load the package \mdpack{ntheorem}. With this option you set the values \mdcommand{theorempreskipamount} and \mdcommand{theorempostskipamount} to 0pt. & default=\mdsetting{false} \\ \end{tabularx} \end{center} \subsubsection{The Option \mdoption{ntheorem}} \begin{theorem} This environment is created with \mdoption{ntheorem=false}. \end{theorem} \begin{ntheorem} This environment is created with \mdoption{ntheorem=true}. \end{ntheorem} \subsection{Added options by the style 1} The following options only work with \mdoption{style=1}. First you have to know that by default the frame is drawn with a double line. So you can manipulate every line. It ist possible to get a single line -- the section \glqq Examples\grqq shows how this can be done. \begin{center} \renewcommand{\arraystretch}{1.5} \begin{tabularx}{\linewidth}{@{}lXl@{}} \mdoption{roundcorner}=& Sets the size of the radius of the corners of the frames. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{0pt} \\ \mdoption{innerlinewidth}=& Sets the width of the inner line around the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{0pt} \\ \mdoption{outerlinewidth}=& Sets the width of the outer line around the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdsetting{0pt} \\ \mdoption{middlelinewidth}=& Sets the width of the middle line around the environment. The basic unit of the length is pt. So it is possible to set length to 6 which is equal to 6pt. & default=\mdoption{linewidth} \\ \mdoption{innerlinecolor}=& Sets the color of the inner line around the environment. & default=\mdoption{linecolor} \\ \mdoption{outerlinecolor}=& Sets the color of the outer line around the environment. & default=\mdoption{linecolor} \\ \mdoption{middlelinecolor}=& Sets the color of the middle line around the environment. & default=\mdoption{backgroundcolor} \\ \end{tabularx} \end{center} \section{Examples} The header for the following examples is \begin{mdexample} \documentclass[10pt]{article} \usepackage[style=1,leftmargin=20pt,rightmargin=20pt]{mdframed} \usepackage{lipsum} \end{mdexample} \paragraph{Example 1}~\par \begin{mdexample} \begin{mdframed} \lipsum[1] \end{mdframed} \end{mdexample} \begin{mdframed} \lipsum[1] \end{mdframed} \paragraph{Example 2}~\par \begin{mdexample} \begin{mdframed}[outerlinewidth=4pt,middlelinewidth=2pt,innerlinewidth=1pt,% outerlinecolor=blue,middlelinecolor=yellow,innerlinecolor=red,% backgroundcolor=orange,roundcorner=10pt] \lipsum[1] \end{mdframed} \end{mdexample} \begin{mdframed}[outerlinewidth=4pt,middlelinewidth=2pt,innerlinewidth=1pt,% outerlinecolor=blue,middlelinecolor=yellow,innerlinecolor=red,% backgroundcolor=orange,roundcorner=10pt] \lipsum[1] \end{mdframed} \section{Known Problems} In this section I will collect known problems. In case you encouter any further problems, please drop me an email, \href{mailto:marco.daniel@mada-nada.de}{marco.daniel@mada-nada.de}. Do you have any ideas / wishes on further extensions to this package? Please let me know! \begin{enumerate} \item So far the environment isn't compatible with the package \mdpack{gmverb}. \item So far it isn't possible to use the multicolumn environment. \end{enumerate} \section{Acknowledgement} Thanks for the bug reports and suggestions \textsf{Dick Nickalls;\quad Dr. Dietrich Grau;\quad Piazza Luca}. \medskip \noindent Thanks for proofreading \textsf{Nahid Shajari}. \end{document}