Latexmk says the file is up-to-date, while it's not
An option could be to add the -g
flag when using latexmk:
latexmk -pdf -g main.tex
From the latexmk
documentation for -g
Force latexmk to process document fully, even under situations where latexmk would normally decide that no changes in the source files have occurred since the previous run.
With GNU make
As a side note, this may be of help when mixing GNU make
and latexmk
. If the latexmk
command is executed by make,
there must have been a change in the prerequisites of main.pdf.
latexmk
does not seem to always pick this up and returns All targets (main.pdf) are up-to-date.
With -g
, however, compilation is enforced at least once.
In the case of make,
adding the option -use-make
latexmk -pdf -g -use-make main.tex
may also be worthwhile, as it causes latexmk
to call make
to create whatever it was missing as input.
For other situations, without make,
it probably depends on wether you are willing to incur the cost of at least one compilation run, even in cases where it is unnecessary.
This happens to me frequently. When it does, the cause is always the same. I compile to pdf, but while I have the existing pdf from the last compile open in Acrobat Reader. The compile completes but cannot write to the pdf. If I then recompile I get your error (i.e pdf is not up to date, but the compiler says it is).
The solution is to delete the pdf before re-compiling the second time.
-recorder
Another noteworthy point is that the option -recorder
should be enabled.
The .fls
file of the OP contains only two INPUT
lines which indicate that the -recorder
option is not enabled. If -recorder
is enabled, all input files such as chapters/one
, the bib file and more will be added and latexmk can detect changes here:
man latexmk
(Version 4.52c) says
-recorder
Give the -recorder option with latex and pdflatex. In (most) modern versions of these
programs, this results in a file of extension .fls containing a list of the files that
these programs have read and written. Latexmk will then use this file to improve its
detection of source files and generated files after a run of latex or pdflatex. This
is the default setting of latexmk, unless overridden in an initialization file.
For further information, see the documentation for the $recorder configuration variable.