Mdframed Example Texsx
Mdframed Example Texsx
Contents
1 Loading 1 Example 4 – Working inside enumerate 5
Example 5 – Position a specific symbol
2 Examples 1 at a line . . . . . . . . . . . . . . 5
Example 1 – Package listings . . . . . 2 Example 6 – digression-environement
Example 2 – Package multicol . . . . . 3 inspired by Tobias Weh . . . . . 6
Example 3 – Working in twocolumn Example 7 – Theorem style shading
mode . . . . . . . . . . . . . . . . 4 background . . . . . . . . . . . . 7
1 Loading
In the preamble only the package mdframed width the option framemethod=tikz is loaded. All other
modifications will be done by \mdfdefinestyle or \mdfsetup.
Note
Every \globalinside the examples is necessary to work with my own created environment
tltxmdfexample*.
2 Examples
All examples have the following settings:
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is the dependent
variable, and $f$ is a given non−zero function of the independent
variables alone.
}
Example 1 – Package listings 2 Examples
\BeforeBeginEnvironment{lstlisting}{%
\begin{mdframed}[<modification>]%
\vspace{−0.7em}}
\AfterEndEnvironment{lstlisting}{%
\vspace{−0.5em}%
\end{mdframed}}
\surroundwithmdframed{listings}
\begin{multicols}{2}
\lipsum[1]
\begin{mdframed}
\ExampleText
\end{mdframed}
\lipsum[2]
\end{multicols}
Lorem ipsum dolor sit amet, consectetuer An inhomogeneous linear differential equa-
adipiscing elit. Ut purus elit, vestibulum ut, tion has the form
placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Nam arcu libero, non- L[v] = f, (1)
ummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque where L is a linear differential operator, v
habitant morbi tristique senectus et netus et is the dependent variable, and f is a given
malesuada fames ac turpis egestas. Mauris ut non-zero function of the independent vari-
leo. Cras viverra metus rhoncus sem. Nulla et ables alone.
lectus vestibulum urna fringilla ultrices. Phasel-
lus eu tellus sit amet tortor gravida placerat. In- Nam dui ligula, fringilla a, euismod sodales,
teger sapien est, iaculis in, pretium quis, viverra sollicitudin vel, wisi. Morbi auctor lorem non
ac, nunc. Praesent eget sem vel leo ultrices justo. Nam lacus libero, pretium at, lobortis
bibendum. Aenean faucibus. Morbi dolor nulla, vitae, ultricies et, tellus. Donec aliquet, tor-
malesuada eu, pulvinar at, mollis ac, nulla. Cur- tor sed accumsan bibendum, erat ligula aliquet
abitur auctor semper nulla. Donec varius orci magna, vitae ornare odio metus a mi. Morbi
eget risus. Duis nibh mi, congue eu, accumsan ac orci et nisl hendrerit mollis. Suspendisse
eleifend, sagittis quis, diam. Duis eget orci sit ut massa. Cras nec ante. Pellentesque a nulla.
amet orci dignissim rutrum. Cum sociis natoque penatibus et magnis dis par-
turient montes, nascetur ridiculus mus. Aliquam
tincidunt urna. Nulla ullamcorper vestibulum
turpis. Pellentesque cursus luctus mauris.
L[v] = f, (2)
L[v] = f, (3)
2. Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non
justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor
sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac
orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus
mauris.
Text Text Text Text Text Text
\tikzset{
warningsymbol/.style={
rectangle,draw=red,
fill=white,scale=1,
overlay}}
\mdfdefinestyle{warning}{%
hidealllines=true,leftline=true,
skipabove=12,skipbelow=12pt,
innertopmargin=0.4em,%
innerbottommargin=0.4em,%
innerrightmargin=0.7em,%
rightmargin=0.7em,%
innerleftmargin=1.7em,%
leftmargin=0.7em,%
middlelinewidth=.2em,%
linecolor=red,%
fontcolor=red,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5∗(0,\y1)$)
node[warningsymbol] {\$};},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5∗(0,\y1)$)
node[warningsymbol] {\$};},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5∗(0,\y1)$)
node[warningsymbol] {\$};},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5∗(0,\y1)$)
node[warningsymbol] {\$};},%
}
\begin{mdframed}[style=warning]
\ExampleText
\end{mdframed}
L[v] = f, (4)
$
where L is a linear differential operator, v is the dependent variable, and f is a given
non-zero function of the independent variables alone.
\usetikzlibrary{calc,arrows}
\tikzset{
excursus arrow/.style={%
line width=2pt,
draw=gray!40,
rounded corners=2ex,
},
excursus head/.style={
fill=white,
font=\bfseries\sffamily,
text=gray!80,
anchor=base west,
},
}
\mdfdefinestyle{digressionarrows}{%
singleextra={%
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path let \p1=(Q), \p2=(O) in (\x1,{(\y1−\y2)/2}) coordinate (M);
\path [excursus arrow, round cap−to]
($(O)+(5em,0ex)$) −| (M) |− %
($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
++(23em,2ex);
\node [excursus head] at ($(Q)+(2.5em,−0.75pt)$) {Digression};},
firstextra={%
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\begin{mdframed}[style=digressionarrows]
\ExampleText
\end{mdframed}
Digression
L[v] = f, (5)
where L is a linear differential operator, v is the dependent variable, and f is a given non-zero
function of the independent variables alone.
\mdtheorem[%
apptotikzsetting={%
\tikzset{mdfbackground/.append style ={%
top color=yellow!40!white,
bottom color=yellow!80!black},
mdfframetitlebackground/.append style={
top color=purple!40!white,
bottom color=purple!80!black
}
}%
},
,roundcorner=10pt,middlelinewidth=2pt,
shadow=true,frametitlerule=true,frametitlerulewidth=4pt,
innertopmargin=10pt,%
]{alternativtheorem}{Theorem}
\begin{alternativtheorem}[Inhomogeneous linear]
\ExampleText
\end{alternativtheorem}
L[v] = f, (6)
where L is a linear differential operator, v is the dependent variable, and f is a given non-zero
function of the independent variables alone.