I'm using Minted to show my Javascript Code. It seems not possible to spread a code with Minted over two pages.
So i do it like shown in Algorithm over two pages, with itemized lists. But the Code reset the line counting. They use : \algstore{myalg}
and \algrestore{myalg}
for Algorithms. is there a same instructions to saving counting for Minted?
Code :
\documentclass{article}
% define the program :
\newfloat{program}{tbp}{lop}}%
\usepackage{caption}
\usepackage{minted}
\newminted{javascript}{bgcolor=lightgray,linenos=true,fontfamily=courier,fontsize=\footnotesize,frame=single}
\begin{document}
\begin{program}[H]
\begin{javascriptcode}
\\Code Part 1
\end{javascriptcode}
\caption{Same Caption}
\label{prog:samelabel}
\end{program}
\newpage
\begin{program}[H]
\ContinuedFloat
\begin{javascriptcode}
\\Code Part 2
\end{javascriptcode}
\caption{Same Caption}
\label{prog:samelabel}
\end{program}
\end{document}
Overview First Page
1 <html>
2 <body>
3 <script type="text/javascript">
4 document.write("Ich bin ein Javascript Code!");
Program 1.2 Same Caption
Overview Second Page
1 </script>
2 </body>
3 </html>
Program 1.2 Same Caption
That the caption are the same is ok, but the numbering is resetting on the next page.
Edit 1:
In the Minted and Fancyvrb Documentation i see an Option : [firstnumber=last]
that means that the numbering is continued from the previous Float.
How can i use it here? i tried :
\begin{program}[H]
\ContinuedFloat
\begin{javascriptcode}[firstnumber=last]
but this dont do the Trick.
Best Answer
I found a way to resolve it :