The question is close related to another question, where the accepted answer seems not to work for me. Hence I decided to post a new question here.
I'm using the minted package to generate highlighted code snippets which are framed and captioned above. An answer here suggests creating a new environment to make the caption work and I decide to use mdframed package to create the frame (since I'm not familiar with tcolorbox package). My problem is that the mdframed environment failed to break across the pages. The MWE turns out to do nothing about the minted package:
\documentclass{article}
\usepackage{mdframed}
\usepackage{caption}
% \usepackage{minted}% Not necessary
\usepackage{newfloat}% Only to define the listing float
\usepackage{lipsum}
\DeclareFloatingEnvironment{listing}
\captionsetup[listing]{
position = above,
skip = 0pt,
}
\newenvironment{longlisting}{\captionsetup{type=listing}}{}
\begin{document}
\begin{longlisting}
\captionof{listing}{Caption}
\begin{mdframed}
\lipsum[1-10]
\end{mdframed}
\end{longlisting}
\end{document}
Sorry, I'm working on how to upload the screenshots.
mdframe's even breakable by default? I'd also have a look at thetcolorboxpackage as it is probably much more configurable thanmdframed– daleif Jun 30 '21 at 08:27mdframed’s are breakable by default.mdframedprovide an option namednobreakwith the default value to befalse. I’m going to take a look attcolorboxpackage. Thanks! – Noto_Ootori Jun 30 '21 at 11:18