| 1 |
|
| 2 |
\setcounter{errorcontextlines}{999} |
| 3 |
\documentclass[parskip=false,english,11pt]{ltxmdf} |
| 4 |
|
| 5 |
\newcommand\Loadedframemethod{TikZ} |
| 6 |
\usepackage[framemethod=\Loadedframemethod]{mdframed} |
| 7 |
|
| 8 |
\surroundwithmdframed[middlelinecolor=ltxmdfblue,middlelinewidth=1pt,% |
| 9 |
roundcorner=10pt,innertopmargin=0pt,% |
| 10 |
leftmargin=1cm,rightmargin=1cm,% |
| 11 |
innerleftmargin=-15pt,innerrightmargin=-15pt,% |
| 12 |
ignorelastdescenders,% |
| 13 |
settings={\lstset{resetmargins}},% |
| 14 |
skipbelow=\topskip,skipabove=\topskip,% |
| 15 |
innerbottommargin=0pt,backgroundcolor=gray!10]% |
| 16 |
{tltxmdfexample} |
| 17 |
|
| 18 |
\newmdenv[middlelinecolor=ltxmdfblue,middlelinewidth=1pt,% |
| 19 |
roundcorner=10pt,innertopmargin=0pt,% |
| 20 |
leftmargin=1cm,rightmargin=1cm,% |
| 21 |
innerleftmargin=-15pt,innerrightmargin=-15pt,% |
| 22 |
ignorelastdescenders,% |
| 23 |
settings={\lstset{resetmargins}},% |
| 24 |
skipbelow=\topskip,skipabove=\topskip,% |
| 25 |
innerbottommargin=0pt,backgroundcolor=gray!10]% |
| 26 |
{tltxmdfhighlight} |
| 27 |
\def\highlightinputenv{tltxmdfhighlight} |
| 28 |
|
| 29 |
\title{The \Pack{mdframed} package} |
| 30 |
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}} |
| 31 |
\author{\href{mailto:[email protected]}{Marco Daniel}} |
| 32 |
\date{\mdfmaindate} |
| 33 |
\version{\mdversion} |
| 34 |
\introduction{In this document I collect various examples for |
| 35 |
\Opt{framemethod=\Loadedframemethod}. |
| 36 |
Some presented examples are more or less exorbitant.} |
| 37 |
|
| 38 |
\mdfsetup{skipabove=\topskip,skipbelow=\topskip} |
| 39 |
\newrobustcmd\ExampleText{% |
| 40 |
An \textit{inhomogeneous linear} differential equation has the form |
| 41 |
\begin{align} |
| 42 |
L[v ] = f, |
| 43 |
\end{align} |
| 44 |
where $L$ is a linear differential operator, $v$ is |
| 45 |
the dependent variable, and $f$ is a given non-zero |
| 46 |
function of the independent variables alone. |
| 47 |
} |
| 48 |
|
| 49 |
\newcounter{examplecount} |
| 50 |
\setcounter{examplecount}{0} |
| 51 |
\renewcommand\thesubsection{} |
| 52 |
\newcommand\Examplesec[1]{% |
| 53 |
\stepcounter{examplecount}% |
| 54 |
\subsection{Example~\arabic{examplecount}~--~#1\relax}% |
| 55 |
} |
| 56 |
|
| 57 |
\begin{document} |
| 58 |
\maketitle |
| 59 |
\section{Loading} |
| 60 |
In the preamble only the package \Pack{mdframed} width the option |
| 61 |
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be |
| 62 |
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}. |
| 63 |
|
| 64 |
{\large\color{red!50!black} |
| 65 |
\NOTE Every \Cmd{global} inside the examples is necessary to work with my own |
| 66 |
created environment \Env{tltxmdfexample*}.} |
| 67 |
|
| 68 |
\section{Examples} |
| 69 |
All examples have the following settings: |
| 70 |
|
| 71 |
\begin{tltxmdfexample} |
| 72 |
\mdfsetup{skipabove=\topskip,skipbelow=\topskip} |
| 73 |
\newrobustcmd\ExampleText{% |
| 74 |
An \textit{inhomogeneous linear} differential equation has the form |
| 75 |
\begin{align} |
| 76 |
L[v ] = f, |
| 77 |
\end{align} |
| 78 |
where $L$ is a linear differential operator, $v$ is the dependent |
| 79 |
variable, and $f$ is a given non-zero function of the independent |
| 80 |
variables alone. |
| 81 |
} |
| 82 |
\end{tltxmdfexample} |
| 83 |
|
| 84 |
\clearpage |
| 85 |
\Examplesec{round corner} |
| 86 |
\begin{tltxmdfexample*} |
| 87 |
\global\mdfdefinestyle{exampledefault}{% |
| 88 |
outerlinewidth=5pt,innerlinewidth=0pt, |
| 89 |
outerlinecolor=red,roundcorner=5pt |
| 90 |
} |
| 91 |
\begin{mdframed}[style=exampledefault] |
| 92 |
\ExampleText |
| 93 |
\end{mdframed} |
| 94 |
\end{tltxmdfexample*} |
| 95 |
|
| 96 |
\Examplesec{hidden line + frame title} |
| 97 |
\begin{tltxmdfexample*} |
| 98 |
\global\mdfapptodefinestyle{exampledefault}{% |
| 99 |
topline=false,leftline=false,} |
| 100 |
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}] |
| 101 |
\ExampleText |
| 102 |
\end{mdframed} |
| 103 |
\end{tltxmdfexample*} |
| 104 |
|
| 105 |
\Examplesec{framed picture which is centered} |
| 106 |
\begin{tltxmdfexample*} |
| 107 |
\begin{mdframed}[userdefinedwidth=6cm,align=center, |
| 108 |
linecolor=blue,middlelinewidth=4pt,roundcorner=5pt] |
| 109 |
\textit{CTAN lion drawing by Duane Bibby; thanks to \url{www.ctan.org}} |
| 110 |
\IfFileExists{ctan-lion.png}% |
| 111 |
{\includegraphics[width=\linewidth]{ctan-lion.png}}% |
| 112 |
{\rule{\linewidth}{4cm}}% |
| 113 |
\end{mdframed} |
| 114 |
\end{tltxmdfexample*} |
| 115 |
|
| 116 |
\Examplesec{Gimmick} |
| 117 |
\begin{tltxmdfexample*}[morekeywords={line,width,dash,dashed,pattern}] |
| 118 |
\mdfsetup{splitbottomskip=0.8cm,splittopskip=0cm, |
| 119 |
innerrightmargin=2cm,innertopmargin=1cm,% |
| 120 |
innerlinewidth=2pt,outerlinewidth=2pt, |
| 121 |
middlelinewidth=10pt,backgroundcolor=red, |
| 122 |
linecolor=blue,middlelinecolor=gray, |
| 123 |
tikzsetting={draw=yellow,line width=3pt,% |
| 124 |
dashed,% |
| 125 |
dash pattern= on 10pt off 3pt}, |
| 126 |
rightline=false,bottomline=false} |
| 127 |
\begin{mdframed} |
| 128 |
\ExampleText |
| 129 |
\end{mdframed} |
| 130 |
\end{tltxmdfexample*} |
| 131 |
|
| 132 |
\clearpage |
| 133 |
\Examplesec{complex example with TikZ} |
| 134 |
|
| 135 |
\begin{tltxmdfexample*}[morekeywords={mdf}] |
| 136 |
\tikzset{titregris/.style = |
| 137 |
{draw=gray, thick, fill=white, shading = exersicetitle, % |
| 138 |
text=gray, rectangle, rounded corners, right,minimum height=.7cm}} |
| 139 |
\pgfdeclarehorizontalshading{exersicebackground}{100bp} |
| 140 |
{color(0bp)=(green!40); color(100bp)=(black!5)} |
| 141 |
\pgfdeclarehorizontalshading{exersicetitle}{100bp} |
| 142 |
{color(0bp)=(red!40);color(100bp)=(black!5)} |
| 143 |
\newcounter{exercise} |
| 144 |
\renewcommand*\theexercise{Exercise~n\arabic{exercise}} |
| 145 |
\makeatletter |
| 146 |
\def\mdf@@exercisepoints{}%new mdframed key: |
| 147 |
\define@key{mdf}{exercisepoints}{% |
| 148 |
\def\mdf@@exercisepoints{#1} |
| 149 |
} |
| 150 |
\mdfdefinestyle{exercisestyle}{% |
| 151 |
outerlinewidth=1em,outerlinecolor=white,% |
| 152 |
leftmargin=-1em,rightmargin=-1em,% |
| 153 |
middlelinewidth=1.2pt,roundcorner=5pt,linecolor=gray, |
| 154 |
apptotikzsetting={\tikzset{mdfbackground/.append style ={% |
| 155 |
shading = exersicebackground}}}, |
| 156 |
innertopmargin=1.2\baselineskip, |
| 157 |
skipabove={\dimexpr0.5\baselineskip+\topskip\relax}, |
| 158 |
skipbelow={-1em}, |
| 159 |
needspace=3\baselineskip, |
| 160 |
frametitlefont=\sffamily\bfseries, |
| 161 |
settings={\global\stepcounter{exercise}}, |
| 162 |
singleextra={% |
| 163 |
\node[titregris,xshift=1cm] at (P-|O) % |
| 164 |
{~\mdf@frametitlefont{\theexercise}\hbox{~}}; |
| 165 |
\ifdefempty{\mdf@@exercisepoints}% |
| 166 |
{}% |
| 167 |
{\node[titregris,left,xshift=-1cm] at (P)% |
| 168 |
{~\mdf@frametitlefont{\mdf@@exercisepoints points}\hbox{~}};}% |
| 169 |
}, |
| 170 |
firstextra={% |
| 171 |
\node[titregris,xshift=1cm] at (P-|O) % |
| 172 |
{~\mdf@frametitlefont{\theexercise}\hbox{~}}; |
| 173 |
\ifdefempty{\mdf@@exercisepoints}% |
| 174 |
{}% |
| 175 |
{\node[titregris,left,xshift=-1cm] at (P)% |
| 176 |
{~\mdf@frametitlefont{\mdf@@exercisepoints points}\hbox{~}};}% |
| 177 |
}, |
| 178 |
} |
| 179 |
\makeatother |
| 180 |
|
| 181 |
\begin{mdframed}[style=exercisestyle] |
| 182 |
\ExampleText |
| 183 |
\end{mdframed} |
| 184 |
|
| 185 |
\begin{mdframed}[style=exercisestyle,exercisepoints=10] |
| 186 |
\ExampleText |
| 187 |
\end{mdframed} |
| 188 |
\end{tltxmdfexample*} |
| 189 |
|
| 190 |
\clearpage |
| 191 |
\Examplesec{Theorem environments} |
| 192 |
\begin{tltxmdfexample*}[morekeywords={theoremstyle,definition}] |
| 193 |
\mdfdefinestyle{theoremstyle}{% |
| 194 |
linecolor=red,middlelinewidth=2pt,% |
| 195 |
frametitlerule=true,% |
| 196 |
apptotikzsetting={\tikzset{mdfframetitlebackground/.append style={% |
| 197 |
shade,left color=white, right color=blue!20}}}, |
| 198 |
frametitlerulecolor=green!60, |
| 199 |
frametitlerulewidth=1pt, |
| 200 |
innertopmargin=\topskip, |
| 201 |
} |
| 202 |
\mdtheorem[style=theoremstyle]{definition}{Definition} |
| 203 |
\begin{definition}[Inhomogeneous linear] |
| 204 |
\ExampleText |
| 205 |
\end{definition} |
| 206 |
\begin{definition*}[Inhomogeneous linear] |
| 207 |
\ExampleText |
| 208 |
\end{definition*} |
| 209 |
\end{tltxmdfexample*} |
| 210 |
\end{document} |
| 211 |
\endinput |
| 212 |
|