This question is a follow-up question to: Access mdframed node coordinates with TikZ?
@MarcoDaniel: Awesome package (mdframed)! Nice clean code, too.
@Tobi:
I really like your new excursus environment! However, there is an issue when it splits on pages: the first box (\mdf@putbox@first) is sent to the following page. Using your previous code:
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{calc,arrows}
\usepackage{etoolbox}
\usepackage[framemethod=tikz]{mdframed}
\tikzstyle{excursus arrow}=[%
line width=4pt,
draw=blue,
rounded corners=2ex
]
\tikzstyle{excursus head}=[%
fill=white,
font={\bfseries\sffamily},
text=blue,
anchor=base,
]
\makeatletter
\newcommand{\drawexcursusarrow}{%
\patchcmd{\mdf@putbox@single}{\mdfcreateextratikz}{
\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->]
($(O)+(5em,0ex)$) -| (M) |- %
($(Q)+(6em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
++(23em,2ex);
\node [excursus head] at ($(Q)+(4.5em,-2pt)$) {Excursus};
}{}{}%
\patchcmd{\mdf@putbox@first}{\mdfcreateextratikz}{
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path [excursus arrow,->]
(O) |- %
($(Q)+(6em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
++(23em,2ex);
\node [excursus head] at ($(Q)+(4.5em,-2pt)$) {Excursus};
}{}{}%
\patchcmd{\mdf@putbox@second}{\mdfcreateextratikz}{
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path [excursus arrow,round cap-]
($(O)+(5em,0ex)$) -| (Q);
}{}{}%
\patchcmd{\mdf@putbox@middle}{\mdfcreateextratikz}{
\path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
\path [excursus arrow]
(O) -- (Q);
}{}{}%
}
\makeatother
\newmdenv[%
middlelinewidth=24pt,
middlelinecolor=white,
rightline=false,
innertopmargin=0ex,
innerbottommargin=0ex,
innerrightmargin=2pt,
innerleftmargin=0ex,
leftmargin=-11pt,
skipabove=12pt,
skipbelow=-1pt,%=12-24/2-2/2
settings=\drawexcursusarrow,
]{excursus}
\usepackage{lipsum}
\begin{document}
\lipsum[3]
\begin{excursus}
\lipsum[1]
\end{excursus}
\lipsum[3]
%\vspace*{-2\baselineskip}
\begin{excursus} %% Added to illustrate the splitting problem
\lipsum[1-2]
\end{excursus}
\lipsum[3]
\end{document}
You can uncomment the \vspace*{...} to see the \mdf@putbox@first reappear in the appropriate page, but it now overlaps the previous text.
My guess is that the added height from the top excursus arrow (and title) is not accounted for in the mdframed algorithm to split over pages, so the total height of \mdf@putbox@first now exceeds the available vertical space remaining on the page.
Does that sound right and is there a way to fix it?


middlelinewidth. – Marco Daniel Apr 5 '12 at 19:13hidealllines=trueoption to my test file, which of course is inconsistent with themiddlelinewidth=24ptoption. I have changedmiddlelinecolor=greentomiddlelinecolor=white. Is there a way to make the line color transparent instead? – feculededentier Apr 10 '12 at 13:51