2

I have a many minted sections that can span more than one page. I also have tables. It seems that these tables can just be plonked right in the middle of my minted section - which I don't want.

How can I stop minted sections getting broken by figures? i.e. is there a way I can either make minted 'unbreakable' (but still spans over page breaks), or can I make tables inline?

What is the best way to do this? I saw a similar answer to this question here: https://tex.stackexchange.com/a/34860/109263. but that just puts a table on it's own page... some of my tables are very small and many could be fit on a single page.

I'm rendering the minted package with the following code in the preamble:

\usepackage[outputdir=./_build]{minted}
\definecolor{dhscodebg}{rgb}{0.01,0.199,0.1}
\setminted{
    breaksymbolleft=,
    fontsize=\footnotesize,
    baselinestretch=1.1,
    xleftmargin=2.5em,
    linenos,
    breaklines,
    tabsize=4
}
\usemintedstyle{tango}
\BeforeBeginEnvironment{minted}
{\begin{tcolorbox}[
            breakable,
            boxrule=0.2pt,
            arc=0pt
        ]}\AfterEndEnvironment{minted}{\end{tcolorbox}}

I've included tables via the following code:

\begin{table}[h]
  \centering
  \label{PercentTreatment}
  \begin{tabular}{|l|l|l|}
    ...
  \end{tabular}
  \caption{...}
\end{table}

And the minted code is added to the document via:

\begin{minted}{sh} ... \end{minted}

I have been able to specify float treatment as H, which stops the minted sections from being interrupted. Though I would prefer to specify that a section cannot be interrupted rather than specify where a float must go

  • So you mean that floats are placed on top of the next page and under the float your minted code continues? Please show a minimal code example to help us help you. – TeXnician Dec 02 '17 at 16:37
  • yes, if a minted block flows over a page onto the next page, then there may be a float inserted at the top of that next page - and the minted block continues under the float – Zach Smith Dec 02 '17 at 19:08
  • code snippet added @TeXnician! – Zach Smith Dec 02 '17 at 19:14
  • 1
    @ZachSmith the question would improve further if you post a 'real' minimal working example (MWE), i.e., a complete document starting with \documentclass and ending with \end{document} which potential answerers can run directly to get the current situation (a minted block interrupted by a table). This would allow answerers to try out potential solutions without spending effort to recreate what you already have, and it also avoids potential problems of starting with a different initial situation and finding solutions that do not solve the original problem. – Marijn Dec 03 '17 at 11:16

0 Answers0