diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/latexmk.1 | 25 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/latexmk.pdf | bin | 73828 -> 160153 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/latexmk.txt | 186 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/latexmk/latexmk.pl | 104 |
5 files changed, 213 insertions, 104 deletions
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README index 2f80b235e9a..33d5fc6e6a9 100644 --- a/Master/texmf-dist/doc/support/latexmk/README +++ b/Master/texmf-dist/doc/support/latexmk/README @@ -88,7 +88,7 @@ I hope you find this useful. John Collins ---------------------------- "latexmk -h" ---------------------------- -Latexmk 4.07: Automatic LaTeX document generation routine +Latexmk 4.08: Automatic LaTeX document generation routine Usage: latexmk [latexmk_options] [filename ...] diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.1 b/Master/texmf-dist/doc/support/latexmk/latexmk.1 index 7ed711e8397..e8499cefadd 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.1 +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.1 @@ -213,16 +213,31 @@ and \fB-e\fR options can be used, and they are executed in the order they appear on the command line. Some care is needed to deal with proper quoting of special characters -in the code on the command line. For example, suppose it is desired +in the code on the command line. For example, suppose you want to set the latex command to use its -shell-escape option, then under UNIX/LINUX you could use the line latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex -(Note that the q/.../ construct is a \fIPerl\fR idiom equivalent to using -single quotes. This is easier than arranging to get a quote character -correctly escaped in a way that is independent of the shell and the -operating-system.) +Note that the single quotes block normal UNIX/LINUX command shells +from treating the characters inside the quotes as special. +(In this example, the q/.../ construct is a +\fIPerl\fR idiom equivalent to using +single quotes. This avoids the complications of getting a quote +character inside an already quoted string in a way that is independent +of both the shell and the operating-system.) + +The above command line will NOT work under MS-Windows with cmd.exe or +command.com or 4nt.exe. For MS-Windows with these command shells you +could use + + latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex + +or + + latexmk -e "$latex='latex %O -shell-escape %S'" file.tex + +The last two examples will NOT work with UNIX/LINUX command shells. .TP .B -f Force \fIlatexmk\fR to continue document processing despite errors. diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf Binary files differindex fa94b34f8ff..2e7340e1fa6 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.txt b/Master/texmf-dist/doc/support/latexmk/latexmk.txt index 0d82b1a44da..14a1d72e135 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt @@ -240,24 +240,24 @@ LATEXMK(1L) LATEXMK(1L) appear on the command line. Some care is needed to deal with proper quoting of special char- - acters in the code on the command line. For example, suppose it - is desired to set the latex command to use its -shell-escape + acters in the code on the command line. For example, suppose + you want to set the latex command to use its -shell-escape option, then under UNIX/LINUX you could use the line latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex - (Note that the q/.../ construct is a Perl idiom equivalent to - using single quotes. This is easier than arranging to get a - quote character correctly escaped in a way that is independent - of the shell and the operating-system.) + Note that the single quotes block normal UNIX/LINUX command + shells from treating the characters inside the quotes as spe- + cial. (In this example, the q/.../ construct is a Perl idiom + equivalent to using single quotes. This avoids the complica- + tions of getting a quote character inside an already quoted + string in a way that is independent of both the shell and the + operating-system.) - -f Force latexmk to continue document processing despite errors. - Normally, when latexmk detects that LaTeX or another program has - found an error which will not be resolved by further processing, - no further processing is carried out. + The above command line will NOT work under MS-Windows with + cmd.exe or command.com or 4nt.exe. For MS-Windows with these + command shells you could use - -f- Turn off the forced processing-past-errors such as is set by the - -f option. This could be used to override a setting in a @@ -270,7 +270,23 @@ LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) - configuration file. + latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex + + or + + latexmk -e "$latex='latex %O -shell-escape %S'" file.tex + + The last two examples will NOT work with UNIX/LINUX command + shells. + + -f Force latexmk to continue document processing despite errors. + Normally, when latexmk detects that LaTeX or another program has + found an error which will not be resolved by further processing, + no further processing is carried out. + + -f- Turn off the forced processing-past-errors such as is set by the + -f option. This could be used to override a setting in a con- + figuration file. -g Force latexmk to process document fully, even under situations where latexmk would normally decide that no changes in the @@ -310,6 +326,18 @@ LATEXMK(1L) LATEXMK(1L) -p Print out the document. By default it is the generated postscript file that is printed. But you can use the -print=... + + + + 27 May 2009 5 + + + + + +LATEXMK(1L) LATEXMK(1L) + + option to print the dvi or pdf files instead, and you can con- figure this in a start up file (by setting the $print_type vari- able). @@ -325,18 +353,6 @@ LATEXMK(1L) LATEXMK(1L) for printing. This option is incompatible with the -pv and -pvc options, so it - - - - 27 May 2009 5 - - - - - -LATEXMK(1L) LATEXMK(1L) - - turns them off. -pdf Generate pdf version of document using pdflatex. @@ -378,6 +394,18 @@ LATEXMK(1L) LATEXMK(1L) latexmk -ps -pF "psnup -2" foo.tex + + + + 27 May 2009 6 + + + + + +LATEXMK(1L) LATEXMK(1L) + + Whether to use single or double quotes round the "psnup -2" will depend on your command interpreter, as used by the particular version of perl and the operating system on your computer. @@ -392,18 +420,6 @@ LATEXMK(1L) LATEXMK(1L) -pv- Turn off -pv. - - - - 27 May 2009 6 - - - - - -LATEXMK(1L) LATEXMK(1L) - - -pvc Run a file previewer and continually update the .dvi, .ps, and/or .pdf files whenever changes are made to source files (see the Description above). Which of these files is generated and @@ -448,18 +464,6 @@ LATEXMK(1L) LATEXMK(1L) Read the specified initialization file ("RC file") before pro- cessing. - Be careful about the ordering: (1) Standard initialization files - -- see the section below on "Configuration/initialization (RC) - files" -- are read first. (2) Then the options on the command - line are acted on in the order they are given. Therefore if an - initialization file is specified by the -r option, it is read - during this second step. Thus an initialization file specified - with the -r option can override both the standard initialization - files and previously specified options. But all of these can be - overridden by later options. - - The contents of the RC file just comprise a piece of code in the - 27 May 2009 7 @@ -471,6 +475,17 @@ LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) + Be careful about the ordering: (1) Standard initialization files + -- see the section below on "Configuration/initialization (RC) + files" -- are read first. (2) Then the options on the command + line are acted on in the order they are given. Therefore if an + initialization file is specified by the -r option, it is read + during this second step. Thus an initialization file specified + with the -r option can override both the standard initialization + files and previously specified options. But all of these can be + overridden by later options. + + The contents of the RC file just comprise a piece of code in the Perl programming language (typically a sequence of assignment statements); they are executed when the -r option is encountered during latexmk's parsing of its command line. See the -e option @@ -517,15 +532,6 @@ EXAMPLES watch for changes in the source file thesis.tex and any files it uses. After any changes rerun latex - the appropriate number of times and - remake the postscript file. If latex - encounters an error, latexmk will - keep running, watching for - source file changes. - - % latexmk -c # remove .aux, .log, .bbl, .blg, .dvi, - .pdf, .ps & .bbl files - @@ -538,6 +544,17 @@ EXAMPLES LATEXMK(1L) LATEXMK(1L) + the appropriate number of times and + remake the postscript file. If latex + encounters an error, latexmk will + keep running, watching for + source file changes. + + % latexmk -c # remove .aux, .log, .bbl, .blg, .dvi, + .pdf, .ps & .bbl files + + + CONFIGURATION/INITIALIZATION (RC) FILES Latexmk can be customized using initialization files, which are read at startup in the following order: @@ -584,26 +601,26 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES for the setting of a string variable, - $preview_mode = 1; - for the setting of a numeric variable, and - @default_files = ('paper', 'paper1'); - for the setting of an array of strings. It is possible to append an - item to an array variable as follows: + 27 May 2009 9 - 27 May 2009 9 +LATEXMK(1L) LATEXMK(1L) + $preview_mode = 1; + for the setting of a numeric variable, and -LATEXMK(1L) LATEXMK(1L) + @default_files = ('paper', 'paper1'); + for the setting of an array of strings. It is possible to append an + item to an array variable as follows: push @default_files, 'paper2'; @@ -654,24 +671,24 @@ FORMAT OF COMMAND SPECIFICATIONS %O options - %R root filename. This is the base name for the main tex file. - %S source file (e.g., the name of the dvi file when converting a - dvi file to ps). - %T The name of the primary tex file. + 27 May 2009 10 - 27 May 2009 10 +LATEXMK(1L) LATEXMK(1L) + %R root filename. This is the base name for the main tex file. -LATEXMK(1L) LATEXMK(1L) + %S source file (e.g., the name of the dvi file when converting a + dvi file to ps). + %T The name of the primary tex file. If for some reason you need a literal % character in your string not subject to the above rules, use a pair of these characters. Thus with @@ -724,11 +741,6 @@ LATEXMK(1L) LATEXMK(1L) system. Notes: (1) In some circumstances, latex will always run a command - detached. This is the case for a previewer in preview continuous mode, - since otherwise previewing continuously makes no sense. (2) This pre- - cludes the possibility of running a command named start. (3) If the - word start occurs more than once at the beginning of the command - string, that is equivalent to having just one. (4) Under cygwin, some @@ -741,6 +753,11 @@ LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) + detached. This is the case for a previewer in preview continuous mode, + since otherwise previewing continuously makes no sense. (2) This pre- + cludes the possibility of running a command named start. (3) If the + word start occurs more than once at the beginning of the command + string, that is equivalent to having just one. (4) Under cygwin, some complications happen, since cygwin amounts to a complicated merging of UNIX and MS-Windows. See the source code for how I've handled the problem. @@ -794,9 +811,6 @@ LATEXMK(1L) LATEXMK(1L) %B'; This definition assumes you are using a UNIX-like system, so that the - two commands to be run are separated by the semicolon in the middle of - the string. - @@ -809,6 +823,11 @@ LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) LATEXMK(1L) + two commands to be run are separated by the semicolon in the middle of + the string. + + + LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES Default values are indicated in brackets. @@ -862,9 +881,6 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES Perl's rules for writing strings. Important note: This variable is now mostly obsolete in the current - version of latexmk, since it has a better method of searching for files - using the kpsewhich command. However, if your system is an unusual one - without the kpsewhich command, you may need to set the variable @@ -877,7 +893,10 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES LATEXMK(1L) LATEXMK(1L) - @BIBINPUTS. + version of latexmk, since it has a better method of searching for files + using the kpsewhich command. However, if your system is an unusual one + without the kpsewhich command, you may need to set the variable @BIBIN- + PUTS. $bibtex ["bibtex %O %S"] The BibTeX processing program. @@ -935,7 +954,6 @@ LATEXMK(1L) LATEXMK(1L) - 27 May 2009 14 diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl index 7ae78471e4a..13cf3071512 100755 --- a/Master/texmf-dist/scripts/latexmk/latexmk.pl +++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl @@ -140,8 +140,8 @@ use warnings; $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.07'; -$version_details = "$My_name, John Collins, 27 May 2009"; +$version_num = '4.08'; +$version_details = "$My_name, John Collins, 23 June 2009"; use Config; @@ -210,6 +210,10 @@ else { ## ## Modification log for 24 Sep 2008 onwards in detail ## +## 22 Jun 2009, John Collins Binmode for log file under MSWin +## to avoid problem with ctrl/Z written +## by Miktex 2.7 giving spurious end-of-file +## 10 Jun 2009, John Collins V. 4.08 ## 27 May 2009, John Collins V. 4.07 ## 23 May 2009, John Collins Try to work rationally when run of ## (pdf)latex does not produce @@ -523,6 +527,14 @@ $quote_filenames = 1; # Quote filenames in external commands ################################################################ ## Special variables for system-dependent fudges, etc. +$log_file_binary = 0; # Whether to treat log file as binary + # Normally not, since the log file SHOULD be pure text. + # But Miktex 2.7 sometimes puts binary characters + # in it. (Typically in construct \OML ... after + # overfull box with mathmode.) + # Sometimes there is ctrl/Z, which is not only non-text, + # but is end-of-file marker for MS-Win in text mode. + $MSWin_fudge_break = 1; # Give special treatment to ctrl/C and ctrl/break # in -pvc mode under MSWin # Under MSWin32 (at least with perl 5.8 and WinXP) @@ -562,6 +574,8 @@ if ( $^O eq "MSWin32" ) { ## Use first existing case for $tmpdir: $tmpdir = $ENV{TMPDIR} || $ENV{TEMP} || '.'; + $log_file_binary = 1; # Protect against ctrl/Z in log file from + # Miktex 2.7. ## List of possibilities for the system-wide initialization file. ## The first one found (if any) is used. @@ -1128,7 +1142,9 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; } # Rule data: # 0: [ cmd_type, ext_cmd, int_cmd, test_kind, # source, dest, base, out_of_date, - # out_of_date_user, time_of_last_run ] + # out_of_date_user, time_of_last_run, + # last_result, last_message + # ] # where # cmd_type is 'primary', 'external' or 'cusdep', # ext_cmd is string for associated external command @@ -1185,6 +1201,13 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; } # with file modification times.) # changed flags whether special changes have been made # that require file-existence status to be ignored + # last_result is + # -1 if no run has been made, + # 0 if the last run was successful + # 1 if last run was successful, but + # failed to create an output file + # 2 if last run failed + # last_message is error message for last run # 1: {Hash sourcefile -> [source-file data] } # Source-file data array: # 0: time @@ -1801,19 +1824,22 @@ foreach $filename ( @file_list ) $failure = 0; $failure_msg = ''; $failure = rdb_makeB( keys %requested_filerules ); - if ($failure > 0) { next FILE;} + if ($failure > 0) { last FILE; } rdb_for_some( [keys %one_time], \&rdb_run1 ); } # end FILE continue { if ($dependents_list) { rdb_list(); } # Handle any errors - if ( $failure > 0 ) { + $error_message_count = rdb_show_rule_errors(); + if ( ($error_message_count == 0) || ($failure > 0) ) { if ( $failure_msg ) { #Remove trailing space $failure_msg =~ s/\s*$//; warn "$My_name: Did not finish processing file:\n $failure_msg\n"; $failure = 1; } + } + if ( ($failure > 0) || ($error_message_count > 0) ) { $failure_count ++; $last_failed = 1; } @@ -2408,6 +2434,7 @@ CHANGE: $$Pneed_to_get_viewer_process = 1; } # end analyze result of trying to run viewer } # end start viewer + rdb_show_rule_errors(); if ( $first_time || $updated || $failure ) { print "\n=== Watching for updated files. Use ctrl/C to stop ...\n"; } @@ -2840,7 +2867,7 @@ sub parse_logB { if ( ! open( $log_file, "<$log_name" ) ) { return 0; } - + if ($log_file_binary) { binmode $log_file; } # Collect lines of log file my @lines = (); while(<$log_file>) { @@ -4425,6 +4452,36 @@ sub rdb_makeB { #------------------- +sub rdb_show_rule_errors { + local @messages = (); + rdb_for_all( + sub{ + if ($$Plast_message ne '') { + push @messages, "$rule: $$Plast_message"; + } + elsif ($$Plast_result == 1) { + push @messages, "$rule: failed to create output file"; + } + elsif ($$Plast_result == 2) { + push @messages, "$rule: gave an error"; + } + elsif ($$Prun_time == 0) { +# This can have innocuous causes. So don't report +# push @messages, "$rule: never run"; + } + } + ); + if ($#messages > -1) { + warn "Collected error summary (may duplicate other messages):\n"; + foreach (@messages){ + warn " $_\n"; + } + } + return $#messages+1; +} + +#------------------- + sub rdb_makeB1 { # Call: rdb_makeB1 # Helper routine for rdb_makeB. @@ -4439,10 +4496,11 @@ sub rdb_makeB1 { if ( ($$Prun_time == 0) && exists($possible_primaries{$rule}) ) { push @rules_never_run, $rule; $$Pout_of_date = 1; + $$Plast_result = -1; } else { if ( $$Pdest && (! -e $$Pdest) ) { - # With a non-existent desintation, if we haven't made any passes + # With a non-existent destination, if we haven't made any passes # through a rule, rerunning the rule is good, because the file # may fail to exist because of being deleted by the user (for ex.) # rather than because of a failure on a previous run. @@ -4547,7 +4605,8 @@ sub rdb_makeB1 { } if ($return != 0) { $failure = 1; - $failure_msg = "Run of rule '$rule' gave a non-zero error code"; + $$Plast_result = 2; + $$Plast_message = $failure_msg = "Run of rule '$rule' gave a non-zero error code"; } } #END rdb_makeB1 @@ -4688,6 +4747,8 @@ sub rdb_run1 { &rdb_update_filesA; $$Prun_time = time; $$Pchanged = 0; # No special changes in files + $$Plast_result = 0; + $$Plast_message = ''; # Return values for external command: my $return = 0; @@ -4711,15 +4772,17 @@ sub rdb_run1 { " Need to implement the command for '$rule'\n"; &traceback(); $return = -1; + $$Plast_result = 2; + $$Plast_message = "Bug or configuration error; incorrect command type"; } if ( $rule =~ /^bibtex/ ) { my $retcode = &check_bibtex_log($$Pbase); if ($retcode == 3) { - push @warnings, - "Could not open bibtex log file for '$$Pbase'"; + $$Plast_result = 2; + $$Plast_message = "Could not open bibtex log file for '$$Pbase'"; + push @warnings, $$Plast_message; } elsif ($retcode == 2) { - push @warnings, "Bibtex errors for '$$Pbase'"; } elsif ($retcode == 1) { push @warnings, "Bibtex warnings for '$$Pbase'"; @@ -4733,6 +4796,17 @@ sub rdb_run1 { $$Ptest_kind = 1; } $$Pout_of_date = $$Pout_of_date_user = 0; + + if ( ($$Plast_result == 0) && ($return != 0) ) { + $$Plast_result = 2; + if ($$Plast_message eq '') { + $$Plast_message = "Command gave return code $return"; + } + } + elsif ( $$Pdest && (! -e $$Pdest) ) { + $$Plast_result = 1; + } + return $return; } # END rdb_run1 @@ -4804,7 +4878,8 @@ sub rdb_primary_run { ######### Analyze results of run: if ( ! -e "$root_filename.log" ) { $failure = 1; - $failure_msg = "(Pdf)LaTeX failed to generate a log file"; + $$Plast_result = 2; + $$Plast_message = $failure_msg = "(Pdf)LaTeX failed to generate a log file"; return -1; } ####### NOT ANY MORE! Capture any changes in source file status before we @@ -5233,7 +5308,8 @@ sub rdb_one_rule { local ( $PArule_data, $PHsource ) = @{$rule_db{$rule}}; local ($Pcmd_type, $Pext_cmd, $PAint_cmd, $Ptest_kind, $Psource, $Pdest, $Pbase, - $Pout_of_date, $Pout_of_date_user, $Prun_time, $Pchanged ) + $Pout_of_date, $Pout_of_date_user, $Prun_time, $Pchanged, + $Plast_result, $Plast_message ) = Parray( $PArule_data ); # Correct array ref: $PAint_cmd = $$PArule_data[2]; @@ -5309,7 +5385,7 @@ sub rdb_create_rule { $rule_db{$rule} = [ [$cmd_type, $int_cmd, $PAext_cmd, $test_kind, $source, $dest, $base, $needs_making, 0, $run_time, - $changed ], + $changed, -1, '' ], {} ]; if ($source) { rdb_ensure_file( $rule, $source ); } |