Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fragmasterの latex 命令を変更できるようにする
--- fragmaster.pl.orig 2020-01-08 00:48:01.385031651 +0900
+++ fragmaster.pl 2020-01-08 02:08:23.383053437 +0900
@@ -43,6 +43,7 @@
my $global_fmclass = "article";
my $global_fmclassopt = "12pt";
my $global_fmopt = "";
+my $global_fmlatexcmd = "latex";
my @global_fmhead = ();
my @global_fmfile = ();
my %dirdata_last_status = ();
@@ -111,6 +112,7 @@
my @fmfile = (); # A copy of original file
my @fmhead = (); # Preamble to use
my $fmopt; # Options to \includegraphics
+ my $fmlatexcmd; # latex command to typeset
my $fmclass; # Class to use
my $fmclassopt; # Options for class invocation
@@ -125,6 +127,7 @@
push @fmfile, " $_%";
s/\s+$//; # Strip trailing whitespace
$fmopt = $1 if /fmopt:\s*(.*)/;
+ $fmlatexcmd = $1 if /fmlatexcmd:\s*(\w[-\@\w.]+)/;
$fmclass = $1 if /fmclass:\s*(.*)/;
$fmclassopt = $1 if /fmclassopt:\s*(.*)/;
if (/head:/) {
@@ -144,6 +147,7 @@
$fmdata{'fmclass'} = $fmclass if $fmclass;
$fmdata{'fmclassopt'} = $fmclassopt if $fmclassopt;
$fmdata{'fmopt'} = $fmopt if $fmopt;
+ $fmdata{'fmlatexcmd'} = $fmlatexcmd if $fmlatexcmd;
print STDERR
"fragmaster::parse_fmfile: Keys found in \"$file\": ",
join(', ',sort keys %fmdata ), "\n"
@@ -305,6 +309,7 @@
$global_fmclass = $fmdata->{'fmclass'} if ( defined $fmdata->{'fmclass'} );
$global_fmclassopt = $fmdata->{'fmclassopt'} if ( defined $fmdata->{'fmclassopt'} );
$global_fmopt = $fmdata->{'fmopt'} if ( defined $fmdata->{'fmopt'} );
+ $global_fmlatexcmd = $fmdata->{'fmlatexcmd'} if ( defined $fmdata->{'fmlatexcmd'} );
@global_fmhead = @{$fmdata->{'fmpreamble'}} if ( defined $fmdata->{'fmpreamble'} );
}
@@ -322,6 +327,7 @@
my $fmclass = ( defined $fmdata->{'fmclass'} ) ? $fmdata->{'fmclass'} : $global_fmclass;
my $fmclassopt = ( defined $fmdata->{'fmclassopt'} ) ? $fmdata->{'fmclassopt'} : $global_fmclassopt;
my $fmopt = ( defined $fmdata->{'fmopt'} ) ? $fmdata->{'fmopt'} : $global_fmopt;
+ my $fmlatexcmd = ( defined $fmdata->{'fmlatexcmd'} ) ? $fmdata->{'fmlatexcmd'} : $global_fmlatexcmd;
my @fmhead = ( defined $fmdata->{'fmpreamble'} ) ? @{$fmdata->{'fmpreamble'}} : @global_fmhead;
my @fmfile = ( defined $fmdata->{'fmfile'} ) ? @{$fmdata->{'fmfile'}} : @global_fmfile;
@@ -371,8 +377,8 @@
chdir($tempdir)
or die "fragmaster: Cannot chdir to \"$tempdir\"!. Aborting ...\n";
- system("latex fm.tex") == 0
- or die "fragmaster: Cannot latex \"fm.tex\"!. Aborting ...\n";
+ system($fmlatexcmd, "fm.tex") == 0
+ or die "fragmaster: Cannot $fmlatexcmd \"fm.tex\"!. Aborting ...\n";
# Using -E here, causes dvips to detect
# the psfrag phantom stuff and to set the BoundingBox wrong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.