| 1 |
|
| 2 |
\setcounter{errorcontextlines}{999} |
| 3 |
\documentclass[parskip=false,english,11pt]{ltxmdf} |
| 4 |
|
| 5 |
\lstset{style=lstltxmdf} |
| 6 |
|
| 7 |
\newcommand\Loadedframemethod{default} |
| 8 |
\usepackage[framemethod=\Loadedframemethod]{mdframed} |
| 9 |
|
| 10 |
\surroundwithmdframed[middlelinecolor=ltxmdfblue,middlelinewidth=1pt,% |
| 11 |
roundcorner=10pt,innertopmargin=0pt,% |
| 12 |
leftmargin=1cm,rightmargin=1cm,% |
| 13 |
innerleftmargin=-15pt,innerrightmargin=-15pt,% |
| 14 |
ignorelastdescenders,% |
| 15 |
settings={\lstset{resetmargins}},% |
| 16 |
skipbelow=\topskip,skipabove=\topskip,% |
| 17 |
innerbottommargin=0pt,backgroundcolor=gray!10]% |
| 18 |
{tltxmdfexample} |
| 19 |
|
| 20 |
\newmdenv[middlelinecolor=ltxmdfblue,middlelinewidth=1pt,% |
| 21 |
roundcorner=10pt,innertopmargin=0pt,% |
| 22 |
leftmargin=1cm,rightmargin=1cm,% |
| 23 |
innerleftmargin=-15pt,innerrightmargin=-15pt,% |
| 24 |
ignorelastdescenders,% |
| 25 |
settings={\lstset{resetmargins}},% |
| 26 |
skipbelow=\topskip,skipabove=\topskip,% |
| 27 |
innerbottommargin=0pt,backgroundcolor=gray!10]% |
| 28 |
{tltxmdfhighlight} |
| 29 |
\def\highlightinputenv{tltxmdfhighlight} |
| 30 |
|
| 31 |
\title{The \Pack{mdframed} package} |
| 32 |
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}} |
| 33 |
\author{\href{mailto:[email protected]}{Marco Daniel}} |
| 34 |
\date{\mdfmaindate} |
| 35 |
\version{\mdversion} |
| 36 |
\introduction{In this document I collect various examples for |
| 37 |
\Opt{framemethod=\Loadedframemethod}. |
| 38 |
Some presented examples are more or less exorbitant.} |
| 39 |
|
| 40 |
\mdfsetup{skipabove=\topskip,skipbelow=\topskip} |
| 41 |
\newrobustcmd\ExampleText{% |
| 42 |
An \textit{inhomogeneous linear} differential equation has the form |
| 43 |
\begin{align} |
| 44 |
L[v ] = f, |
| 45 |
\end{align} |
| 46 |
where $L$ is a linear differential operator, $v$ is |
| 47 |
the dependent variable, and $f$ is a given non-zero |
| 48 |
function of the independent variables alone. |
| 49 |
} |
| 50 |
|
| 51 |
\newcounter{examplecount} |
| 52 |
\setcounter{examplecount}{0} |
| 53 |
\renewcommand\thesubsection{} |
| 54 |
\newcommand\Examplesec[1]{% |
| 55 |
\stepcounter{examplecount}% |
| 56 |
\subsection{Example~\arabic{examplecount}~--~#1\relax}% |
| 57 |
} |
| 58 |
|
| 59 |
\begin{document} |
| 60 |
\maketitle |
| 61 |
\section{Loading} |
| 62 |
In the preamble only the package \Pack{mdframed} with the option |
| 63 |
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be |
| 64 |
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}. |
| 65 |
|
| 66 |
{\large\color{red!50!black} |
| 67 |
\NOTE Every \Cmd{global} inside the examples is necessary to work with my own |
| 68 |
created environment \Env{tltxmdfexample*}.} |
| 69 |
|
| 70 |
\section{Examples} |
| 71 |
All examples have the following settings: |
| 72 |
|
| 73 |
\begin{tltxmdfexample} |
| 74 |
\mdfsetup{skipabove=\topskip,skipbelow=\topskip} |
| 75 |
\newrobustcmd\ExampleText{% |
| 76 |
An \textit{inhomogeneous linear} differential equation has the form |
| 77 |
\begin{align} |
| 78 |
L[v ] = f, |
| 79 |
\end{align} |
| 80 |
where $L$ is a linear differential operator, $v$ is the dependent |
| 81 |
variable, and $f$ is a given non-zero function of the independent |
| 82 |
variables alone. |
| 83 |
} |
| 84 |
\end{tltxmdfexample} |
| 85 |
|
| 86 |
\clearpage |
| 87 |
\Examplesec{very simple} |
| 88 |
\begin{tltxmdfexample*} |
| 89 |
\global\mdfdefinestyle{exampledefault}{% |
| 90 |
linecolor=red,linewidth=3pt,% |
| 91 |
leftmargin=1cm,rightmargin=1cm |
| 92 |
} |
| 93 |
\begin{mdframed}[style=exampledefault] |
| 94 |
\ExampleText |
| 95 |
\end{mdframed} |
| 96 |
\end{tltxmdfexample*} |
| 97 |
|
| 98 |
\Examplesec{hidden line + frame title} |
| 99 |
\begin{tltxmdfexample*} |
| 100 |
\global\mdfapptodefinestyle{exampledefault}{% |
| 101 |
topline=false,bottomline=false} |
| 102 |
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}] |
| 103 |
\ExampleText |
| 104 |
\end{mdframed} |
| 105 |
\end{tltxmdfexample*} |
| 106 |
|
| 107 |
\Examplesec{colored frame title} |
| 108 |
\begin{tltxmdfexample*} |
| 109 |
|
| 110 |
\global\mdfapptodefinestyle{exampledefault}{% |
| 111 |
rightline=true,innerleftmargin=10,innerrightmargin=10, |
| 112 |
frametitlerule=true,frametitlerulecolor=green, |
| 113 |
frametitlebackgroundcolor=yellow, |
| 114 |
frametitlerulewidth=2pt} |
| 115 |
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}] |
| 116 |
\ExampleText |
| 117 |
\end{mdframed} |
| 118 |
\end{tltxmdfexample*} |
| 119 |
|
| 120 |
\Examplesec{framed picture which is centered} |
| 121 |
\begin{tltxmdfexample*}[morekeywords=width] |
| 122 |
\begin{mdframed}[userdefinedwidth=6cm,align=center, |
| 123 |
linecolor=blue,linewidth=4pt] |
| 124 |
\textit{CTAN lion drawing by Duane Bibby; thanks to \url{www.ctan.org}} |
| 125 |
\IfFileExists{ctan-lion.png}% |
| 126 |
{\includegraphics[width=\linewidth]{ctan-lion.png}}% |
| 127 |
{\rule{\linewidth}{4cm}}% |
| 128 |
\end{mdframed} |
| 129 |
\end{tltxmdfexample*} |
| 130 |
|
| 131 |
\Examplesec{Theorem environments} |
| 132 |
\begin{tltxmdfexample*}[morekeywords={theoremstyle,definition}] |
| 133 |
\mdfdefinestyle{theoremstyle}{% |
| 134 |
linecolor=red,linewidth=2pt,% |
| 135 |
frametitlerule=true,% |
| 136 |
frametitlebackgroundcolor=gray!20, |
| 137 |
innertopmargin=\topskip, |
| 138 |
} |
| 139 |
\mdtheorem[style=theoremstyle]{definition}{Definition} |
| 140 |
\begin{definition} |
| 141 |
\ExampleText |
| 142 |
\end{definition} |
| 143 |
\begin{definition}[Inhomogeneous linear] |
| 144 |
\ExampleText |
| 145 |
\end{definition} |
| 146 |
\begin{definition*}[Inhomogeneous linear] |
| 147 |
\ExampleText |
| 148 |
\end{definition*} |
| 149 |
\end{tltxmdfexample*} |
| 150 |
|
| 151 |
\Examplesec{theorem with separate header and the help of TikZ (complex)} |
| 152 |
\begin{tltxmdfexample*}[% |
| 153 |
morekeywords={theo,baseline,anchor,outer,sep,current,bounding,box,east},% |
| 154 |
moretexcs=tikz] |
| 155 |
\newcounter{theo}[section] |
| 156 |
\newenvironment{theo}[1][]{% |
| 157 |
\stepcounter{theo}% |
| 158 |
\ifstrempty{#1}% |
| 159 |
{\mdfsetup{% |
| 160 |
frametitle={% |
| 161 |
\tikz[baseline=(current bounding box.east),outer sep=0pt] |
| 162 |
\node[anchor=east,rectangle,fill=blue!20] |
| 163 |
{\strut Theorem~\thetheo};}} |
| 164 |
}% |
| 165 |
{\mdfsetup{% |
| 166 |
frametitle={% |
| 167 |
\tikz[baseline=(current bounding box.east),outer sep=0pt] |
| 168 |
\node[anchor=east,rectangle,fill=blue!20] |
| 169 |
{\strut Theorem~\thetheo:~#1};}}% |
| 170 |
}% |
| 171 |
\mdfsetup{innertopmargin=10pt,linecolor=blue!20,% |
| 172 |
linewidth=2pt,topline=true, |
| 173 |
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,} |
| 174 |
\begin{mdframed}[]\relax% |
| 175 |
}{\end{mdframed}} |
| 176 |
\begin{theo}[Inhomogeneous Linear] |
| 177 |
\ExampleText |
| 178 |
\end{theo} |
| 179 |
|
| 180 |
\begin{theo} |
| 181 |
\ExampleText |
| 182 |
\end{theo} |
| 183 |
\end{tltxmdfexample*} |
| 184 |
|
| 185 |
\Examplesec{hide only a part of a line} |
| 186 |
The example below is inspired by the following post on StackExchange |
| 187 |
\href{http://tex.stackexchange.com/questions/24101/theorem-decorations^^A |
| 188 |
-that-stay-with-theorem-environment}% |
| 189 |
{Theorem decorations that stay with theorem environment} |
| 190 |
\begin{tltxmdfexample*}[morekeywords={mdf@frame@leftline@single,mdf@frame@rightline@single,% |
| 191 |
mdf@frame@leftline@first,mdf@frame@rightline@first,% |
| 192 |
mdf@frame@leftline@second,mdf@frame@rightline@second,% |
| 193 |
mdf@frame@leftline@middle,mdf@frame@rightline@middle,% |
| 194 |
mdfboundingboxdepth,mdfboundingboxtotalheight,% |
| 195 |
mdf@topline,ifbool,interruptrule,everyline}] |
| 196 |
\makeatletter |
| 197 |
\newlength{\interruptlength} |
| 198 |
\newrobustcmd\interruptrule[3]{% |
| 199 |
\color{#1}% |
| 200 |
\hspace*{\dimexpr\mdfboundingboxwidth+ |
| 201 |
\mdf@innerrightmargin@length\relax}% |
| 202 |
\rule[\dimexpr-\mdfboundingboxdepth+ |
| 203 |
#2\interruptlength\relax]% |
| 204 |
{\mdf@middlelinewidth@length}% |
| 205 |
{\dimexpr\mdfboundingboxtotalheight-#3\interruptlength\relax}% |
| 206 |
} |
| 207 |
\newrobustcmd\overlaplines[2][white]{% |
| 208 |
\mdfsetup{everyline=false}% |
| 209 |
\setlength{\interruptlength}{#2} |
| 210 |
\appto\mdf@frame@leftline@single{\llap{\interruptrule{#1}{1}{2}}} |
| 211 |
\appto\mdf@frame@rightline@single{\rlap{\interruptrule{#1}{1}{2}}} |
| 212 |
\appto\mdf@frame@leftline@first{\llap{\interruptrule{#1}{0}{1}}} |
| 213 |
\appto\mdf@frame@rightline@first{\rlap{\interruptrule{#1}{0}{1}}} |
| 214 |
\appto\mdf@frame@leftline@second{\llap{\interruptrule{#1}{1}{1}}} |
| 215 |
\appto\mdf@frame@rightline@second{\rlap{\interruptrule{#1}{1}{1}}} |
| 216 |
\appto\mdf@frame@leftline@middle{\llap{\interruptrule{#1}{0}{0}}} |
| 217 |
\appto\mdf@frame@rightline@middle{\rlap{\interruptrule{#1}{0}{0}}} |
| 218 |
} |
| 219 |
\makeatother |
| 220 |
|
| 221 |
\overlaplines{2.5ex} |
| 222 |
\begin{mdframed}[linecolor=blue,linewidth=8pt] |
| 223 |
\ExampleText |
| 224 |
\end{mdframed} |
| 225 |
\overlaplines[blue!70!black!20]{2.5ex} |
| 226 |
\begin{mdframed}[linecolor=blue,linewidth=8pt] |
| 227 |
\ExampleText |
| 228 |
\end{mdframed} |
| 229 |
\end{tltxmdfexample*} |
| 230 |
\end{document} |
| 231 |
\endinput |