I try to insert some Python code in a LaTeX document using an mdframed minted but it take really really ... really long to compile (so long I must abort, CPU goes to 100% all the time).
In the stdout, I got thousands of thousands of lines:
Overfull \vbox (2655.50832pt too high) detected at line 3665
Overfull \vbox (2656.50832pt too high) detected at line 3665
Here's how I tried based on minted truncates the code if it doesn't fit into one page :
\documentclass[a4paper,12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[british,UKenglish,USenglish]{babel}
\usepackage[T1]{fontenc}
(...)
% pretend to already have loaded float
\makeatletter
\@namedef{ver@float.sty}{3000/12/31}
\makeatother
\usepackage[newfloat]{minted}
\usepackage{floatrow}
\usepackage{mdframed}
%%%%%%
\begin{document}
\begin{mdframed}[linecolor=black, topline=true, bottomline=true,
leftline=false, rightline=false, backgroundcolor=yellow!20!white]
\begin{minted}[
frame=lines,
framesep=2mm,
baselinestretch=1.0,
bgcolor=lightgray,
fontsize=\footnotesize,
linenos
]
{python}
reaaaaally long code with hundreds of line here (it must end up on multiple pages)
\end{minted}
\end{mdframed}
\end{document}
With small snippets of code it works like a charm.
I also tried:
\begin{mdframed}[linecolor=white, topline=false, bottomline=false,
leftline=false, rightline=false]
\inputminted[
frame=lines,
framesep=2mm,
baselinestretch=1.0,
bgcolor=lightgray,
fontsize=\footnotesize,
linenos
]
{python}
{/path/to/script.py}
\end{minted}
\end{mdframed}
I got the same behaviour.
Update:
Here's a useful (?) extract of the log file:
(...)
Package mdframed Info: Not enough space on this page on input line 89.
Overfull \vbox (170.2141pt too high) detected at line 89
[]
Package mdframed Info: Box was splittet wrong
starting loop to iterate the splitting point
(mdframed) on input line 89.
Overfull \vbox (171.2141pt too high) detected at line 89
[]
Overfull \vbox (172.2141pt too high) detected at line 89
[]
Overfull \vbox (173.2141pt too high) detected at line 89
[]
(...)
! Dimension too large.Probablytcolorboxis better instead ofmdframed. – egreg Jul 19 '17 at 09:48tcolorboxdoesn't seem to split the code on several pages. It's just like printing only themintedblock without embedding it into "something else" like anmdframedortcolorbox. – s.k Jul 19 '17 at 10:05mdframedortcolorbox) that the box is allowed to break. I think it is the default inmdframed, but not itcolorbox. – daleif Jul 19 '17 at 10:07breakableoption here : https://tex.stackexchange.com/questions/187741/very-large-tcolorbox which doesn't seem to be recognized by my side :! Package pgfkeys Error: I do not know the key '/tcb/breakable', to which you passed 'unlimited', and I'm going to ignore it.– s.k Jul 19 '17 at 10:44breakablepackage option? I added an answer which works for me. – Thomas F. Sturm Jul 19 '17 at 10:50