I would like to a have a caption below my mdframed box (outside the border if possible) which sometimes span across multiple pages. I managed to create a caption several ways but the pagebreaks are unfriendly. How can I do that without making the box unbreakable at pagebreaks?
The listings package is not an alternative, because I already use it inside somewhere in the mdframed box, and nesting them doesn't seem like a good idea.
Associated thread: use this inside \lstnewenvironment

;-)The\gdefcan be, more simply,\def. – egreg Sep 28 '13 at 19:25\relaxwould be simpler. You're right, it could be\def. – Werner Sep 28 '13 at 19:29\lstnewenvironmentwith less luck. (It works with\BeforeBeginEnvironment, but it's useless that way, because the lst environment has the caption text.) :( – masu Sep 28 '13 at 23:39aftersingleframeandafterlastframe– egreg Sep 29 '13 at 00:01