3

enter image description here

\begin{listing}[p]
\centering
\inputminted[linenos, frame=lines, firstline=46, lastline=93]{python}{Codes/MyCode.py}
\caption{Part 1 Of Feature Extraction Python Code}
\label{listing:Feat}
\end{listing}

I am using this piece of code for python input code snippet and I'm having a trouble since the code pard isn't complete and it goes under the page number

1 Answer 1

3

A listing environment is a float, and cannot break across pages. An alternative is to not use it, and use \captionof{listing}{...\label{..}} instead of the normal \caption. This requires the caption package.

You have to be a bit careful though, that the caption alone doesn't end up on the top of the page after the code block.

enter image description here

\documentclass{article}
\usepackage{minted}
\usepackage{caption}
\begin{document}
\listoflistings
\vspace*{14cm} % just for example
\inputminted[linenos, frame=lines]{python}{mpltest.py}
\captionof{listing}{Part 1 Of Feature Extraction Python Code\label{listing:Feat}}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .