I'm writing a book which will include and explain a handful of different memoir page layouts.
Setting the scene
In the book, I want to imbed thumbnails of pages from PDFs generated with the page layouts, which I'm successfully doing with \includegraphics[...]{<pdfname>}.
The top-level document, ''mlayout.tex'', then, includes pages from a series of PDFs, called ''mlayout-a'', ''mlayout-b'', etc.
At the next level, the documents (''mlayout-a.tex'' etc) set the style (a,b,c...) in a couple of lines, and end with \input{mlayout-text}
''mlayout-text.tex'' contains the lipsum stuff. I need to illustrate some specific things like \marginpars that lipsum or blindtext can't do for me, so that's why I use this third-level file.
The problem
This nesting of dependencies seems to demand latexmk; if I change mlayout-text.tex, it will (I hope) enable me simply to reprocess mlayout.tex and thereby regenerate, automatically, all the intermediate PDFs.
The first try, with no modifications to latexmkrc, didn't attempt to produce the intermediate PDFs, so I added a custom dependency to latexmkrc:
add_cus_dep('tex', 'pdf', 0, 'maketex2pdf');
sub maketex2pdf {
system("latexmk -pdf $_[0]");
}
But, as far as I can tell, it still doesn't detect changes to the lowest-level file (mlayout-text).
What am I doing wrong?
Note: I haven't included an MWE (to save a lot of space and a fair amount of time); if you think the question needs one, please comment and I'll add a custom-made (i.e. small) one.