|
| 1 | +# -*- Perl -*- |
| 2 | +# This is a configuration read and used by latexmk. |
| 3 | +# Specifically, we use it to direct how to process Asymptote (asy) vector graphics. |
| 4 | + |
| 5 | +# Note the following is actually Perl code. |
| 6 | + |
| 7 | + |
| 8 | +# Check whether the Asymptote (asy) is new enough. |
| 9 | +my $min_asy_version = "2.71"; |
| 10 | +my $out = `asy --version 2>&1 | head -1`; |
| 11 | +if ($? >> 8 == 0) { |
| 12 | + # Continue checking the version number |
| 13 | + if ($out =~ /version (\d.\d+)/) { |
| 14 | + my $version = "$1"; |
| 15 | + if ($version < $min_asy_version) { |
| 16 | + print("Warning - your Asymptote version, ${version}, may be too old to handle everything.\n"); |
| 17 | + print("We would like version ${min_asy_version}. Continuing with fingers crossed...\n"); |
| 18 | + } |
| 19 | + } |
| 20 | +} else { |
| 21 | + print("Trouble checking Aymptote version -- skipping version check for ${min_asy_version}\n"); |
| 22 | +} |
| 23 | + |
| 24 | +# Check whether the Ghostscript (gs) is new enough. |
| 25 | +my $min_gs_version = "9.54"; |
| 26 | +$out = `gs --version 2>&1`; |
| 27 | +if ($? >> 8 == 0) { |
| 28 | + # Continue checking the version number |
| 29 | + if ($out =~ /(\d.\d+)/) { |
| 30 | + my $version = "$1"; |
| 31 | + if ($version < $min_gs_version) { |
| 32 | + print("Warning - your Ghostscript version, ${version}, may be too old to handle everything.\n"); |
| 33 | + print("We would like version ${min_gs_version}. Continuing with fingers crossed...\n"); |
| 34 | + } |
| 35 | + } |
| 36 | +} else { |
| 37 | + print("Trouble checking GhostScript version -- skipping version check for ${min_gs_version}\n"); |
| 38 | +} |
| 39 | + |
| 40 | + |
| 41 | +# The Redefinition of function asy below allows us to customize how to call |
| 42 | +# asy (asymptote). |
1 | 43 | sub asy {return system("asy '$_[0]' -render=0 -nosafe -noprc --gsOptions='-P'");} |
| 44 | + |
| 45 | +# The following add custom dependencies for Asymptote: |
| 46 | +# Basically the parameters are |
| 47 | +# from extension, to_extension, must (0=file does not have to exist), name of function |
| 48 | +# See the section "Custom Dependencies" under "man latexmk". |
2 | 49 | add_cus_dep("asy","eps",0,"asy"); |
3 | 50 | add_cus_dep("asy","pdf",0,"asy"); |
4 | 51 | add_cus_dep("asy","tex",0,"asy"); |
0 commit comments