1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
%% Documentation of the package mdframed.sty
\def\mdversion{version 0.3a}
\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}
}
\usepackage{xcolor}
\usepackage[babel]{microtype}
\usepackage{array,tabularx}
%%Load the the package itselfs
\usepackage[leftmargin=20pt,rightmargin=40pt]{mdframed}
\usepackage{amsmath}
\usepackage[amsmath,amsthm,hyperref]{ntheorem}
\newtheorem{mdtheorem}{Theorem}[section]
\newenvironment{theorem}{%
\begin{mdframed}[leftmargin=20pt,rightmargin=40pt,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.} \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[<GLOBAL OPTIONS>]{mdframed}
\end{mdexample}
The package defines only one environment with the following syntax
\begin{mdexample}
\begin{mdframed}[< LOCAL OPTIONS >]
< CONTENT >
\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{skipabove}=<LENGTH>& Sets an additional skip above the frame.
& default=\mdsetting{0pt} \\
\mdoption{skipbelow}=<LENGTH>& Sets an additional skip below the frame.
& default=\mdsetting{0pt} \\
\mdoption{xcolor}=<VALUE(S)>& 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} \\
\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 listed options below allows to set global and local.
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{@{}lXl@{}}
\mdoption{linecolor}=<COLOR> & Sets the color of the line around the environment to <COLOR>.
& default=\mdsetting{black} \\
\mdoption{backgroundcolor}=<COLOR> & Sets the color of the background of the environment to <COLOR>.
& default=\mdsetting{white} \\
\mdoption{fontcolor}=<COLOR> & Sets the color of the contents of the environment to <COLOR>.
& default=\mdsetting{black} \\
\mdoption{margin}=<LENGTH> & 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}=<LENGTH> & 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}=<LENGTH> & 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}=<LENGTH>& 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}=<boolean>& Befor 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}
\clearpage
\section{Example}
\begin{mdexample}
\documentclass[10pt]{article}
\usepackage[linewidth=10,%
margin=40,%
backgroundcolor=yellow,
linecolor=blue,
skipbelow=0,
skipabove=0]{mdframed}
\usepackage{amsmath,amsthm}
\newtheorem{mdlemma}{Lemma}[section]
\newenvironment{lemma}{%
\begin{mdframed}[linewidth=2,margin=40,%
backgroundcolor=red,linecolor=black]%
\begin{mdlemma}%
}{%
\end{mdlemma}%
\end{mdframed}%
}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{document}
\section{foo}
\lipsum[1]
\begin{mdframed}
\lipsum[5]
\end{mdframed}
\lipsum[1]
\begin{lemma}\label{lem:testA}\mbox{ }
\begin{itemize}
\item Some Text
\item $x^2+y^2=1$
\item \lipsum[1]
\end{itemize}
\end{lemma}
\end{document}\end{mdexample}
\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 it is not possible to extend a frame to more than two pages
\item So far there is no implementation for choosing different styles of the frame. But I am workind on that.
\end{enumerate}
\end{document}
|