I have source long listings (2+ pages) that I highlight using minited via \inputminted. I wish to have have a caption and a reference label for the listing in \listoflistings and in my text when I refer to my code.
I have tried the attached code by I get a warning.
Package caption Warning: The option `hypcap=true' will be ignored for this (caption) particular \caption on input line 11. See the caption package documentation for explanation.
Could someone explain the correct was to do this? I do this in 13 places so I would like to understand is this the best way to achieve this?
Thanks
Stuart
\documentclass[a4paper,11pt]{report}
\usepackage[hidelinks]{hyperref} % I use XeLaTeX to pdf with hyperlinks
\usepackage{minted}
\usepackage{subcaption} %Include this in MVE as I have figures with subcaption elsewhere
\begin{document}
\listoflistings
\newpage
In my Listing~\ref{label-to-long-listing} I have more than 2 page source code listing.
\inputminted[linenos, breaklines=true,fontsize=\scriptsize, numberblanklines=false]{bash}{long.txt}
\captionof{listing}{Long Listing ToC\label{label-to-long-listing}}
\end{document}