How to build a Makefile that builds a LaTeX document with dependencies in one runMakefile for a latex...
What can I do if someone tampers with my SSH public key?
An Undercover Army
Finding integer solution to a quadratic equation in two unknowns
Is there a math expression equivalent to the conditional ternary operator?
After Brexit, will the EU recognize British passports that are valid for more than ten years?
Why aren't there more Gauls like Obelix?
Can I challenge the interviewer to give me a proper technical feedback?
Is this a crown race?
How to add theme from github with composer
EXM headers adding bounce@spe.sitecoremail.com as the sender
How do you make a gun that shoots melee weapons and/or swords?
Can I frame a new window without adding jack studs?
Sort Array By Month & Year | JavaScript
Short story about an infectious indestructible metal bar?
School performs periodic password audits. Is my password compromised?
Should I apply for my boss's promotion?
What does *dead* mean in *What do you mean, dead?*?
What is the best index strategy or query SELECT when performing a search/lookup BETWEEN IP address (IPv4 and IPv6) ranges?
Help! My Character is too much for her story!
Can inspiration allow the Rogue to make a Sneak Attack?
Is it a Cyclops number? "Nobody" knows!
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
What is the purpose of a disclaimer like "this is not legal advice"?
Why restrict private health insurance?
How to build a Makefile that builds a LaTeX document with dependencies in one run
Makefile for a latex reportUse MiKTeX option through latexmklatexmk: Multiple custom-generated files and inputMakefile that prevents tex directory from being cluttered with build outputHow to provide a Makefile to Texlipse?Latexmk - Non-existent destination filesLatexMK incorrectly tries to build files used by mintedDetermine within LaTeX how many times latexmk have runWhich build system should I prefer if I want to distribute tex files?Get latexmk's warning summary without rerunning pdflatex (more than once)?Cleaning intermediate files from custom latexmk dependencies without deleting the final PDF
I am trying to create a Makefile for my paper where I can type just make and it will compile everything in one go. The paper has several figures which are generated from scripts. However, everything I've tried requires several runs of make to get both the scripts to run and the paper itself.
I started with something based on this answer
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -halt-on-error -pdf -M -MP -MF $*.d $*
some-plot.pgf:
script_to_generate_plot.py
-include *.d
However, from a clean build, or whenever I add a plot, this requires running make twice, once to generate the .d file and once to actually build the paper. And annoyingly the first time you just have to bypass an annoying "file not found" prompt.
I then noticed that latexmk has a flag to use make to build missing files, so I'm trying that:
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -interaction=nonstopmode -pdf -dvi- -ps- -use-make $*
some-plot.pgf:
python script_to_generate_plot.py
Now what this does is finds one plot missing, build it, then fails with
Latexmk: 'pdflatex': source file 'some-plot.pgf' doesn't exist. I'll try making it...
------------
Running 'make "some-plot.pgf"'
------------
python script_to_generate_plot.py
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
make: *** [paper.pdf] Error 12
If I run make again that plot was built, but it does the same thing with another one.
If I keep running make it eventually builds all my plots one by one (I have several plots, some of which take a while to generate so I'd like to keep the scripts to generate them separate).
How can I make it so that it builds everything in one go, regardless of which and how many files need to be regenerated?
EDIT I guess I forgot to mention that my other goal here is to avoid manually stating every .tex/.pgf/.pdf file dependency in my Makefile. If I do that, there's no point to using latexmk. I've done the manual Makefile before, but I'm always forgetting to update the dependency graph whenever I add a new file or rearrange things. My understanding is that the strength of latexmk is that it can figure that stuff out automatically. If I can get something that does that, that would be ideal. That and latexmk automatically rebuilds the paper and bib files as many times as necessary.
EDIT 2
I tried using the suggestion from the output, to use the -f flag to latexmk. This builds about 5 or so plots, then errors with
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'origen-meeseeks.pgf'
Latexmk: Maximum runs of pdflatex reached without getting stable files
Failure to make 'paper.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Did not finish processing file 'paper':
'pdflatex' needed too many passes
make: *** [paper.pdf] Error 12
transmutagen-papermaster*=$latexmk -
So it almost does what I want. How do I increase the max number of passes?
luatex latexmk makefile
|
show 2 more comments
I am trying to create a Makefile for my paper where I can type just make and it will compile everything in one go. The paper has several figures which are generated from scripts. However, everything I've tried requires several runs of make to get both the scripts to run and the paper itself.
I started with something based on this answer
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -halt-on-error -pdf -M -MP -MF $*.d $*
some-plot.pgf:
script_to_generate_plot.py
-include *.d
However, from a clean build, or whenever I add a plot, this requires running make twice, once to generate the .d file and once to actually build the paper. And annoyingly the first time you just have to bypass an annoying "file not found" prompt.
I then noticed that latexmk has a flag to use make to build missing files, so I'm trying that:
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -interaction=nonstopmode -pdf -dvi- -ps- -use-make $*
some-plot.pgf:
python script_to_generate_plot.py
Now what this does is finds one plot missing, build it, then fails with
Latexmk: 'pdflatex': source file 'some-plot.pgf' doesn't exist. I'll try making it...
------------
Running 'make "some-plot.pgf"'
------------
python script_to_generate_plot.py
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
make: *** [paper.pdf] Error 12
If I run make again that plot was built, but it does the same thing with another one.
If I keep running make it eventually builds all my plots one by one (I have several plots, some of which take a while to generate so I'd like to keep the scripts to generate them separate).
How can I make it so that it builds everything in one go, regardless of which and how many files need to be regenerated?
EDIT I guess I forgot to mention that my other goal here is to avoid manually stating every .tex/.pgf/.pdf file dependency in my Makefile. If I do that, there's no point to using latexmk. I've done the manual Makefile before, but I'm always forgetting to update the dependency graph whenever I add a new file or rearrange things. My understanding is that the strength of latexmk is that it can figure that stuff out automatically. If I can get something that does that, that would be ideal. That and latexmk automatically rebuilds the paper and bib files as many times as necessary.
EDIT 2
I tried using the suggestion from the output, to use the -f flag to latexmk. This builds about 5 or so plots, then errors with
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'origen-meeseeks.pgf'
Latexmk: Maximum runs of pdflatex reached without getting stable files
Failure to make 'paper.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Did not finish processing file 'paper':
'pdflatex' needed too many passes
make: *** [paper.pdf] Error 12
transmutagen-papermaster*=$latexmk -
So it almost does what I want. How do I increase the max number of passes?
luatex latexmk makefile
I don't know aboutlatexmk. However, formake, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's howmakeworks: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient andmakewill figure out what to do in what order.
– cfr
Nov 16 '17 at 2:39
1
So%.pdf: %.texshouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.
– cfr
Nov 16 '17 at 2:41
I'm also by no means an expert onlatexmk, but isn't it odd to uselatexmkinside amakefile, especially whenlatexmkis (additionally) told to (try to) 'usemake?
– jon
Nov 16 '17 at 3:10
It is weird. My idea was thatmakewould calllatexmk(without me having to type all the arguments each time like-lualatex), thenlatexmkwould callmaketo build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separatemakeprocess that builds the plots.
– asmeurer
Nov 16 '17 at 21:15
In the way of usinglatexmkgiven in the first Makefile, the options given tolatexmktell it to generate dependency information in a form that is read bymakewhen it executes the-includeline. That's been removed from the second version, which shows an incorrect way of callinglatexmkfrom a Makefile. The first Makefile is a good way of combining the use oflatexmkandmake.
– John Collins
Nov 18 '17 at 23:02
|
show 2 more comments
I am trying to create a Makefile for my paper where I can type just make and it will compile everything in one go. The paper has several figures which are generated from scripts. However, everything I've tried requires several runs of make to get both the scripts to run and the paper itself.
I started with something based on this answer
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -halt-on-error -pdf -M -MP -MF $*.d $*
some-plot.pgf:
script_to_generate_plot.py
-include *.d
However, from a clean build, or whenever I add a plot, this requires running make twice, once to generate the .d file and once to actually build the paper. And annoyingly the first time you just have to bypass an annoying "file not found" prompt.
I then noticed that latexmk has a flag to use make to build missing files, so I'm trying that:
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -interaction=nonstopmode -pdf -dvi- -ps- -use-make $*
some-plot.pgf:
python script_to_generate_plot.py
Now what this does is finds one plot missing, build it, then fails with
Latexmk: 'pdflatex': source file 'some-plot.pgf' doesn't exist. I'll try making it...
------------
Running 'make "some-plot.pgf"'
------------
python script_to_generate_plot.py
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
make: *** [paper.pdf] Error 12
If I run make again that plot was built, but it does the same thing with another one.
If I keep running make it eventually builds all my plots one by one (I have several plots, some of which take a while to generate so I'd like to keep the scripts to generate them separate).
How can I make it so that it builds everything in one go, regardless of which and how many files need to be regenerated?
EDIT I guess I forgot to mention that my other goal here is to avoid manually stating every .tex/.pgf/.pdf file dependency in my Makefile. If I do that, there's no point to using latexmk. I've done the manual Makefile before, but I'm always forgetting to update the dependency graph whenever I add a new file or rearrange things. My understanding is that the strength of latexmk is that it can figure that stuff out automatically. If I can get something that does that, that would be ideal. That and latexmk automatically rebuilds the paper and bib files as many times as necessary.
EDIT 2
I tried using the suggestion from the output, to use the -f flag to latexmk. This builds about 5 or so plots, then errors with
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'origen-meeseeks.pgf'
Latexmk: Maximum runs of pdflatex reached without getting stable files
Failure to make 'paper.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Did not finish processing file 'paper':
'pdflatex' needed too many passes
make: *** [paper.pdf] Error 12
transmutagen-papermaster*=$latexmk -
So it almost does what I want. How do I increase the max number of passes?
luatex latexmk makefile
I am trying to create a Makefile for my paper where I can type just make and it will compile everything in one go. The paper has several figures which are generated from scripts. However, everything I've tried requires several runs of make to get both the scripts to run and the paper itself.
I started with something based on this answer
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -halt-on-error -pdf -M -MP -MF $*.d $*
some-plot.pgf:
script_to_generate_plot.py
-include *.d
However, from a clean build, or whenever I add a plot, this requires running make twice, once to generate the .d file and once to actually build the paper. And annoyingly the first time you just have to bypass an annoying "file not found" prompt.
I then noticed that latexmk has a flag to use make to build missing files, so I'm trying that:
all: paper.pdf
paper.pdf:
%.pdf: %.tex
$(LATEXMK) -lualatex -interaction=nonstopmode -pdf -dvi- -ps- -use-make $*
some-plot.pgf:
python script_to_generate_plot.py
Now what this does is finds one plot missing, build it, then fails with
Latexmk: 'pdflatex': source file 'some-plot.pgf' doesn't exist. I'll try making it...
------------
Running 'make "some-plot.pgf"'
------------
python script_to_generate_plot.py
Latexmk: Summary of warnings:
Latex failed to resolve 1 reference(s)
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
make: *** [paper.pdf] Error 12
If I run make again that plot was built, but it does the same thing with another one.
If I keep running make it eventually builds all my plots one by one (I have several plots, some of which take a while to generate so I'd like to keep the scripts to generate them separate).
How can I make it so that it builds everything in one go, regardless of which and how many files need to be regenerated?
EDIT I guess I forgot to mention that my other goal here is to avoid manually stating every .tex/.pgf/.pdf file dependency in my Makefile. If I do that, there's no point to using latexmk. I've done the manual Makefile before, but I'm always forgetting to update the dependency graph whenever I add a new file or rearrange things. My understanding is that the strength of latexmk is that it can figure that stuff out automatically. If I can get something that does that, that would be ideal. That and latexmk automatically rebuilds the paper and bib files as many times as necessary.
EDIT 2
I tried using the suggestion from the output, to use the -f flag to latexmk. This builds about 5 or so plots, then errors with
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'origen-meeseeks.pgf'
Latexmk: Maximum runs of pdflatex reached without getting stable files
Failure to make 'paper.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Did not finish processing file 'paper':
'pdflatex' needed too many passes
make: *** [paper.pdf] Error 12
transmutagen-papermaster*=$latexmk -
So it almost does what I want. How do I increase the max number of passes?
luatex latexmk makefile
luatex latexmk makefile
edited Nov 16 '17 at 21:38
asmeurer
asked Nov 15 '17 at 23:04
asmeurerasmeurer
274215
274215
I don't know aboutlatexmk. However, formake, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's howmakeworks: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient andmakewill figure out what to do in what order.
– cfr
Nov 16 '17 at 2:39
1
So%.pdf: %.texshouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.
– cfr
Nov 16 '17 at 2:41
I'm also by no means an expert onlatexmk, but isn't it odd to uselatexmkinside amakefile, especially whenlatexmkis (additionally) told to (try to) 'usemake?
– jon
Nov 16 '17 at 3:10
It is weird. My idea was thatmakewould calllatexmk(without me having to type all the arguments each time like-lualatex), thenlatexmkwould callmaketo build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separatemakeprocess that builds the plots.
– asmeurer
Nov 16 '17 at 21:15
In the way of usinglatexmkgiven in the first Makefile, the options given tolatexmktell it to generate dependency information in a form that is read bymakewhen it executes the-includeline. That's been removed from the second version, which shows an incorrect way of callinglatexmkfrom a Makefile. The first Makefile is a good way of combining the use oflatexmkandmake.
– John Collins
Nov 18 '17 at 23:02
|
show 2 more comments
I don't know aboutlatexmk. However, formake, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's howmakeworks: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient andmakewill figure out what to do in what order.
– cfr
Nov 16 '17 at 2:39
1
So%.pdf: %.texshouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.
– cfr
Nov 16 '17 at 2:41
I'm also by no means an expert onlatexmk, but isn't it odd to uselatexmkinside amakefile, especially whenlatexmkis (additionally) told to (try to) 'usemake?
– jon
Nov 16 '17 at 3:10
It is weird. My idea was thatmakewould calllatexmk(without me having to type all the arguments each time like-lualatex), thenlatexmkwould callmaketo build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separatemakeprocess that builds the plots.
– asmeurer
Nov 16 '17 at 21:15
In the way of usinglatexmkgiven in the first Makefile, the options given tolatexmktell it to generate dependency information in a form that is read bymakewhen it executes the-includeline. That's been removed from the second version, which shows an incorrect way of callinglatexmkfrom a Makefile. The first Makefile is a good way of combining the use oflatexmkandmake.
– John Collins
Nov 18 '17 at 23:02
I don't know about
latexmk. However, for make, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's how make works: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient and make will figure out what to do in what order.– cfr
Nov 16 '17 at 2:39
I don't know about
latexmk. However, for make, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's how make works: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient and make will figure out what to do in what order.– cfr
Nov 16 '17 at 2:39
1
1
So
%.pdf: %.tex shouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.– cfr
Nov 16 '17 at 2:41
So
%.pdf: %.tex shouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.– cfr
Nov 16 '17 at 2:41
I'm also by no means an expert on
latexmk, but isn't it odd to use latexmk inside a make file, especially when latexmk is (additionally) told to (try to) 'use make?– jon
Nov 16 '17 at 3:10
I'm also by no means an expert on
latexmk, but isn't it odd to use latexmk inside a make file, especially when latexmk is (additionally) told to (try to) 'use make?– jon
Nov 16 '17 at 3:10
It is weird. My idea was that
make would call latexmk (without me having to type all the arguments each time like -lualatex), then latexmk would call make to build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separate make process that builds the plots.– asmeurer
Nov 16 '17 at 21:15
It is weird. My idea was that
make would call latexmk (without me having to type all the arguments each time like -lualatex), then latexmk would call make to build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separate make process that builds the plots.– asmeurer
Nov 16 '17 at 21:15
In the way of using
latexmk given in the first Makefile, the options given to latexmk tell it to generate dependency information in a form that is read by make when it executes the -include line. That's been removed from the second version, which shows an incorrect way of calling latexmk from a Makefile. The first Makefile is a good way of combining the use of latexmk and make.– John Collins
Nov 18 '17 at 23:02
In the way of using
latexmk given in the first Makefile, the options given to latexmk tell it to generate dependency information in a form that is read by make when it executes the -include line. That's been removed from the second version, which shows an incorrect way of calling latexmk from a Makefile. The first Makefile is a good way of combining the use of latexmk and make.– John Collins
Nov 18 '17 at 23:02
|
show 2 more comments
1 Answer
1
active
oldest
votes
As I noted in my edit, if you add the -f flag to latexmk, it continues after each plot is generated and tries again.
Unfortunately, these "re-runs" are counted as part of the number of times latexmk calls latex to build the document. By default, it only does 5 of these, but you can modify this with a configuration parameter. Create a file .latexmkrc in the directory with your tex files and add
$max_repeat = 10
(replace 10 with some number bigger than the number of plots you have, probably at least 5 more than that).
I personally would consider these to be bugs in latexmk (building more than a single thing with make shouldn't require -f, each call to make shouldn't count against the max_repeat).
You also do need to add the file dependencies manually in the Makefile
paper.pdf: some-plot.pgf
I don't know if there's a way to make the -MF stuff from latexmk work properly with just one Make run that both generates and uses them.
I agree that if the only error fromlualatexis a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use-interaction=nonstopmodeto get all the missing-file errors in one batch. Only for later invocations would-halt-on-errorbe natural.
– John Collins
Nov 18 '17 at 23:16
1
However, for missing files, you shouldn't need the-foption.Latexmkis intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either inlatexmk's interaction withmakeor elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in thelatexmkdocumentation).
– John Collins
Nov 18 '17 at 23:22
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f401540%2fhow-to-build-a-makefile-that-builds-a-latex-document-with-dependencies-in-one-ru%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As I noted in my edit, if you add the -f flag to latexmk, it continues after each plot is generated and tries again.
Unfortunately, these "re-runs" are counted as part of the number of times latexmk calls latex to build the document. By default, it only does 5 of these, but you can modify this with a configuration parameter. Create a file .latexmkrc in the directory with your tex files and add
$max_repeat = 10
(replace 10 with some number bigger than the number of plots you have, probably at least 5 more than that).
I personally would consider these to be bugs in latexmk (building more than a single thing with make shouldn't require -f, each call to make shouldn't count against the max_repeat).
You also do need to add the file dependencies manually in the Makefile
paper.pdf: some-plot.pgf
I don't know if there's a way to make the -MF stuff from latexmk work properly with just one Make run that both generates and uses them.
I agree that if the only error fromlualatexis a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use-interaction=nonstopmodeto get all the missing-file errors in one batch. Only for later invocations would-halt-on-errorbe natural.
– John Collins
Nov 18 '17 at 23:16
1
However, for missing files, you shouldn't need the-foption.Latexmkis intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either inlatexmk's interaction withmakeor elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in thelatexmkdocumentation).
– John Collins
Nov 18 '17 at 23:22
add a comment |
As I noted in my edit, if you add the -f flag to latexmk, it continues after each plot is generated and tries again.
Unfortunately, these "re-runs" are counted as part of the number of times latexmk calls latex to build the document. By default, it only does 5 of these, but you can modify this with a configuration parameter. Create a file .latexmkrc in the directory with your tex files and add
$max_repeat = 10
(replace 10 with some number bigger than the number of plots you have, probably at least 5 more than that).
I personally would consider these to be bugs in latexmk (building more than a single thing with make shouldn't require -f, each call to make shouldn't count against the max_repeat).
You also do need to add the file dependencies manually in the Makefile
paper.pdf: some-plot.pgf
I don't know if there's a way to make the -MF stuff from latexmk work properly with just one Make run that both generates and uses them.
I agree that if the only error fromlualatexis a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use-interaction=nonstopmodeto get all the missing-file errors in one batch. Only for later invocations would-halt-on-errorbe natural.
– John Collins
Nov 18 '17 at 23:16
1
However, for missing files, you shouldn't need the-foption.Latexmkis intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either inlatexmk's interaction withmakeor elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in thelatexmkdocumentation).
– John Collins
Nov 18 '17 at 23:22
add a comment |
As I noted in my edit, if you add the -f flag to latexmk, it continues after each plot is generated and tries again.
Unfortunately, these "re-runs" are counted as part of the number of times latexmk calls latex to build the document. By default, it only does 5 of these, but you can modify this with a configuration parameter. Create a file .latexmkrc in the directory with your tex files and add
$max_repeat = 10
(replace 10 with some number bigger than the number of plots you have, probably at least 5 more than that).
I personally would consider these to be bugs in latexmk (building more than a single thing with make shouldn't require -f, each call to make shouldn't count against the max_repeat).
You also do need to add the file dependencies manually in the Makefile
paper.pdf: some-plot.pgf
I don't know if there's a way to make the -MF stuff from latexmk work properly with just one Make run that both generates and uses them.
As I noted in my edit, if you add the -f flag to latexmk, it continues after each plot is generated and tries again.
Unfortunately, these "re-runs" are counted as part of the number of times latexmk calls latex to build the document. By default, it only does 5 of these, but you can modify this with a configuration parameter. Create a file .latexmkrc in the directory with your tex files and add
$max_repeat = 10
(replace 10 with some number bigger than the number of plots you have, probably at least 5 more than that).
I personally would consider these to be bugs in latexmk (building more than a single thing with make shouldn't require -f, each call to make shouldn't count against the max_repeat).
You also do need to add the file dependencies manually in the Makefile
paper.pdf: some-plot.pgf
I don't know if there's a way to make the -MF stuff from latexmk work properly with just one Make run that both generates and uses them.
edited 1 min ago
answered Nov 16 '17 at 21:48
asmeurerasmeurer
274215
274215
I agree that if the only error fromlualatexis a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use-interaction=nonstopmodeto get all the missing-file errors in one batch. Only for later invocations would-halt-on-errorbe natural.
– John Collins
Nov 18 '17 at 23:16
1
However, for missing files, you shouldn't need the-foption.Latexmkis intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either inlatexmk's interaction withmakeor elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in thelatexmkdocumentation).
– John Collins
Nov 18 '17 at 23:22
add a comment |
I agree that if the only error fromlualatexis a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use-interaction=nonstopmodeto get all the missing-file errors in one batch. Only for later invocations would-halt-on-errorbe natural.
– John Collins
Nov 18 '17 at 23:16
1
However, for missing files, you shouldn't need the-foption.Latexmkis intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either inlatexmk's interaction withmakeor elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in thelatexmkdocumentation).
– John Collins
Nov 18 '17 at 23:22
I agree that if the only error from
lualatex is a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use -interaction=nonstopmode to get all the missing-file errors in one batch. Only for later invocations would -halt-on-error be natural.– John Collins
Nov 18 '17 at 23:16
I agree that if the only error from
lualatex is a missing file error, and the file gets created, then it appears to be a good idea not to count the run towards the maximum. I'll consider this for another release. As I wrote in another comment, I normally find it better to use -interaction=nonstopmode to get all the missing-file errors in one batch. Only for later invocations would -halt-on-error be natural.– John Collins
Nov 18 '17 at 23:16
1
1
However, for missing files, you shouldn't need the
-f option. Latexmk is intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either in latexmk's interaction with make or elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in the latexmk documentation).– John Collins
Nov 18 '17 at 23:22
However, for missing files, you shouldn't need the
-f option. Latexmk is intended to continue processing after the missing file is made, which is different from it's behavior with other kinds of error. So there's probably some other difficulty either in latexmk's interaction with make or elsewhere. It's probably going to be too hard to work this out here. You could contact me offline (at the address in the latexmk documentation).– John Collins
Nov 18 '17 at 23:22
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f401540%2fhow-to-build-a-makefile-that-builds-a-latex-document-with-dependencies-in-one-ru%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't know about
latexmk. However, formake, you need to tell it that the final PDF requires the plot's PDF. Then it will know not to apply the rule to make the final PDF until it has made the plot's PDF. (Or the plot's PGF or whatever it needs.) Then you just need a rule to make the plot's PDF. That's howmakeworks: you tell it what ingredients each target needs and provide a recipe for turning the ingredients into the target. One target can have another target as an ingredient andmakewill figure out what to do in what order.– cfr
Nov 16 '17 at 2:39
1
So
%.pdf: %.texshouldn't tell make that only one ingredient is needed for all PDFs because that's a lie! One of the PDFs needs another ingredient, so you need to list that ingredient, too.– cfr
Nov 16 '17 at 2:41
I'm also by no means an expert on
latexmk, but isn't it odd to uselatexmkinside amakefile, especially whenlatexmkis (additionally) told to (try to) 'usemake?– jon
Nov 16 '17 at 3:10
It is weird. My idea was that
makewould calllatexmk(without me having to type all the arguments each time like-lualatex), thenlatexmkwould callmaketo build the dependencies. So it shouldn't actually require the dependencies in the Makefile, because it's a separatemakeprocess that builds the plots.– asmeurer
Nov 16 '17 at 21:15
In the way of using
latexmkgiven in the first Makefile, the options given tolatexmktell it to generate dependency information in a form that is read bymakewhen it executes the-includeline. That's been removed from the second version, which shows an incorrect way of callinglatexmkfrom a Makefile. The first Makefile is a good way of combining the use oflatexmkandmake.– John Collins
Nov 18 '17 at 23:02