I uploaded version 1.5 and added an exampple of the excurs-environment
. You can find the example in the file mdframed-example-texsx.pdf
(Example 5).
The environment can be defined with the following settings:
\usetikzlibrary{calc,arrows}
Needed for the design (not mdframed related)
Define the style of the lines and the arrows (not mdframed related)
\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,
},
}
Define the new environment with the new keys of version 1.5: singleextra
, firstextra
, middleextra
and secondextra
\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);
\path [excursus arrow,-to]
(O) |- %
($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
++(23em,2ex);
\node [excursus head] at ($(Q)+(2.5em,-2pt)$) {Digression};
},
secondextra={%
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path [excursus arrow,round cap-]
($(O)+(5em,0ex)$) -| (Q);
},
middleextra={%
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path [excursus arrow](O) -- (Q);
},
middlelinewidth=2.5em,middlelinecolor=white,
hidealllines=true,topline=true,
innertopmargin=0.5ex,
innerbottommargin=2.5ex,
innerrightmargin=2pt,
innerleftmargin=2ex,
skipabove=0.87\baselineskip,
skipbelow=0.62\baselineskip,
}
Important are the lines:
middlelinewidth=2.5em,middlelinecolor=white,
hidealllines=true,topline=true,
First I removed all lines drawn by mdramed and add only the first line. The first line with line color white is needed. In this way mdframed knows the height of the excurs-lines and can calculate the correct splitting point.
With these settings you get:
Here's another similar approach, but this time using the interface provided by the thmtools
package; the idea is to define the structure as a theorem-like one, and use the mdframed
key provided by thmtools
:
\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[framemethod=tikz]{mdframed}
\definecolor{ExerciseColor}{gray}{0.65}
\declaretheoremstyle[
headfont=\normalfont\bfseries,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.5em,
mdframed={
skipabove=\topsep,
skipbelow=\topsep,
hidealllines=true,
backgroundcolor={ExerciseColor!20},
innerleftmargin=0pt,
innerrightmargin=0pt}
]{mystyle}
\declaretheorem[style=mystyle,name=Exercise]{exer}
\newenvironment{exercise}[1]
{\renewcommand\theexer{#1}\begin{exer}}
{\end{exer}}
\begin{document}
\begin{exercise}{1.3.5}
Here is an exercise. Here is an exercise. Here is an exercise. Here is an exercise. Here is an exercise. Here is an equation:
\[
a + b = c.
\]
Here is an exercise.
\end{exercise}
\begin{exercise}{1.3.7}
Here is an exercise. Here is an exercise. Here is an exercise. Here is an exercise. Here is an exercise. Here is an equation:
\[
a + b = c.
\]
Here is an exercise.
\end{exercise}
\end{document}
Best Answer
You could proceed as follows:
The result:
This method provides some space between and after the title. If you don't want them:
The result: