TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One latex run suffices to generate the DVI/PDF version of the LaTeX document







By contrast, latexmk thinks that two latex runs are necessary. The reason for this is the following: Since comments are to be included the comment environment writes its content to an intermediate file (by default comment.cut). Latexmk treats comment.cut similar to other intermediate files (such as the toc and lof files) and thus provides for another latex run. What latexmk misses is that comment.cut is input right at the end of the comment environment and that it’s useless afterwards. Hence, the second latex run is superfluous.

Does anybody know whether it’s possible to configure latexmk such that it completely ignores specific intermediate files?

share|improve this question
Maybe it would make sense to submit this is as a bug report to the latexmk developers? – N.N. Jan 11 '12 at 7:42
@N.N.: If nobody suggests a reasonable workaround by means of customization I’ll do so. Possibly, similar issues arise with packages other than the comment package. – mhp Jan 11 '12 at 9:22
I just meant that if this is non-intended or problematic behavior of latexmk it would make sense to let the developers know. – N.N. Jan 11 '12 at 9:27
Have you tried to run latexmk with the -diagnostics option to better understand its behavior? It is described as follows in the manual: "Print detailed diagnostics during a run. This may help for debugging problems or to understand latexmk's behavior in difficult situations." – N.N. Jan 11 '12 at 9:31
@N.N.: comment.cut is correctly detected as dependent file since it’s written by (pdf)latex. But, probably, it should not be treated as a source file. Then, the (pdf)latex rule might not consider it a prerequisite. – mhp Jan 11 '12 at 11:05
up vote 3 down vote accepted

@mhp: Your diagnosis is correct. comment.cut is detected as a dependent file, and latexmk does a rerun of the (pdf)latex rule when it sees that a dependent file has changed. It makes no attempt to determine whether the change has an actual effect on the output.

With current implementations of tex, the recorder option is available, and can be used by latexmk. There is then sufficient information to determine whether a file is read only after it has been written in the same run. It would be a useful optimization for latexmk to detect this situation, and deal with it. I'll add it to the list of improvements.

Note that the excess rerun is normally rare: it only happens if the contents of the comment environment have changed.

share|improve this answer
Thanks for your explanation! Actually, I only noticed the excess reruns since, in my specific case, they happen every time: I use two differently named comment environments to typeset two versions of a document simultaneously. – mhp Jan 12 '12 at 22:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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