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

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.