I think I found the cause of the problem. Your use of \RecustomVerbatimEnvironment
seems to make the minted code unbreakable. If you omit this (and thereby also omit centering), your code is breakable:
\begin{filecontents*}{script.txt}
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
Bla bla bla bla bla.
Blub blub blub.
\end{filecontents*}
\documentclass[a4paper,oneside]{report}
\usepackage{minted}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\usepackage{etoolbox}
\usepackage{fancyvrb}
\begin{document}
\rule{1pt}{14cm}
\begin{tcolorbox}[breakable,enhanced]
%\centering
%\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}
\inputminted{gnuplot}{script.txt}
\end{tcolorbox}
\end{document}

Update:
You get the same result, if you use the minted
library of tcolorbox
and its \tcbinputlisting
command instead of putting \inputminted
into a tcolorbox
.
With your provided script.txt
plus setting minted options={breaklines}
for line breaking, this gives:
\documentclass[a4paper,oneside]{report}
\usepackage{minted}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,minted}
\usepackage{etoolbox}
\usepackage{fancyvrb}
\begin{document}
\tcbinputlisting{
listing file=script.txt,
minted language=gnuplot,
minted options={breaklines},% <-- put other minted options inside the brackets
breakable,enhanced,% <-- put other tcolorbox options here
listing only
}
\end{document}

If you have many gnuplot inputs, you can wrap all settings into a new macro using \newcommand
or \newtcbinputlisting
(from tcolorbox
).
For example, create a new macro \gnuplotinput
like the following:
\documentclass[a4paper,oneside]{report}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,minted}
\newtcbinputlisting{\gnuplotinput}[2][]{%
listing file={#2},
minted language=gnuplot,
minted options={breaklines},% <-- put other minted options inside the brackets
breakable,enhanced,% <-- put other tcolorbox options here
listing only,#1
}
\begin{document}
\gnuplotinput{script.txt}
\end{document}
\documentclass{...}
, the required\usepackage
's,\begin{document}
, and\end{document}
. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.script.txt
, so we cannot reproduce the problem. Either provide the file or provide some dummy replacement contents allowing us to reproduce the proble. Also, your code is missing the document class that you are using.