You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latexmk distribution contains an example file asymptote_latexmkrc that has been developed beyond the one contained in the Asymptote repository. We should probably update the docs to link to that file instead, or else incorporate its innovations into the one in the Asymptote repository.
Some of the things it does:
Passes the desired outformat to asy via the -f flag.
Identifies additional local asy files that are imported or included. (Thus, if those dependencies change, latexmk will know to recompile.)
Here's the code of the complete file:
# This shows how to use Asymptote (http://asymptote.sourceforge.net/,# or http://www.ctan.org/pkg/asymptote/)# with latexmk. Asymptote is a vector graphics language with a# processing program that generates graphics files that can be used in# a LaTex file. ## A standard method of using it is with the asymptote LaTeX style file# (http://mirror.ctan.org/graphics/asymptote/doc/asymptote.sty)# The graphics drawing code is in the tex file, and applying pdflatex to# the tex file produces one or more files with a base name the same as# or related to the main tex file, but with the extension 'asy'. The# .asy is processed by the program asy (part of the asymptote# software) to produce graphics files (which may be eps, tex, or pdf# files) that are used the next time pdflatex is run on the main tex# file. ## Latexmk can be arranged to run asymptote (i.e., the program asy)# when needed, by defining the following custom dependency. (The code# is to be put in one of latexmk's rc files, e.g., ~/.latexmkrc.)### OLD simple method (taken from the documentation for V. 2.03 of## asymptote). These definitions are simple, but they may not always## give the desired type of output file, and they do not ensure that## latexmk has dependency information about files imported from the## asy file.#OLD sub asy {return system("asy \"$_[0]\"");}#OLD add_cus_dep("asy","eps",0,"asy");#OLD add_cus_dep("asy","pdf",0,"asy");#OLD add_cus_dep("asy","tex",0,"asy");# The following definitions arrange to run asy with the correct output# file type. They run asy in a verbose mode so that dependency# information on imported files can be extracted. To avoid adding a# lot of extra printout on the screen of unimportant messages, the# output is sent to a log file. Since this includes error messages,# which the user should see, latexmk types out error messages and the# like. These definitions need latexmk 4.48 or later.
add_cus_dep("asy","eps",0,"asy2eps");
add_cus_dep("asy","pdf",0,"asy2pdf");
add_cus_dep("asy","tex",0,"asy2tex");
subasy2eps { return asy2x( $_[0], 'eps' ); }
subasy2pdf { return asy2x( $_[0], 'pdf' ); }
subasy2tex { return asy2x( $_[0], 'tex' ); }
subasy2x {
my$ret = system("asy -vv -f '$_[1]' '$_[0]' >& '$_[0].log'");
open( my$FH, "<", "$_[0].log" );
%imp = ();
while (<$FH>) {
if (/^(Including|Loading) .* from (.*)\s*$/) {
my$import = $2;
$imp{$import} = 1;
}
elsif ( /^error/ || /^.*\.asy: \d/ ) {
warn"==Message from asy: $_";
$ret = 1;
}
elsif ( /^kpsewhich / || /^Processing / || /^Using /
|| /^Welcome / || /^Wrote /|| /^cd /|| /^gs /
) {
}
else {
warn"==Message from asy: $_";
}
}
close$FH;
# For latexmk 4.48
rdb_set_source( $rule, keys%imp );
return$ret;
}
The text was updated successfully, but these errors were encountered:
When I use the latexmkrc given in the asymptote documentation within the vscode editor, the compilation runs smoothly; replacing .latexmkrc with the one in CTAN (above) leads to errors ($TERM not defined , -T...). The only "problem" I see with the simple (original) latexmkrc is that "latexmk -c" do not clean the "pre" files...
The latexmk -c issue was already fixed in commit 3b02ca5 (and in version 2.87).
The point of the proposed CTAN version is to check for dependencies. However, it was based on an old version of latexmkrc, which also lacks the improvement introduced in commit 8c83a8e.
A better solution is to add an option to asy to output this information in a format that latexmk can use directly.
The latexmk distribution contains an example file asymptote_latexmkrc that has been developed beyond the one contained in the Asymptote repository. We should probably update the docs to link to that file instead, or else incorporate its innovations into the one in the Asymptote repository.
Some of the things it does:
asy
via the-f
flag.asy
files that are imported or included. (Thus, if those dependencies change, latexmk will know to recompile.)Here's the code of the complete file:
The text was updated successfully, but these errors were encountered: