10

For some reason the pdflatexmk typesetter is sometimes not recognising changes in my file and it returns:

Latexmk: All targets (main.pdf) are up-to-date

while the target is not up-to-date. When I type something in three.tex, click save and then typeset, sometimes it typesets fine, sometimes it shows the above message. When the above message is shown I need to type some more text, and try to typeset again. After several tries it will typeset normally.

I've included a stripped down version of my files below:

main.tex:

% !TEX TS-program = pdflatexmk

\documentclass[12pt,a4paper,titlepage,final]{report}

\usepackage[paper=a4paper, hmargin=2.5cm, vmargin=0cm]{geometry} 
\usepackage{caption}                    
\usepackage{geometry}
\usepackage{fancyhdr}                   
\usepackage{graphicx}                   
\usepackage[toc,nonumberlist]{glossaries}       
\usepackage{pdfsync}                    
\usepackage[T1]{fontenc}                    
\usepackage[applemac]{inputenc}         
\usepackage[section]{placeins}                    
\usepackage{parskip}                    
\usepackage{amsmath}                    
\usepackage{natbib}                 
\usepackage{tikz}                       
\usepackage{pgfplots}                   
\usetikzlibrary{plotmarks}          

\includeonly{chapters/three}

\begin{document}
\include{chapters/one}
\include{chapters/two}
\include{chapters/three}

\bibliographystyle{apalike}
\biblipgraphy{refs}
\addcontentsline{toc}{chapter}{Bibliography}

\end{document}

three.tex (located in folder ./chapters):

% !TEX root = ../main.tex
\chapter{Three}
\label{chap:three}

Text, figures and equations

I'm using TeXShop 3.23 on Mac OSX 10.8.4. It all worked fine for months with this setup, but now something has changed (no clue what).

Update:
I found a file in the main directory named pdflatex24719.fls that contained the following:

PWD /Users/user/Documents/Dropbox/main
INPUT /usr/local/texlive/2012/texmf.cnf
INPUT /usr/local/texlive/2012/texmf/web2c/texmf.cnf

I've never seen the file before, so I decided to delete it. After deletion all worked fine again as it should.

Update 2: And the behaviour is back again. Although I have changed the text in three.tex pdflatexmk still says it's up-to-date.

Update 3: I found out that the .pdf is updated. When I open it with Preview.app I see the updated version. However, the TexShop preview window keeps showing the old .pdf file.

Update 4: Following the advice of texenthusiast I created a sample bibliography refs.bib and a sample tex file sample.tex. The latter looks as follows:

\documentclass[12pt,a4paper,titlepage,final]{report}
\begin{document}

test citing~\cite{Rom1992}

\bibliographystyle{apalike}
\bibliography{refs}
\end{document}

While in the folder of the sample.tex I ran latexmk -pdf sample.tex in the Terminal and checked the pdf file. After I made an edit to the .tex file I ran the command again. The change was reflected in the pdf file.

10
  • what's your latexmk -v version Commented Aug 19, 2013 at 18:29
  • Latexmk: This is Latexmk, John Collins, 2 July 2013, version: 4.37. Commented Aug 19, 2013 at 18:34
  • Are you having Two versions(2012 & 2013) side by side of TeX distro on Mac ? Did you try terminal approach deleting all .aux files Commented Aug 19, 2013 at 18:36
  • I only have the 2012 TeX distro. I deleted all the .aux files, but that didn't solve the problem. Commented Aug 19, 2013 at 18:46
  • 1
    For what it's worth, I am unable to reproduce the problem with the same source files and TeXShop 2.47 under TeXLive 2013 on OS-X 10.6.8, and the current version of latexmk. Commented Aug 21, 2013 at 12:57

3 Answers 3

6

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.

3
  • I just ran into this issue, but the PDF appears to update just fine in evince. It seems latexmk just isn't updating the filetime. Adding touch $@ to the end of my rule fixes it.
    – jozxyqk
    Commented Dec 8, 2014 at 12:43
  • @jozxqk: If the pdf-file is not regenerated, the timestamp (filetime) of the file of course does not change. If the pdf-file is regenerated, the timestamp changes. So does latexmk. So I do not really understand your comment. I am surprised that touch $@ helps which shouldn't. See e.g. superuser.com/questions/27357/….
    – Hotschke
    Commented Aug 3, 2015 at 11:18
  • For me, just closing the .pdf without deleting it, solves the problem
    – JKHA
    Commented Jun 6, 2019 at 15:18
9

An option could be to add the -g flag when using latexmk:

latexmk -pdf -g main.tex

From the latexmkdocumentation 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.

3

-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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .