I am having an issue with mdframed, where I've created a frames inside frames spanning several pages, but I'd like mdframed to split them differently across the pages, so as much of the text on page two is moved to page one.
Here is the output of the code:
The desired result should look like this, which I've created in Microsoft Paint:
Here is the code:
\documentclass{article}
\usepackage{mdframed,lipsum}
\newmdenv[
leftmargin = 0pt,
innerleftmargin = 1em,
innertopmargin = 0pt,
innerbottommargin = 0pt,
innerrightmargin = 0pt,
rightmargin = 0pt,
linewidth = 1pt,
topline = false,
rightline = false,
bottomline = false
]{leftbar}
\begin{document}
\lipsum[1]
\begin{leftbar}
\lipsum[2]
\begin{leftbar}
\lipsum[3-5]
\end{leftbar}
\end{leftbar}
\end{document}
Update: There is another issue, where the frame exceeds the page margins:
One can see the page number on top of the frame in the image. I'd like for the frame to break across pages and stay inside the page margins. The result was obtained by changing \lipsum[3-5] to \lipsum[3-20] in the previous MWE.