Later versions of the package tcolorbox
allows formatting source code with its minted
library (which uses the minted
package).
When a document is compiled, a temporary file with extension .pyg
is generated with LaTeX code created by the pygmentize
Python application.
I have noticed that with Python3 this generated file may differ from run to run, with its lines sorted differently each time. The lines are the same at each run, but not necessarily in the same order.
This is making latexmk
run indefinitely when compiling a document. That happens because latexmk
determines if a new run of the latex compiler is needed based on a checksum of the input files.
This bad behaviour is not seen with Python2.
Here is a minimal working example test.tex
:
\documentclass{article}
\usepackage[minted]{tcolorbox}
\begin{document}
\begin{tcblisting}{listing engine=minted, minted language=java}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
\end{tcblisting}
\end{document}
Compilation command:
latexmk -pvc -pdf -latexoption=-shell-escape test
latexmk
has in its output message:
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'test.pyg'
Latexmk: Maximum runs of pdflatex reached without getting stable files
I am looking for a fix for tcolorbox
using Python3.
.pyg
files from the checks made bylatexmk
; they are used for the current run, not for the next one, so the fact that they heve changed is irrelevant.%hash_calc_ignore_pattern
in thelatexmk
docs. I expect that a rule something like$hash_calc_ignore_pattern{'pyg'} = '.*';
should work. As far as I can tell, there isn't a way just to ignore files with a particular extension, which would be more efficient.latexmk
ignore all lines of all files with the.pyg
extension works for me. Maybe you want to add this as an answer. But this is an workaround. The generation of the file should be deterministic, in my opinion.