Merge lp:~matttbe/ubuntu/raring/latexmk/v4.35 into lp:ubuntu/raring/latexmk

Proposed by Matthieu Baerts
Status: Needs review
Proposed branch: lp:~matttbe/ubuntu/raring/latexmk/v4.35
Merge into: lp:ubuntu/raring/latexmk
Diff against target: 14022 lines (+6561/-3478)
30 files modified
CHANGES (+138/-0)
INSTALL (+1/-1)
README (+27/-8)
debian/changelog (+142/-0)
debian/compat (+1/-1)
debian/control (+7/-5)
debian/copyright (+1/-6)
debian/patches/00list (+0/-1)
debian/patches/rc-system-files.patch (+9/-11)
debian/patches/series (+1/-0)
debian/rules (+7/-14)
debian/source/format (+1/-0)
debian/watch (+8/-0)
example_rcfiles/README (+13/-0)
example_rcfiles/Sweave_latexmkrc (+57/-0)
example_rcfiles/TeX4ht-latexmkrc (+33/-0)
example_rcfiles/asymptote_latexmkrc (+1/-1)
example_rcfiles/glossary_latexmkrc (+6/-6)
example_rcfiles/mpost_latexmkrc (+26/-0)
example_rcfiles/pdflatexmkrc (+42/-42)
example_rcfiles/sagetex_latexmkrc (+2/-2)
example_rcfiles/sweave_latexmkrc (+57/-0)
example_rcfiles/xelatex_latexmkrc (+20/-0)
extra-scripts/htlatexonly (+10/-0)
extra-scripts/myhtlatex2 (+19/-0)
latexmk.1 (+542/-78)
latexmk.bat (+5/-5)
latexmk.pl (+1454/-524)
latexmk.ps (+2451/-1821)
latexmk.txt (+1480/-952)
To merge this branch: bzr merge lp:~matttbe/ubuntu/raring/latexmk/v4.35
Reviewer Review Type Date Requested Status
Andrew Starr-Bochicchio (community) Approve
Review via email: mp+141388@code.launchpad.net

Description of the change

Hello,

As you can see, Latexmk is available in Debian and Ubuntu repositories but it's an old version (4.24 - released more than one year ago).

A new version has been released less than two months ago and it's still not available in Debian repositories. It seems that the official maintainer doesn't answer to these bugs reports:
 * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668926 => [PATCH] latexmk: Helping to update to packaging format 3.0
 * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693126 => latexmk: New upstream release available + watch file

Is it possible to upload this new version to Ubuntu repositories because it will be needed by the new version of LaTeXila (and also because it fixes other bugs, please have a look at this debian/changelog file). Or should I first report this bug to another Debian dev? Or is it easier to upload this new version to Ubuntu repos first because Debian Testing migration has been frozen?
This new version has been uploaded to mentors.debian.net but I'm not sure that I'll receive an answer from the official Debian maintainer soon.

Thank you for your help,

Matt

PS: this new version can be easily tested by using this package: https://launchpad.net/~matttbe/+archive/experimental-debian-build/+sourcepub/2900053/+listing-archive-extra

To post a comment you must log in.
Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Looks good, but I did make a few tweaks to the changelog. I condensed it to one entry as the proposed Debian versions haven't actually entered the Debian archive. I also dropped the upstream changelog as it's really more verbose than we need for debian/changelog.

Thanks for your work!

review: Approve
Revision history for this message
Matthieu Baerts (matttbe) wrote :

Thank you for these changes and for your support! :)

Matt

Unmerged revisions

9. By Matthieu Baerts

* New upstream release. (LP: #1094164)
* Upstream ChangeLog:
  - 4.35 dated 11 November 2012.
    * Corrects bug that fls file is incorrectly parsed when using a
      combination of cygwin and a native MS-Windows TeX program.
    * Corrects bug that old dependency information was retained when using
      the --gg option.
  - 4.34 dated 1 October 2012.
    * Corrects non-optimality that latexmk may do extra runs of (pdf)latex
      when a file is read and written during a run of (pdf)latex, but the
      file is only read after being written.
  - 4.33c dated 19 August 2012.
    * Corrects infinite loop in error messages when the maximum number of
      passes through latex/pdflatex is exceeded.
  - 4.33b dated 12 August 2012.
    * Documentation improvements, including documentation of the many
      options for the (pdf)latex programs that are supported by latexmk.
  - 4.33a dated 8 August 2012.
    * Fix slowness of v. 4.33 under Cygwin.
  - 4.33 dated 6 August 2012.
    * Improve operation under MSWindows: substitute "\" for "/" for
      directory separator in command lines, deal consistently with
      directory separator, which can be both "\" and "/".
    * Correct some bugs that interfered with use of auxiliary directory
      and output directory for files generated by (pdf)latex, especially
      with MiKTeX.
    * Fix problems caused because in the log and fls files MiKTeX writes
      absolute path for many filenames at and below current directory, and
      is inconsistent in its use of "/" vs. "\" as directory separator.
    * Add $dvipdf_silent_switch configuration variable.
    * Improve handling of errors in (pdf)latex; previously latexmk would
      give up processing in some situations continuing is correct.
    * Documentation corrections/improvements.
    * Reduce number of warnings in silent operation.
  - 4.31 dated 30 March 2012.
    * Implement most options allowed by latex and pdflatex.
    * Add -M -MP and -MF options, like gcc.
    * Recorder option is now on by default.
    * Add -latexoption=... option to latexmk.
    * Add -xelatex option for use of xelatex.
    * Change OS-X default for pdf previewer command to open.
    * Command specification string can start with "include routine" to
      invoke a Perl subroutine instead of an external cmd.
    * Viewers are detached by default. (The start keyword is now normally
      superfluous in command specifications.)
    * Keyword nostart added in command specification.
    * Add configuration variables $compiling_cmd, $success_cmd,
      $failure_cmd. These specify external commands (if any) to be
      executed during latexmk's continuous preview mode at the following
      points: $compiling_cmd at the start of compilation, $success_cmd at
      the end of a successful compilation, and $failure_cmd at the end of
      an unsuccessful compilation. They can be used, for example, to show
      the progress of compilation by setting the titles of editor and/or
      previewer windows.
    * If aux and/or output directories are specified but don't exist, make
      them.
    * Remove excessive repetition of tests for changes of source files
      (improves performance of latexmk in some situations).
    * Documentation improvements.
    * Minor bug corrections.
  - 4.30a dated 9 December 2011.
    * Fix use of bibtex so that it works correctly when $aux_dir and/or
      $out_dir are set.
    * Use OS-dependent search path separator when when manipulating
      TEXINPUTS, etc. Then use of -output-directory and -aux-directory
      options should work correctly on MSWin systems.
    * Documentation of $search_path_separator variable.
    * Correct some bugs in v. 4.30 that manifested themselves under MSWin
      especially with Cygwin.
  - 4.29a dated 7 December 2011.
    * Latexmk now works with the feynmp package and mpost, provided a
      suitable custom dependency is defined. (See the example latexmkrc
      fragment mpost_latexmkrc in the example_rcfiles directory in the
      latexmk distribution.)
    * If output directory is set, arrange that dvips can find files there.
    * In searching for cus-deps that can make a missing file, look in
      $out_dir.
  - 4.28c dated 1 December 2011.
    * When biber doesn't find the bib file, latexmk treats this as a
      warning rather than a fatal error, so further processing can
      continue normally.
    * Latexmk now parses correctly error messages from biber v. 0.9.7.
  - 4.28a dated 28 November 2011.
    * Correct handling of situations where some file(s) needed by bibtex
      (or biber) don't exist. Previously latexmk incorrectly stopped with
      an error message instead of continuing.
    * Correct duplicate invocations of dvipdf, ps2pdf
  - 4.27a dated 10 October 2011.
    * Deal with problem that making of ps or pdf file via a temporary file
      fails if the command making it has no %D placeholder
    * Add png to list of graphics extensions for pdflatex
    * Add -norc option that prevents auto reading of rc files.
    * Options -aux-directory -output-directory like those of (pdf)latex,
      to set the output directories of (pdf)latex. (-aux-directory is
      MiKTeX only). Corresponding configuration variables, and
      placeholders for command specification.
  - 4.26 dated 9 August 2011.
    * Make compatible with biber 0.9.4.
    * Fix some bugs in error reporting.
  - 4.25 dated 7 July 2011.
    * Fix to evade apparent cygwin bug that prevented system rc-file from
      being read.
    * Diagnostic for unreadable rc-file.
    * Add deps output file to target part of dependency information.
* debian/patches:
  - Refreshed
* debian/control:
  - Replaced gs-common by ghostscript as Suggested package Closes: #649700
* Previous changes by Antonio Ospite (4.24-1.2) Closes: #693126 and by
  Jari Aalto (4.24-1.1) Closes: #668926

8. By Matthieu Baerts

* debian/patches/rc-system-files.patch:
  - This file has a wrong name according to debian/patches/series

7. By Matthieu Baerts

Added debian/watch file

6. By Matthieu Baerts

* Non-maintainer upload.
* Remove deprecated dpatch and upgrade to packaging format "3.0 quilt".
* Update to Standards-Version to 3.9.3 and debhelper to 9.
* Add required build-arch and build-indep targets to rules file.
* Fix old-fsf-address-in-copyright-file (Lintian).
* Fix copyright-refers-to-symlink-license (Lintian).
* Fix capitalization-error-in-description LaTeX (Lintian).
* Fix no-homepage-field (Lintian).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGES'
--- CHANGES 2011-06-11 22:09:09 +0000
+++ CHANGES 2012-12-28 00:31:23 +0000
@@ -257,3 +257,141 @@
257 aren't in the current directory (by use of kpsewhich). This was257 aren't in the current directory (by use of kpsewhich). This was
258 previously done for bibtex but not biber.258 previously done for bibtex but not biber.
259259
260From v. 4.24 to v. 4.25
261 Fix to evade apparent cygwin bug that prevented system
262 rc-file from being read.
263 Diagnostic for unreadable rc-file.
264 Add deps output file to target part of dependency information
265
266From v. 4.25 to v. 4.26
267 Make compatible with biber 0.9.4.
268 Fix some bugs in error reporting.
269
270From v. 4.26 to v. 4.27a
271 Deal with problem that making of ps or pdf file via a temporary
272 file fails if the command making it has no %D placeholder
273 Add png to list of graphics extensions for pdflatex
274 Add -norc option that prevents auto reading of rc files.
275 Options -aux-directory -output-directory like those of (pdf)latex,
276 to set the output directories of (pdf)latex. (-aux-directory
277 is MiKTeX only). Corresponding configuration variables, and
278 placeholders for command specification.
279
280From v. 4.27a to 4.28
281 Correct handling of situations where some file(s) needed by bibtex
282 (or biber) don't exist. Previously latexmk incorrectly stopped
283 with an error message instead of continuing.
284
285From v. 4.28 to 4.28a
286 Correct duplicate making of view file
287
288From v. 4.28a to 4.28c
289 When biber doesn't find the bib file, latexmk treats this as a
290 warning rather than a fatal error, so further processing
291 can continue normally.
292 Latexmk now parses correctly error messages from biber v. 0.9.7.
293
294From v. 4.28c to 4.29a
295 Latexmk now works with the feynmp package and mpost,
296 provided a suitable custom dependency is defined. (See the
297 example latexmkrc fragment mpost_latexmkrc in the
298 example_rcfiles directory in the latexmk distribution.)
299 If output directory is set, arrange that dvips can find files
300 there.
301 In searching for cus-deps that can make a missing file, look in
302 $out_dir.
303 Solves problem that sometimes dvips and dvipdf weren't run when
304 they should have been. (The problem only arose with certain
305 changes in eps files being made within a minute of the previous
306 run.)
307
308From v. 4.29a to 4.30a
309 Fix use of bibtex so that it works correctly when $aux_dir and/or
310 $out_dir are set.
311 Use OS-dependent search path separator when when manipulating
312 TEXINPUTS, etc. Then use of -output-directory and
313 -aux-directory options should work on MSWin systems.
314 Documentation of $search_path_separator variable.
315
316From v. 4.30a to 4.31
317 Add -M -MP and -MF options, like gcc.
318 Recorder option is now on by default.
319 Add options reproducing most options of (pdf)latex (list from both
320 TeXLive and MikTeX versions).
321 Options NOT implemented by latexmk at all:
322 -ini and -initialize since they refer to operations
323 not supported by latexmk
324 -includedirectory=dir its support needs extra code in
325 latexmk, not currently written
326 Options differently processed by latexmk:
327 -help
328 -version
329 -quiet
330 Options that are passed to (pdf)latex but that also have special
331 processing by latexmk
332 -aux-directory=dir
333 -output-directory=dir
334 -recorder
335 Add -latexoption=... option to latexmk
336 Add -xelatex option for use of xelatex
337 Change OS-X default for pdf previewer command to open
338 Command specification string can start with "include routine" to
339 invoke a Perl subroutine instead of an external cmd.
340 Viewers are detached by default. (The start keyword is now normally
341 superfluous in command specifications.)
342 Keyword nostart added in command specification.
343 Add configuration variables $compiling_cmd, $success_cmd,
344 $failure_cmd. These specify external commands (if any) to be
345 executed during latexmk's continuous preview mode at the
346 following points: $compiling_cmd at the start of compilation,
347 $success_cmd at the end of a successful compilation, and
348 $failure_cmd at the end of an unsuccessful compilation. They
349 can be used, for example, to show the progress of compilation by
350 setting the titles of editor and/or previewer windows.
351 If aux and/or output directories are specified but don't exist,
352 make them.
353 Remove excessive repetition of tests for changes of source files
354 (improves performance of latexmk in some situations).
355 Documentation improvements.
356 Minor bug corrections.
357
358From v. 4.31 to 4.33a
359 Improve operation under MSWindows: substitute "\" for "/" for
360 directory separator in command lines, deal consistently with
361 directory separator, which can be both "\" and "/".
362 Correct some bugs that interfered with use of auxiliary directory
363 and output directory for files generated by (pdf)latex,
364 especially with MiKTeX.
365 Fix problems caused because in the log and fls files MiKTeX writes
366 absolute path for many filenames at and below current directory,
367 and is inconsistent in its use of "/" vs. "\" as directory
368 separator.
369 Add $dvipdf_silent_switch configuration variable.
370 Improve handling of errors in (pdf)latex; previously latexmk would
371 give up processing in some situations continuing is correct.
372 Documentation corrections/improvements.
373 Reduce number of warnings in silent operation.
374 Cure slowness of v. 4.33 under Cygwin.
375
376From v. 4.33a to 4.33b
377 Documentation improvements.
378 Improve text displayed by using -showextraoptions option.
379
380From v. 4.33b to 4.33c
381 Correct infinite loop when maximum passes through latex/pdflatex
382 are exceeded
383
384From v. 4.33c to 4.34
385 Correct non-optimality that if (pdf)latex reads a file only after
386 it has been written in the same run, the file is not a true
387 source file, but nevertheless latexmk treats it as a source
388 file. Thus changes in the file sometimes caused latexmk to make
389 unnecessary (but otherwise innocuous) extra runs of (pdflatex).
390
391From v. 4.34 to 4.35
392 Correct bug in parsing fls file from native MS-Windows LaTeX (e.g.,
393 MiKTeX) when latexmk is run under cygwin. (The names of some
394 files used by latexmk incorrectly contained a CR character.)
395 Correct bug that when the --gg option is used, the rule database
396 from the old fdb file was used instead of being cleared.
397
260398
=== modified file 'INSTALL'
--- INSTALL 2011-06-11 22:09:09 +0000
+++ INSTALL 2012-12-28 00:31:23 +0000
@@ -1,6 +1,6 @@
1 INSTALLING latexmk1 INSTALLING latexmk
2 ==================2 ==================
3 (Version 4.24, 7 May 2011)3 (Version 4.35, 11 November 2012)
44
5 John Collins5 John Collins
6 Physics Department6 Physics Department
77
=== modified file 'README'
--- README 2011-06-11 22:09:09 +0000
+++ README 2012-12-28 00:31:23 +0000
@@ -1,5 +1,5 @@
1Latexmk, version 4.24, 7 May 20111Latexmk, version 4.35, 11 November 2012
2---------------------------------2---------------------------------------
33
4Latexmk completely automates the process of generating a LaTeX4Latexmk completely automates the process of generating a LaTeX
5document. Essentially, it is a highly specialized cousin of the5document. Essentially, it is a highly specialized cousin of the
@@ -92,14 +92,17 @@
9292
93John Collins93John Collins
94---------------------------- "latexmk -h" ----------------------------94---------------------------- "latexmk -h" ----------------------------
95Latexmk 4.24: Automatic LaTeX document generation routine95Latexmk 4.35: Automatic LaTeX document generation routine
9696
97Usage: latexmk [latexmk_options] [filename ...]97Usage: latexmk [latexmk_options] [filename ...]
9898
99 Latexmk_options:99 Latexmk_options:
100 -bibtex - use bibtex when needed (default)100 -aux-directory=dir or -auxdir=dir
101 -bibtex- - never use bibtex101 - set name of directory for auxiliary files (aux, log)
102 -bibtex-cond - use bibtex when needed, but only if the bib files exist102 - Currently this only works with MiKTeX
103 -bibtex - use bibtex when needed (default)
104 -bibtex- - never use bibtex
105 -bibtex-cond - use bibtex when needed, but only if the bib files exist
103 -bm <message> - Print message across the page when converting to postscript106 -bm <message> - Print message across the page when converting to postscript
104 -bi <intensity> - Set contrast or intensity of banner107 -bi <intensity> - Set contrast or intensity of banner
105 -bs <scale> - Set scale for banner108 -bs <scale> - Set scale for banner
@@ -140,10 +143,17 @@
140 -l- - turn off -l143 -l- - turn off -l
141 -latex=<program> - set program used for latex.144 -latex=<program> - set program used for latex.
142 (replace '<program>' by the program name)145 (replace '<program>' by the program name)
146 -latexoption=<option> - add the given option to the (pdf)latex command
147 -M - Show list of dependent files after processing
148 -MF file - Specifies name of file to receives list dependent files
149 -MP - List of dependent files includes phony target for each source file.
143 -new-viewer - in -pvc mode, always start a new viewer150 -new-viewer - in -pvc mode, always start a new viewer
144 -new-viewer- - in -pvc mode, start a new viewer only if needed151 -new-viewer- - in -pvc mode, start a new viewer only if needed
145 -nobibtex - never use bibtex152 -nobibtex - never use bibtex
146 -nodependents - Do not show list of dependent files after processing153 -nodependents - Do not show list of dependent files after processing
154 -norc - omit automatic reading of system, user and project rc files
155 -output-directory=dir or -outdir=dir
156 - set name of directory for output files
147 -pdf - generate pdf by pdflatex157 -pdf - generate pdf by pdflatex
148 -pdfdvi - generate pdf by dvipdf158 -pdfdvi - generate pdf by dvipdf
149 -pdflatex=<program> - set program used for pdflatex.159 -pdflatex=<program> - set program used for pdflatex.
@@ -164,12 +174,17 @@
164 on force mode, so errors do not cause latexmk to stop.)174 on force mode, so errors do not cause latexmk to stop.)
165 (Side effect: turn off ordinary preview mode.)175 (Side effect: turn off ordinary preview mode.)
166 -pvc- - turn off -pvc176 -pvc- - turn off -pvc
177 -quiet - silence progress messages from called programs
167 -r <file> - Read custom RC file178 -r <file> - Read custom RC file
179 (N.B. This file could override options specified earlier
180 on the command line.)
168 -recorder - Use -recorder option for (pdf)latex181 -recorder - Use -recorder option for (pdf)latex
169 (to give list of input and output files)182 (to give list of input and output files)
170 -recorder- - Do not use -recorder option for (pdf)latex183 -recorder- - Do not use -recorder option for (pdf)latex
171 -rules - Show list of rules after processing184 -rules - Show list of rules after processing
172 -rules- - Do not show list of rules after processing185 -rules- - Do not show list of rules after processing
186 -showextraoptions - Show other allowed options that are simply passed
187 as is to latex and pdflatex
173 -silent - silence progress messages from called programs188 -silent - silence progress messages from called programs
174 -time - show CPU time used189 -time - show CPU time used
175 -time- - don't show CPU time used190 -time- - don't show CPU time used
@@ -183,11 +198,15 @@
183 -view=none - no viewer is used198 -view=none - no viewer is used
184 -view=ps - viewer is for ps199 -view=ps - viewer is for ps
185 -view=pdf - viewer is for pdf200 -view=pdf - viewer is for pdf
201 -xelatex - use xelatex for processing files to pdf
202
186 filename = the root filename of LaTeX document203 filename = the root filename of LaTeX document
187204
188-p, -pv and -pvc are mutually exclusive205-p, -pv and -pvc are mutually exclusive
189-h, -c and -C override all other options.206-h, -c and -C override all other options.
190-pv and -pvc require one and only one filename specified207-pv and -pvc require one and only one filename specified
191All options can be introduced by '-' or '--'. (E.g., --help or -help.)208All options can be introduced by '-' or '--'. (E.g., --help or -help.)
192Contents of RC file specified by -r overrides options specified209
193 before the -r option on the command line210In addition, latexmk recognizes many other options that are passed to
211latex and/or pdflatex without interpretation by latexmk. Run latexmk
212with the option -showextraoptions to see a list of these
194213
=== modified file 'debian/changelog'
--- debian/changelog 2011-06-11 22:09:09 +0000
+++ debian/changelog 2012-12-28 00:31:23 +0000
@@ -1,3 +1,145 @@
1latexmk (1:4.35-0ubuntu1) raring; urgency=low
2
3 * New upstream release. (LP: #1094164)
4 * Upstream ChangeLog:
5 - 4.35 dated 11 November 2012.
6 * Corrects bug that fls file is incorrectly parsed when using a
7 combination of cygwin and a native MS-Windows TeX program.
8 * Corrects bug that old dependency information was retained when using
9 the --gg option.
10 - 4.34 dated 1 October 2012.
11 * Corrects non-optimality that latexmk may do extra runs of (pdf)latex
12 when a file is read and written during a run of (pdf)latex, but the
13 file is only read after being written.
14 - 4.33c dated 19 August 2012.
15 * Corrects infinite loop in error messages when the maximum number of
16 passes through latex/pdflatex is exceeded.
17 - 4.33b dated 12 August 2012.
18 * Documentation improvements, including documentation of the many
19 options for the (pdf)latex programs that are supported by latexmk.
20 - 4.33a dated 8 August 2012.
21 * Fix slowness of v. 4.33 under Cygwin.
22 - 4.33 dated 6 August 2012.
23 * Improve operation under MSWindows: substitute "\" for "/" for
24 directory separator in command lines, deal consistently with
25 directory separator, which can be both "\" and "/".
26 * Correct some bugs that interfered with use of auxiliary directory
27 and output directory for files generated by (pdf)latex, especially
28 with MiKTeX.
29 * Fix problems caused because in the log and fls files MiKTeX writes
30 absolute path for many filenames at and below current directory, and
31 is inconsistent in its use of "/" vs. "\" as directory separator.
32 * Add $dvipdf_silent_switch configuration variable.
33 * Improve handling of errors in (pdf)latex; previously latexmk would
34 give up processing in some situations continuing is correct.
35 * Documentation corrections/improvements.
36 * Reduce number of warnings in silent operation.
37 - 4.31 dated 30 March 2012.
38 * Implement most options allowed by latex and pdflatex.
39 * Add -M -MP and -MF options, like gcc.
40 * Recorder option is now on by default.
41 * Add -latexoption=... option to latexmk.
42 * Add -xelatex option for use of xelatex.
43 * Change OS-X default for pdf previewer command to open.
44 * Command specification string can start with "include routine" to
45 invoke a Perl subroutine instead of an external cmd.
46 * Viewers are detached by default. (The start keyword is now normally
47 superfluous in command specifications.)
48 * Keyword nostart added in command specification.
49 * Add configuration variables $compiling_cmd, $success_cmd,
50 $failure_cmd. These specify external commands (if any) to be
51 executed during latexmk's continuous preview mode at the following
52 points: $compiling_cmd at the start of compilation, $success_cmd at
53 the end of a successful compilation, and $failure_cmd at the end of
54 an unsuccessful compilation. They can be used, for example, to show
55 the progress of compilation by setting the titles of editor and/or
56 previewer windows.
57 * If aux and/or output directories are specified but don't exist, make
58 them.
59 * Remove excessive repetition of tests for changes of source files
60 (improves performance of latexmk in some situations).
61 * Documentation improvements.
62 * Minor bug corrections.
63 - 4.30a dated 9 December 2011.
64 * Fix use of bibtex so that it works correctly when $aux_dir and/or
65 $out_dir are set.
66 * Use OS-dependent search path separator when when manipulating
67 TEXINPUTS, etc. Then use of -output-directory and -aux-directory
68 options should work correctly on MSWin systems.
69 * Documentation of $search_path_separator variable.
70 * Correct some bugs in v. 4.30 that manifested themselves under MSWin
71 especially with Cygwin.
72 - 4.29a dated 7 December 2011.
73 * Latexmk now works with the feynmp package and mpost, provided a
74 suitable custom dependency is defined. (See the example latexmkrc
75 fragment mpost_latexmkrc in the example_rcfiles directory in the
76 latexmk distribution.)
77 * If output directory is set, arrange that dvips can find files there.
78 * In searching for cus-deps that can make a missing file, look in
79 $out_dir.
80 - 4.28c dated 1 December 2011.
81 * When biber doesn't find the bib file, latexmk treats this as a
82 warning rather than a fatal error, so further processing can
83 continue normally.
84 * Latexmk now parses correctly error messages from biber v. 0.9.7.
85 - 4.28a dated 28 November 2011.
86 * Correct handling of situations where some file(s) needed by bibtex
87 (or biber) don't exist. Previously latexmk incorrectly stopped with
88 an error message instead of continuing.
89 * Correct duplicate invocations of dvipdf, ps2pdf
90 - 4.27a dated 10 October 2011.
91 * Deal with problem that making of ps or pdf file via a temporary file
92 fails if the command making it has no %D placeholder
93 * Add png to list of graphics extensions for pdflatex
94 * Add -norc option that prevents auto reading of rc files.
95 * Options -aux-directory -output-directory like those of (pdf)latex,
96 to set the output directories of (pdf)latex. (-aux-directory is
97 MiKTeX only). Corresponding configuration variables, and
98 placeholders for command specification.
99 - 4.26 dated 9 August 2011.
100 * Make compatible with biber 0.9.4.
101 * Fix some bugs in error reporting.
102 - 4.25 dated 7 July 2011.
103 * Fix to evade apparent cygwin bug that prevented system rc-file from
104 being read.
105 * Diagnostic for unreadable rc-file.
106 * Add deps output file to target part of dependency information.
107 * debian/patches:
108 - Refreshed
109 * debian/control:
110 - Replaced gs-common by ghostscript as Suggested package Closes: #649700
111 * Previous changes by Antonio Ospite (4.24-1.2) Closes: #693126 and by
112 Jari Aalto (4.24-1.1) Closes: #668926
113
114 -- Matthieu Baerts (matttbe) <matttbe@ubuntu.com> Fri, 28 Dec 2012 00:24:43 +0100
115
116latexmk (1:4.24-1.2ubuntu1) raring; urgency=low
117
118 * debian/patches/rc-system-files.patch:
119 - This file has a wrong name according to debian/patches/series
120
121 -- Matthieu Baerts (matttbe) <matttbe@ubuntu.com> Thu, 27 Dec 2012 17:45:42 +0100
122
123latexmk (1:4.24-1.2) unstable; urgency=low
124
125 [ Antonio Ospite ]
126 * Added debian/watch file
127
128 -- Matthieu Baerts (matttbe) <matttbe@ubuntu.com> Thu, 27 Dec 2012 17:15:34 +0100
129
130latexmk (1:4.24-1.1) unstable; urgency=low
131
132 * Non-maintainer upload.
133 * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt".
134 * Update to Standards-Version to 3.9.3 and debhelper to 9.
135 * Add required build-arch and build-indep targets to rules file.
136 * Fix old-fsf-address-in-copyright-file (Lintian).
137 * Fix copyright-refers-to-symlink-license (Lintian).
138 * Fix capitalization-error-in-description LaTeX (Lintian).
139 * Fix no-homepage-field (Lintian).
140
141 -- Jari Aalto <jari.aalto@cante.net> Sun, 15 Apr 2012 20:25:54 +0300
142
1latexmk (1:4.24-1) unstable; urgency=low143latexmk (1:4.24-1) unstable; urgency=low
2144
3 * New upstream release (Closes: #564199).145 * New upstream release (Closes: #564199).
4146
=== modified file 'debian/compat'
--- debian/compat 2006-06-12 00:43:25 +0000
+++ debian/compat 2012-12-28 00:31:23 +0000
@@ -1,1 +1,1 @@
1519
22
=== modified file 'debian/control'
--- debian/control 2011-06-11 22:09:09 +0000
+++ debian/control 2012-12-28 00:31:23 +0000
@@ -1,19 +1,21 @@
1Source: latexmk1Source: latexmk
2Section: tex2Section: tex
3Priority: optional3Priority: optional
4Build-Depends: debhelper (>= 5.0.0), dpatch4Build-Depends: debhelper (>= 9)
5Maintainer: OHURA Makoto <ohura@debian.org>5Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
6Standards-Version: 3.9.26XSBC-Original-Maintainer: OHURA Makoto <ohura@debian.org>
7Standards-Version: 3.9.3
8Homepage: http://www.phys.psu.edu/~collins/software/latexmk-jcc
79
8Package: latexmk10Package: latexmk
9Architecture: all11Architecture: all
10Depends: perl, texlive-latex-base, ${misc:Depends}12Depends: perl, texlive-latex-base, ${misc:Depends}
11Suggests: gs-common13Suggests: ghostscript
12Recommends: xpdf-reader | pdf-viewer, gv | postscript-viewer14Recommends: xpdf-reader | pdf-viewer, gv | postscript-viewer
13Description: Perl script for running LaTeX the correct number of times15Description: Perl script for running LaTeX the correct number of times
14 Latexmk runs LaTeX the correct number of times to resolve cross references,16 Latexmk runs LaTeX the correct number of times to resolve cross references,
15 etc; it also runs auxiliary programs (bibtex, makeindex if necessary, and17 etc; it also runs auxiliary programs (bibtex, makeindex if necessary, and
16 dvips and/or a previewer as requested). It has a number of other useful18 dvips and/or a previewer as requested). It has a number of other useful
17 capabilities, for example to start a previewer and then run latex whenever the19 capabilities, for example to start a previewer and then run LaTeX whenever the
18 source files are updated, so that the previewer gives an up-to-date view of20 source files are updated, so that the previewer gives an up-to-date view of
19 the document.21 the document.
2022
=== modified file 'debian/copyright'
--- debian/copyright 2006-06-12 00:43:25 +0000
+++ debian/copyright 2012-12-28 00:31:23 +0000
@@ -28,10 +28,5 @@
28MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the28MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29GNU General Public License for more details.29GNU General Public License for more details.
3030
31You should have received a copy of the GNU General Public License
32along with this program; if not, write to the Free Software
33Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
34
35
36On Debian GNU/Linux systems, the complete text of the GNU General31On Debian GNU/Linux systems, the complete text of the GNU General
37Public License can be found in `/usr/share/common-licenses/GPL'.32Public License can be found in `/usr/share/common-licenses/GPL-2'.
3833
=== removed file 'debian/patches/00list'
--- debian/patches/00list 2006-06-12 00:43:25 +0000
+++ debian/patches/00list 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1rc_system_files
20
=== renamed file 'debian/patches/rc_system_files.dpatch' => 'debian/patches/rc-system-files.patch'
--- debian/patches/rc_system_files.dpatch 2006-06-12 00:43:25 +0000
+++ debian/patches/rc-system-files.patch 2012-12-28 00:31:23 +0000
@@ -1,14 +1,12 @@
1#! /bin/sh /usr/share/dpatch/dpatch-run1From: Florian Ragwitz <rafl@debian.org>
2## rc_system_files.dpatch by Florian Ragwitz <rafl@debian.org>2Subject: add /etc/LatexMk to @rc_system_files
3##3
4## All lines beginning with `## DP:' are a description of the patch.4
5## DP: add /etc/LatexMk to @rc_system_files5Index: latexmk/latexmk.pl
66===================================================================
7@DPATCH@7--- latexmk.orig/latexmk.pl 2012-12-27 17:50:00.211349000 +0100
88+++ latexmk/latexmk.pl 2012-12-27 17:55:02.858109192 +0100
9--- latexmk-307a.orig/latexmk.pl 2006-06-12 01:39:17.959196512 +02009@@ -895,7 +895,8 @@
10+++ latexmk-307a/latexmk.pl 2006-06-12 01:39:56.378355912 +0200
11@@ -537,7 +537,8 @@
12 ## /usr/local/lib/latexmk/LatexMk is put in the list for10 ## /usr/local/lib/latexmk/LatexMk is put in the list for
13 ## compatibility with older versions of latexmk.11 ## compatibility with older versions of latexmk.
14 @rc_system_files = 12 @rc_system_files =
1513
=== added file 'debian/patches/series'
--- debian/patches/series 1970-01-01 00:00:00 +0000
+++ debian/patches/series 2012-12-28 00:31:23 +0000
@@ -0,0 +1,1 @@
1rc-system-files.patch
02
=== modified file 'debian/rules'
--- debian/rules 2006-06-12 00:43:25 +0000
+++ debian/rules 2012-12-28 00:31:23 +0000
@@ -1,28 +1,21 @@
1#!/usr/bin/make -f1#!/usr/bin/make -f
22
3clean: clean1 unpatch3clean:
4clean1:
5 dh_testdir4 dh_testdir
6 dh_testroot5 dh_testroot
7 rm -f install-stamp6 rm -f install-stamp
8 dh_clean7 dh_clean
98
10build: patch9build-arch: build
1110build-indep: build
12patch: patch-stamp11
13patch-stamp:12build:
14 dpatch apply-all
15 touch patch-stamp
16
17unpatch:
18 dpatch deapply-all
19 rm -rf patch-stamp debian/patched
2013
21install: install-stamp14install: install-stamp
22install-stamp:15install-stamp:
23 dh_testdir16 dh_testdir
24 dh_testroot17 dh_testroot
25 dh_clean -k18 dh_prep
26 dh_installdirs19 dh_installdirs
27 install -m755 $(CURDIR)/latexmk.pl $(CURDIR)/debian/latexmk/usr/bin/latexmk20 install -m755 $(CURDIR)/latexmk.pl $(CURDIR)/debian/latexmk/usr/bin/latexmk
28 install -m644 $(CURDIR)/debian/config $(CURDIR)/debian/latexmk/etc/LatexMk21 install -m644 $(CURDIR)/debian/config $(CURDIR)/debian/latexmk/etc/LatexMk
@@ -45,4 +38,4 @@
4538
46binary: binary-arch binary-indep39binary: binary-arch binary-indep
4740
48.PHONY: clean build install binary-indep binary-arch binary patch unpatch41.PHONY: clean build install binary-indep binary-arch binary
4942
=== added directory 'debian/source'
=== added file 'debian/source/format'
--- debian/source/format 1970-01-01 00:00:00 +0000
+++ debian/source/format 2012-12-28 00:31:23 +0000
@@ -0,0 +1,1 @@
13.0 (quilt)
02
=== added file 'debian/watch'
--- debian/watch 1970-01-01 00:00:00 +0000
+++ debian/watch 2012-12-28 00:31:23 +0000
@@ -0,0 +1,8 @@
1version=3
2
3# In the pattern below the first digit is isolated so to have a dotted
4# version number in the debian packages, the upstream uses this dotted
5# form in the changelog but removes the dot in the file names.
6http://www.phys.psu.edu/~collins/software/latexmk-jcc/versions.html \
7 latexmk-([\d])([\d]+[a-z]*).zip \
8 debian uupdate
09
=== modified file 'example_rcfiles/README'
--- example_rcfiles/README 2011-06-11 22:09:09 +0000
+++ example_rcfiles/README 2012-12-28 00:31:23 +0000
@@ -20,3 +20,16 @@
20 examples. (The file Latexmk321jTeXShop.zip is the one you want.)20 examples. (The file Latexmk321jTeXShop.zip is the one you want.)
21 It shows how to use glossaries, epstopdf, pdftricks and pst-pdf.21 It shows how to use glossaries, epstopdf, pdftricks and pst-pdf.
2222
234. I have generally arranged for filenames to be quoted on command
24 lines, e.g.,
25
26 system( "makeindex -o \"$_[0].lnd\" \"$_[0].ldx\"" );
27
28 In many cases the quotes may be omitted, as in
29
30 system( "makeindex -o $_[0].lnd $_[0].ldx" );
31
32 But it is preferable to leave the quotes in, since they provide
33 safety against special characters in filenames. The double quotes
34 appear not to cause problems in all situations that I have tried.
35
2336
=== added file 'example_rcfiles/Sweave_latexmkrc'
--- example_rcfiles/Sweave_latexmkrc 1970-01-01 00:00:00 +0000
+++ example_rcfiles/Sweave_latexmkrc 2012-12-28 00:31:23 +0000
@@ -0,0 +1,57 @@
1# This is to allow the use of Sweave with latexmk, and in addition to
2# make synctex work properly with it.
3# SEE THE IMPORTANT NOTES below.
4#
5# Sweave (http://www.stat.uni-muenchen.de/~leisch/Sweave/) is a tool
6# that allows to embed the R code for complete data analyses in latex
7# documents. The user edits a file with an extension like .Rnw, and
8# the .tex file is generated from this.
9#
10# Four problems are solved by the code below:
11# 1. Generate the .tex file automatically.
12# 2. Arrange not to re-run unmodified chunks of R code. (A pure
13# optimization.)
14# 3. Fix the execution environment for (pdf)latex.
15# 4. Deal with synctex: If the user wants to use synctex
16# (www.tug.org/TUGboat/tb29-3/tb93laurens.pdf) to synchronize the
17# pdf file with the source file, by default synctex does the
18# synchronization with the generated .tex file, not the original
19# source file. Postprocessing of the .synctex.gz file is necessary
20# to fix this.
21#
22# The following version was worked out and tested by a user (thanks
23# to Brian Beitzel) on MSWindows. It will need at least one change to
24# work on UNIX-like operating systems (which include Linux and OS-X).
25
26# N.B. ===> IMPORTANT NOTES <===
27#
28# 1. The patchDVI package for R needs to be installed from R-Forge, as
29# follows:
30#
31# install.packages("patchDVI", repos="http://R-Forge.R-project.org")
32#
33# 2. In all Sweave (.Rnw) documents, the following lines must be included:
34#
35# \usepackage{Sweave}
36# \SweaveOpts{concordance=TRUE}
37
38
39# Fix the pdflatex command to run Sweave first, and to postprocess the
40# .synctex.gz file:
41# !!!!! THIS IS THE VERSION FOR MS-WINDOWS, with && as a command
42# separator
43$pdflatex = "cmd /c "
44 . "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
45 . "Sweave('%S', driver=cacheSweaveDriver)\""
46 . " && R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
47 . " && Rscript -e "
48 . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
49#
50# !!!TO FIX THIS FOR Linux/OS-X/UNIX, try uncommenting the following:
51# (this version hasn't been tested).
52#$pdflatex = "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
53# . "Sweave('%S', driver=cacheSweaveDriver)\""
54# . " ; R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
55# . " ; Rscript -e "
56# . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
57
058
=== added file 'example_rcfiles/TeX4ht-latexmkrc'
--- example_rcfiles/TeX4ht-latexmkrc 1970-01-01 00:00:00 +0000
+++ example_rcfiles/TeX4ht-latexmkrc 2012-12-28 00:31:23 +0000
@@ -0,0 +1,33 @@
1# Sometime in the future, latexmk will directly support the use of
2# TeX4ht to obtain html from tex. Meanwhile, here is how to use
3# latexmk with TeX4ht. There is a script htlatex supplied by the
4# TeX4ht package: It simply runs latex a fixed number of times and
5# then the programs tex4ht and t4ht. To use latexmk to get optimal
6# processing use the following instructions (under UNIX-like operating
7# systems, e.g., OS-X and linux):
8#
9# 1. Put the scripts htlatexonly and myhtlatex2 somewhere in the PATH
10# for executables (and make sure they have excutable permissions
11# set).
12# 2. Set up an initialization file for latexmk like this one.
13#
14# 3. To process file.tex to make file.html, run
15#
16# myhtlatex2 file
17#
18
19# Since these instructions use scripts that are UNIX shell scripts,
20# the instructions work as written for UNIX-like operating
21# systems. Users of other operating systems will have to adjust them
22# and modify the scripts suitably.
23
24
25warn "latexmkrc for htlatex\n";
26
27$dvi_mode = 1;
28$pdf_mode = 0;
29$quote_filenames = 0;
30$latex = 'htlatexonly %S';
31
32$clean_ext .= ' 4ct 4tc idv lg tmp xref';
33$clean_full_ext .= ' css html';
034
=== modified file 'example_rcfiles/asymptote_latexmkrc'
--- example_rcfiles/asymptote_latexmkrc 2011-06-11 22:09:09 +0000
+++ example_rcfiles/asymptote_latexmkrc 2012-12-28 00:31:23 +0000
@@ -21,7 +21,7 @@
2121
22# The following lines are taken from the documentation for V. 2.03 of22# The following lines are taken from the documentation for V. 2.03 of
23# asymptote:23# asymptote:
24sub asy {return system("asy '$_[0]'");}24sub asy {return system("asy \"$_[0]\"");}
25add_cus_dep("asy","eps",0,"asy");25add_cus_dep("asy","eps",0,"asy");
26add_cus_dep("asy","pdf",0,"asy");26add_cus_dep("asy","pdf",0,"asy");
27add_cus_dep("asy","tex",0,"asy");27add_cus_dep("asy","tex",0,"asy");
2828
=== modified file 'example_rcfiles/glossary_latexmkrc'
--- example_rcfiles/glossary_latexmkrc 2011-06-11 22:09:09 +0000
+++ example_rcfiles/glossary_latexmkrc 2012-12-28 00:31:23 +0000
@@ -10,18 +10,18 @@
1010
11# 1. For glossaries using glossary package11# 1. For glossaries using glossary package
1212
13add_cus_dep('glo', 'gls', 0, 'makeglo2gls');13add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
14sub makeglo2gls {14sub makeglo2gls {
15 system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o '$_[0]'.gls '$_[0]'.glo");15 system("makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
16}16}
1717
1818
1919
20# 2. For acronyms using glossary package:20# 2. For acronyms using glossary package:
2121
22add_cus_dep('acr', 'acn', 0, 'makeacr2acn');22add_cus_dep( 'acr', 'acn', 0, 'makeacr2acn' );
23sub makeacr2acn {23sub makeacr2acn {
24 system("makeindex -s '$_[0]'.ist -t '$_[0]'.alg -o '$_[0]'.acn '$_[0]'.acr");24 system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acn\" \"$_[0].acr\"" );
25}25}
2626
2727
@@ -31,8 +31,8 @@
31# 4. If you use the glossaries package and have the makeglossaries31# 4. If you use the glossaries package and have the makeglossaries
32# script installed, then you can do something simpler:32# script installed, then you can do something simpler:
3333
34 add_cus_dep('glo', 'gls', 0, 'makeglossaries');34 add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
35 sub makeglossaries {35 sub makeglossaries {
36 system("makeglossaries $_[0]");36 system( "makeglossaries \"$_[0]\"" );
37 }37 }
3838
3939
=== added file 'example_rcfiles/mpost_latexmkrc'
--- example_rcfiles/mpost_latexmkrc 1970-01-01 00:00:00 +0000
+++ example_rcfiles/mpost_latexmkrc 2012-12-28 00:31:23 +0000
@@ -0,0 +1,26 @@
1# This shows how to use mpost, as used by the feynmp package.
2# The feynmp package writes files with extension .mp, e.g., foo.mp,
3# and these are to be converted by mpost to make postscript files,
4# e.g., foo.1, which are later read in by dvips.
5#
6# A more complicated custom dependency is needed than normal, because:
7# if the output directory ($out_dir) or the auxiliary directory
8# ($out_dir) is set, mpost doesn't put its output in the correct
9# place.
10
11add_cus_dep( 'mp', '1', 0, 'mpost' );
12
13
14sub mpost {
15 my $file = $_[0];
16 my ($name, $path) = fileparse( $file );
17 my $return = system "mpost \"$file\"";
18 # Fix the problem that mpost puts its output and log files
19 # in the current directory, not in the auxiliary directory
20 # (which is often the same as the output directory):
21 if ( ($path ne '') && ($path ne '.\\') && ($path ne './') ) {
22 foreach ( "$name.1", "$name.log" ) { move $_, $aux_dir; }
23 }
24 return $return;
25}
26
027
=== modified file 'example_rcfiles/pdflatexmkrc'
--- example_rcfiles/pdflatexmkrc 2010-03-14 17:10:22 +0000
+++ example_rcfiles/pdflatexmkrc 2012-12-28 00:31:23 +0000
@@ -6,72 +6,72 @@
66
7# Custom dependency for glossary/glossaries package7# Custom dependency for glossary/glossaries package
8# if you make custom glossaries you may have to add items to the @cus_dep_list and corresponding sub-routines8# if you make custom glossaries you may have to add items to the @cus_dep_list and corresponding sub-routines
9add_cus_dep('glo', 'gls', 0, 'makeglo2gls');9add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
10 sub makeglo2gls {10sub makeglo2gls {
11 system("makeindex -s $_[0].ist -t $_[0].glg -o $_[0].gls $_[0].glo");11 system( "makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
12 }12}
13# The glossaries package, with the [acronym] option, produces a .acn file when processed with (xe/pdf)latex and13# The glossaries package, with the [acronym] option, produces a .acn file when processed with (xe/pdf)latex and
14# then makeindex to process the .acn into .acr and finally runs of (xe/pdf)latex to read in the .acr file. Unfortunately14# then makeindex to process the .acn into .acr and finally runs of (xe/pdf)latex to read in the .acr file. Unfortunately
15# the glossary package does just the reverse; i.e. (xe/pdf)latex processing produces a .acr files and makeindex then15# the glossary package does just the reverse; i.e. (xe/pdf)latex processing produces a .acr files and makeindex then
16# is used to convert the .acr file to a .acn file which is then ... . This dependency assumes the glossaries package.16# is used to convert the .acr file to a .acn file which is then ... . This dependency assumes the glossaries package.
17add_cus_dep('acn', 'acr', 0, 'makeacn2acr');17add_cus_dep( 'acn', 'acr', 0, 'makeacn2acr' );
18 sub makeacn2acr {18sub makeacn2acr {
19 system("makeindex -s $_[0].ist -t $_[0].alg -o $_[0].acr $_[0].acn");19 system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acr\" \"$_[0].acn\"" );
20 }20}
21# for glossary package (Sigh...) --- they can co-exist! 21# for glossary package (Sigh...) --- they can co-exist!
22add_cus_dep('acr', 'acn', 0, 'makeacr2acn');22add_cus_dep( 'acr', 'acn', 0, 'makeacr2acn' );
23 sub makeacr2acn {23sub makeacr2acn {
24 system("makeindex -s $_[0].ist -t $_[0].alg -o $_[0].acn $_[0].acr");24 system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acn\" \"$_[0].acr\"" );
25 }25}
26# example of an added custom glossary type that is used in some of the glossary/glossaries example files:26# example of an added custom glossary type that is used in some of the glossary/glossaries example files:
27# this is for the new glossary type command \newglossary[nlg]{notation}{not}{ntn}{Notation} from the glossaries package27# this is for the new glossary type command \newglossary[nlg]{notation}{not}{ntn}{Notation} from the glossaries package
28# NOTE: the glossary package uses a very different command: the <in-ext> and <out-ext>28# NOTE: the glossary package uses a very different command: the <in-ext> and <out-ext>
29# are reversed in the calling sequence :-(29# are reversed in the calling sequence :-(
30add_cus_dep('ntn', 'not', 0, 'makentn2not');30add_cus_dep( 'ntn', 'not', 0, 'makentn2not' );
31 sub makentn2not {31sub makentn2not {
32 system("makeindex -s $_[0].ist -t $_[0].nlg -o $_[0].not $_[0].ntn");32 system("makeindex -s \"$_[0].ist\" -t \"$_[0].nlg\" -o \"$_[0].not\" \"$_[0].ntn\"" );
33 }33}
34# for the glossary package (Sigh...) --- they can co-exist!34# for the glossary package (Sigh...) --- they can co-exist!
35add_cus_dep('not', 'ntn', 0, 'makenot2ntn');35add_cus_dep( 'not', 'ntn', 0, 'makenot2ntn' );
36 sub makenot2ntn {36sub makenot2ntn {
37 system("makeindex -s $_[0].ist -t $_[0].nlg -o $_[0].ntn $_[0].not");37 system("makeindex -s \"$_[0].ist\" -t \"$_[0].nlg\" -o \"$_[0].ntn\" \"$_[0].not\"" );
38 }38}
3939
40# dependencies for custom indexes using the index package40# dependencies for custom indexes using the index package
41# examples for sample.tex for index package:41# examples for sample.tex for index package:
42 add_cus_dep('adx', 'and', 0, 'makeadx2and');42 add_cus_dep( 'adx', 'and', 0, 'makeadx2and' );
43 sub makeadx2and {43sub makeadx2and {
44 system("makeindex -o $_[0].and $_[0].adx");44 system( "makeindex -o \"$_[0].and\" \"$_[0].adx\"" );
45 }45}
46 add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');46add_cus_dep( 'ndx', 'nnd', 0, 'makendx2nnd' );
47 sub makendx2nnd {47sub makendx2nnd {
48 system("makeindex -o $_[0].nnd $_[0].ndx");48 system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx\"" );
49 }49}
50 add_cus_dep('ldx', 'lnd', 0, 'makeldx2lnd');50add_cus_dep( 'ldx', 'lnd', 0, 'makeldx2lnd' );
51 sub makeldx2lnd {51sub makeldx2lnd {
52 system("makeindex -o $_[0].lnd $_[0].ldx");52 system( "makeindex -o \"$_[0].lnd\" \"$_[0].ldx\"" );
53 }53}
5454
55# Custom dependency and function for nomencl package55# Custom dependency and function for nomencl package
56add_cus_dep('nlo', 'nls', 0, 'makenlo2nls');56add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
57 sub makenlo2nls {57sub makenlo2nls {
58 system("makeindex -s nomencl.ist -o $_[0].nls $_[0].nlo");58 system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
59 }59}
6060
61# Custom dependency and function(s) for epstopdf package61# Custom dependency and function(s) for epstopdf package
6262
63# FOR USERS OF epstopf v1.4 and before: should also work with v1.5 and later63# FOR USERS OF epstopf v1.4 and before: should also work with v1.5 and later
64# note: you may get extras runs if you use the .eps extension in the \includgraphics command64# note: you may get extras runs if you use the .eps extension in the \includgraphics command
65# deletes an outdated pdf-image, and triggers a pdflatex-run65# deletes an outdated pdf-image, and triggers a pdflatex-run
66add_cus_dep('eps', 'pdf', 0, 'cus_dep_delete_dest');66add_cus_dep( 'eps', 'pdf', 0, 'cus_dep_delete_dest' );
6767
68# FOR USERS OF epstopdf v1.5 and later only:68# FOR USERS OF epstopdf v1.5 and later only:
69# load it as \usepackage[update,prepend]{epstopdf}69# load it as \usepackage[update,prepend]{epstopdf}
70# detects an outdated pdf-image, and triggers a pdflatex-run70# detects an outdated pdf-image, and triggers a pdflatex-run
71#add_cus_dep('eps', 'pdf', 0, 'cus_dep_require_primary_run');71#add_cus_dep( 'eps', 'pdf', 0, 'cus_dep_require_primary_run' );
7272
73# Custom dependecy to convert tif to png73# Custom dependecy to convert tif to png
74add_cus_dep('tif', 'png', 0, 'maketif2png');74add_cus_dep( 'tif', 'png', 0, 'maketif2png' );
75 sub maketif2png {75sub maketif2png {
76 system("convert $_[0].tif $_[0].png");76 system( "convert \"$_[0].tif\" \"$_[0].png\"" );
77 }77}
7878
=== modified file 'example_rcfiles/sagetex_latexmkrc'
--- example_rcfiles/sagetex_latexmkrc 2011-06-11 22:09:09 +0000
+++ example_rcfiles/sagetex_latexmkrc 2012-12-28 00:31:23 +0000
@@ -14,8 +14,8 @@
14# changed. 14# changed.
1515
1616
17add_cus_dep('sage', 'sout', 0, 'makesout');17add_cus_dep( 'sage', 'sout', 0, 'makesout' );
18$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)';18$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)';
19sub makesout {19sub makesout {
20 system("sage '$_[0].sage'");20 system( "sage \"$_[0].sage\"" );
21}21}
22\ No newline at end of file22\ No newline at end of file
2323
=== added file 'example_rcfiles/sweave_latexmkrc'
--- example_rcfiles/sweave_latexmkrc 1970-01-01 00:00:00 +0000
+++ example_rcfiles/sweave_latexmkrc 2012-12-28 00:31:23 +0000
@@ -0,0 +1,57 @@
1# This is to allow the use of Sweave with latexmk, and in addition to
2# make synctex work properly with it.
3# SEE THE IMPORTANT NOTES below.
4#
5# Sweave (http://www.stat.uni-muenchen.de/~leisch/Sweave/) is a tool
6# that allows to embed the R code for complete data analyses in latex
7# documents. The user edits a file with an extension like .Rnw, and
8# the .tex file is generated from this.
9#
10# Four problems are solved by the code below:
11# 1. Generate the .tex file automatically.
12# 2. Arrange not to re-run unmodified chunks of R code. (A pure
13# optimization.)
14# 3. Fix the execution environment for (pdf)latex.
15# 4. Deal with synctex: If the user wants to use synctex
16# (www.tug.org/TUGboat/tb29-3/tb93laurens.pdf) to synchronize the
17# pdf file with the source file, by default synctex does the
18# synchronization with the generated .tex file, not the original
19# source file. Postprocessing of the .synctex.gz file is necessary
20# to fix this.
21#
22# The following version was worked out and tested by a user (thanks
23# to Brian Beitzel) on MSWindows. It will need at least one change to
24# work on UNIX-like operating systems (which include Linux and OS-X).
25
26# N.B. ===> IMPORTANT NOTES <===
27#
28# 1. The patchDVI package for R needs to be installed from R-Forge, as
29# follows:
30#
31# install.packages("patchDVI", repos="http://R-Forge.R-project.org")
32#
33# 2. In all Sweave (.Rnw) documents, the following lines must be included:
34#
35# \usepackage{Sweave}
36# \SweaveOpts{concordance=TRUE}
37
38
39# Fix the pdflatex command to run Sweave first, and to postprocess the
40# .synctex.gz file:
41# !!!!! THIS IS THE VERSION FOR MS-WINDOWS, with && as a command
42# separator
43$pdflatex = "cmd /c "
44 . "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
45 . "Sweave('%S', driver=cacheSweaveDriver)\""
46 . " && R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
47 . " && Rscript -e "
48 . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
49#
50# !!!TO FIX THIS FOR Linux/OS-X/UNIX, try uncommenting the following:
51# (this version hasn't been tested).
52#$pdflatex = "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
53# . "Sweave('%S', driver=cacheSweaveDriver)\""
54# . " ; R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
55# . " ; Rscript -e "
56# . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
57
058
=== added file 'example_rcfiles/xelatex_latexmkrc'
--- example_rcfiles/xelatex_latexmkrc 1970-01-01 00:00:00 +0000
+++ example_rcfiles/xelatex_latexmkrc 2012-12-28 00:31:23 +0000
@@ -0,0 +1,20 @@
1# This shows how to use xelatex (http://en.wikipedia.org/wiki/XeTeX)
2# with latexmk. Xelatex uses Unicode and "supporting modern font
3# technologies such as OpenType or Apple Advanced Typography.
4#
5# WARNING: latexmk.pl is changing, and plans to have internal
6# support for xelatex.
7#
8# Since xelatex only produces pdf files, it is a replacement for
9# pdflatex. To make it your default typesetting engine within latexmk
10# you will not only need to set the $pdflatex variable to require the
11# use of xelatex, but also to turn on production of pdf files and to
12# turn off the production of dvi and ps files, as in the following
13# code:
14
15
16$pdflatex = 'xelatex %O %S';
17$pdf_mode = 1;
18$postscript_mode = $dvi_mode = 0;
19
20
021
=== added file 'extra-scripts/htlatexonly'
--- extra-scripts/htlatexonly 1970-01-01 00:00:00 +0000
+++ extra-scripts/htlatexonly 2012-12-28 00:31:23 +0000
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3# Replacement for latex executable when latexmk is used for htlatex
4# See TeX4ht-latexmkrc in the example-rcfiles directory of the latexmk
5# distribution for how to use this.
6#
7# This is a shell script suitable for UNIX-like operating systems (including
8# OS-X and linux, and presumably Cygwin under MS-Windows).
9
10latex --recorder $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1
011
=== added file 'extra-scripts/myhtlatex2'
--- extra-scripts/myhtlatex2 1970-01-01 00:00:00 +0000
+++ extra-scripts/myhtlatex2 2012-12-28 00:31:23 +0000
@@ -0,0 +1,19 @@
1#!/bin/sh
2
3# This is a replacement for htlatex from the TeX4ht package. It allows
4# latexmk to be used to do the latex part of the processing.
5# See TeX4ht-latexmkrc in the example-rcfiles directory of the latexmk
6# distribution for how to use this.
7#
8# This is a shell script suitable for UNIX-like operating systems (including
9# OS-X and linux, and presumably Cygwin under MS-Windows).
10
11if [[ $# -lt 1 || $1 == "--help" || $1 == "-help" || $1 == "-h" ]]; then
12 echo "Convert tex file to html. Simplest usage"
13 echo " myhtlatex2 file"
14 exit 1
15fi
16
17latexmk $1
18tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3
19t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644
020
=== modified file 'latexmk.1'
--- latexmk.1 2011-06-11 22:09:09 +0000
+++ latexmk.1 2012-12-28 00:31:23 +0000
@@ -1,4 +1,4 @@
1.TH LATEXMK 1L "7 May 2011" ""1.TH LATEXMK 1L "11 November 2012" ""
2.SH NAME2.SH NAME
3latexmk \- generate LaTeX document3latexmk \- generate LaTeX document
4.SH SYNOPSIS4.SH SYNOPSIS
@@ -24,9 +24,9 @@
24.PP24.PP
25\fILatexmk\fR determines which are the source files by examining the25\fILatexmk\fR determines which are the source files by examining the
26log file. (Optionally, it also examines the list of input and output26log file. (Optionally, it also examines the list of input and output
27files generated by the \fI-recorder\fR option of modern versions of27files generated by the \fB-recorder\fR option of modern versions of
28\fIlatex\fR and \fIpdflatex\fR. See the documentation for the28\fIlatex\fR and \fIpdflatex\fR. See the documentation for the
29\fI-recorder\fR option of \fIlatexmk\fR below.)29\fB-recorder\fR option of \fIlatexmk\fR below.)
30When \fIlatexmk\fR is run, it examines properties of the30When \fIlatexmk\fR is run, it examines properties of the
31source files, and if any have been changed since the last document31source files, and if any have been changed since the last document
32generation, \fIlatexmk\fR will run the various LaTeX processing32generation, \fIlatexmk\fR will run the various LaTeX processing
@@ -63,8 +63,16 @@
63.PP63.PP
64\fILatexmk\fR has the ability to print a banner in gray diagonally64\fILatexmk\fR has the ability to print a banner in gray diagonally
65across each page when making the postscript file. It can also, if65across each page when making the postscript file. It can also, if
66needed, call an external program to do other postprocessing on the66needed, call an external program to do other postprocessing on
67generated files.67generated dvi and postscript files. (See the options \fB-dF\fR and
68\fB-pF\fR, and the documentation for the \fI$dvi_filter\fR and
69\fI$ps_filter\fR configuration variables.) These capabilities are
70leftover from older versions of \fIlatexmk\fR. More flexibility can
71be obtained in current versions, since the command strings for running
72latex, pdflatex, etc can now be configured to run multiple commands.
73This also extends the possibility of postprocessing generated files to
74pdf files.
75files.
68.PP76.PP
69\fILatexmk\fR is highly configurable, both from the command line and77\fILatexmk\fR is highly configurable, both from the command line and
70in configuration files, so that it can accommodate a wide variety of78in configuration files, so that it can accommodate a wide variety of
@@ -89,8 +97,28 @@
89information.97information.
9098
91.SH LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE99.SH LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
92(All options can be introduced by single or double "-" characters,100In general the command line to invoke \fIlatexmk\fR has the form
93e.g., "latexmk -help" or "latexmk --help".)101
102 latexmk [options] [file]
103
104All options can be introduced by single or double "-" characters,
105e.g., "latexmk -help" or "latexmk --help".
106
107\fBNote\fR: In addition to the options in the list below,
108\fIlatexmk\fR recognizes almost all the options recognized by the
109\fIlatex\fR and \fIpdflatex\fR programs in one of both of their
110current TeXLive and MiKTeX implementations. Some of the options for
111these programs also trigger special action or behavior by
112\fIlatexmk\fR, in which case they are in this list. Otherwise, they
113are just passed through to a called \fIlatex\fR or \fIpdflatex\fR
114program. Run \fIlatexmk\fR with the \fB-showextraoptions\fR to get a
115list of the options that \fIlatexmk\fR accepts and that are simply
116passed through to \fIlatex\fR or \fIpdflatex\fR. See also the
117explanation of the \fB-showextraoptions\fR option for more
118information.
119
120\fBDefinitions of options and arguments\fR
121
94.TP122.TP
95.B file123.B file
96One or more files can be specified. If no files are specified,124One or more files can be specified. If no files are specified,
@@ -107,6 +135,23 @@
107135
108then \fIlatexmk\fR will operate on the file "foo.tex". 136then \fIlatexmk\fR will operate on the file "foo.tex".
109.TP137.TP
138
139.B -auxdir=FOO or -aux-directory=FOO
140
141Sets the directory for auxiliary output files of (pdf)latex
142(.aux, .log etc). This
143achieves its effect by the \fB-aux-directory\fR option of (pdf)latex,
144which currently is only implemented on the MiKTeX version of
145(pdf)latex.
146
147See also the \fB-outdir\fR/\fB-output-directory\fR options, and the
148\fI$aux_dir\fR, \fI$out_dir\fR, and \fI$search_path_separator\fR
149configuration variables of \fIlatexmk\fR. In particular, see the
150documentation of \fI$out_dir\fR for some complications on what
151directory names are suitable.
152
153.TP
154
110.B -bibtex 155.B -bibtex
111When the source file uses bbl files for bibliography, run bibtex or156When the source file uses bbl files for bibliography, run bibtex or
112biber as needed to regenerate the bbl files. 157biber as needed to regenerate the bbl files.
@@ -172,8 +217,8 @@
172.B -c217.B -c
173Clean up (remove) all regeneratable files generated by \fIlatex\fR and218Clean up (remove) all regeneratable files generated by \fIlatex\fR and
174\fIbibtex\fR or \fIbiber\fR except dvi, postscript and pdf. These files are a219\fIbibtex\fR or \fIbiber\fR except dvi, postscript and pdf. These files are a
175combination of log files, aux files, latexmk's database file of source220combination of log files, aux files, \fIlatexmk\fR's database file of
176file information, 221source file information,
177and those with extensions222and those with extensions
178specified in the \fI@generated_exts\fR configuration variable. In addition,223specified in the \fI@generated_exts\fR configuration variable. In addition,
179files with extensions by the \fI$clean_ext\fR configuration variable are224files with extensions by the \fI$clean_ext\fR configuration variable are
@@ -233,30 +278,32 @@
233\fIlatexmk\fR can determine them.278\fIlatexmk\fR can determine them.
234279
235By default the list of dependent files is sent to stdout (i.e.,280By default the list of dependent files is sent to stdout (i.e.,
236normally to the screen unless you've redirected latexmk's output).281normally to the screen unless you've redirected \fIlatexmk\fR's
237But you can set the filename where the list is sent by the282output). But you can set the filename where the list is sent by the
238\fI-deps-out=\fR option.283\fB-deps-out=\fR option.
239284
240See the section "USING \fIlatexmk\fR WITH \fImake\fR" for285See the section "USING \fIlatexmk\fR WITH \fImake\fR" for
241an example of how to use a dependency list with \fImake\fR. 286an example of how to use a dependency list with \fImake\fR.
242287
243Users familiar with GNU \fIautomake\fR and \fIgcc\fR will find that288Users familiar with GNU \fIautomake\fR and \fIgcc\fR will find that
244the \fI-deps\fR option is very similar in its purpose and results to289the \fB-deps\fR option is very similar in its purpose and results to
245the \fI-M\fR option to \fIgcc\fR.290the \fB-M\fR option to \fIgcc\fR. (In fact, \fIlatexmk\fR also has
291options \fB-M\fR, \fB-MF\fR, and \fB-MP\fR options that behave like
292those of \fIgcc\fR.)
246.TP293.TP
247.B -dependents294.B -dependents
248Equivalent to \fI-deps\fR.295Equivalent to \fB-deps\fR.
249.TP296.TP
250.B -deps- 297.B -deps-
251Do not show a list of dependent files after processing. (This is the298Do not show a list of dependent files after processing. (This is the
252default.) 299default.)
253.TP300.TP
254.B -dependents-301.B -dependents-
255Equivalent to \fI-deps-\fR.302Equivalent to \fB-deps-\fR.
256.TP303.TP
257.B -deps-out=FILENAME 304.B -deps-out=FILENAME
258Set the filename to which the list of dependent files is written. If305Set the filename to which the list of dependent files is written. If
259the FILENAME argument is omitted or set to '-', then the output is306the FILENAME argument is omitted or set to "-", then the output is
260sent to stdout. 307sent to stdout.
261308
262Use of this option also turns on the output of the list of dependent309Use of this option also turns on the output of the list of dependent
@@ -270,7 +317,7 @@
270317
271Example usage: To use dviselect to select only the even pages of the dvi file:318Example usage: To use dviselect to select only the even pages of the dvi file:
272319
273 latexmk -dF 'dviselect even' foo.tex320 latexmk -dF "dviselect even" foo.tex
274.TP321.TP
275.B -diagnostics322.B -diagnostics
276Print detailed diagnostics during a run. This may help for debugging323Print detailed diagnostics during a run. This may help for debugging
@@ -356,6 +403,16 @@
356.B -h, -help403.B -h, -help
357Print help information.404Print help information.
358.TP405.TP
406.B -jobname=STRING
407Set the basename of output files(s) to STRING, instead of the default,
408which is the basename of the specified TeX file.
409
410This is like the same option for current implementations of the
411\fIlatex\fR and \fIpdflatex\fR, and the passing of this option to
412these programs is part of \fIlatexmk\fR's implementation of
413\fB-jobname\fR.
414
415.TP
359.B -l416.B -l
360Run in landscape mode, using the landscape mode for the previewers and417Run in landscape mode, using the landscape mode for the previewers and
361the dvi to postscript converters. This option is not normally needed418the dvi to postscript converters. This option is not normally needed
@@ -365,6 +422,40 @@
365.B -l-422.B -l-
366Turn off \fB-l\fR.423Turn off \fB-l\fR.
367.TP424.TP
425.B -latex="COMMAND"
426This sets the string specifying the command to run latex, and is
427typically used to add desired options. Since the string normally
428contains spaces, it should be quoted, e.g.,
429
430 latex -latex="latex --shell-escape %O %S" foo.tex
431
432The specification of the contents of the string are the same as for
433the \fI$latex\fR configuration variable. Depending on your
434operating system and the command-line shell you are using, you may
435need to change the single quotes to double quotes (or something
436else).
437
438To set the command for running pdflatex (rather than the command for
439latex) see the \fB-pdflatex\fR option.
440
441Note that the effect of this option can also be achieved by using
442the \fB-e\fR option with a suitable line of Perl code to set the
443\fI$latex\fR variable. See the explanation of the \fB-e\fR option.
444.TP
445.B -M
446Show list of dependent files after processing. This is equivalent to
447the \fB-deps\fR option.
448.TP
449.B -MF file
450If a list of dependents is made, the \fB-MF\fR specifies the file to
451write it to.
452.TP
453.B -MP
454If a list of dependents is made, includes phony target for each source
455file. If you use the dependents list in a Makefile, the dummy rules
456work around errors make gives if you remove header files without
457updating the Makefile to match.
458.TP
368.B -new-viewer459.B -new-viewer
369When in continuous-preview mode, always start a new viewer to view the460When in continuous-preview mode, always start a new viewer to view the
370generated file. By default, \fIlatexmk\fR will, in continuous-preview461generated file. By default, \fIlatexmk\fR will, in continuous-preview
@@ -389,6 +480,31 @@
389\fIbibtex\fR or \fIbiber\fR, which would result in overwriting of the480\fIbibtex\fR or \fIbiber\fR, which would result in overwriting of the
390bbl files. 481bbl files.
391.TP482.TP
483.B -norc
484Turn off the automatic reading of initialization (rc) files.
485
486N.B. Normally the initialization files are read and obeyed, and then
487command line options are obeyed in the order they are encountered.
488Then \fB-norc\fR is an exception to this rule: it is acted on first,
489no matter where is occurs on the command line.
490.TP
491
492.B -outdir=FOO or -output-directory=FOO
493
494Sets the directory for the output files of (pdf)latex. This achieves
495its effect by the \fB-output-directory\fR option of (pdf)latex, which
496currently (Dec. 2011) is implemented on the common versions of
497(pdf)latex, i.e., MiKTeX and TeXLive. It may not be present in other
498versions.
499
500See also the \fB-auxdir\fR/\fB-aux-directory\fR options, and the
501\fI$aux_dir\fR, \fI$out_dir\fR, and \fI$search_path_separator\fR
502configuration variables of \fIlatexmk\fR. In particular, see the
503documentation of \fI$out_dir\fR for some complications on what
504directory names are suitable.
505
506.TP
507
392.B -p508.B -p
393Print out the document. By default it is509Print out the document. By default it is
394the generated postscript file that is printed. But you can use the510the generated postscript file that is printed. But you can use the
@@ -409,7 +525,9 @@
409so it turns them off. 525so it turns them off.
410.TP526.TP
411.B -pdf527.B -pdf
412Generate pdf version of document using pdflatex.528Generate pdf version of document using pdflatex. (See the
529\fB-xelatex\fR if you wish to use \fIxelatex\fR to make your pdf
530file(s).)
413.TP531.TP
414.B -pdfdvi532.B -pdfdvi
415Generate pdf version of document from the dvi file, by default using dvipdf.533Generate pdf version of document from the dvi file, by default using dvipdf.
@@ -424,6 +542,26 @@
424It may get overridden if some other option requires the generation of542It may get overridden if some other option requires the generation of
425a pdf file.)543a pdf file.)
426.TP544.TP
545.B -pdflatex="COMMAND"
546This sets the string specifying the command to run pdflatex, and is
547typically used to add desired options. Since the string normally
548contains spaces, it should be quoted, e.g.,
549
550 latex -pdf -pdflatex="pdflatex --shell-escape %O %S" foo.tex
551
552The specification of the contents of the string are the same as for
553the \fI$pdflatex\fR configuration variable. Depending on your
554operating system and the command-line shell you are using, you may
555need to change the single quotes to double quotes (or something
556else).
557
558To set the command for running latex (rather than the command for
559pdflatex) see the \fB-latex\fR option.
560
561Note that the effect of this option can also be achieved by using
562the \fB-e\fR option with a suitable line of Perl code to set the
563\fI$pdflatex\fR variable. See the explanation of the \fB-e\fR option.
564.TP
427.B -print=dvi, -print=ps, -print=pdf565.B -print=dvi, -print=ps, -print=pdf
428Define which kind of file is printed. This option also ensures that566Define which kind of file is printed. This option also ensures that
429the requisite file is made, and turns on printing. The default is to567the requisite file is made, and turns on printing. The default is to
@@ -491,11 +629,11 @@
491bug in gv that causes an error when the newly updated pdf file is629bug in gv that causes an error when the newly updated pdf file is
492read.) Many other previewers will need a manual update.630read.) Many other previewers will need a manual update.
493631
494Important note: the acroread program on MS-Windows locks the pdf file,632\fBImportant note\fR: the acroread program on MS-Windows locks the pdf file,
495and prevents new versions being written, so it is a bad idea to use633and prevents new versions being written, so it is a bad idea to use
496acroread to view pdf files in preview-continuous mode. It is better634acroread to view pdf files in preview-continuous mode.
497to use a dvi or ps viewer, as set by one of the \fB-view=dvi\fR and635It is better to use a different viewer: SumatraPDF and gsview are
498\fB-view=ps\fR options.636good possibilities.
499637
500There are some other methods for arranging an update, notably useful638There are some other methods for arranging an update, notably useful
501for many versions of xdvi and xpdf. These are best set in639for many versions of xdvi and xpdf. These are best set in
@@ -558,6 +696,39 @@
558Do not show a list of \fIlatexmk\fR's rules and dependencies after696Do not show a list of \fIlatexmk\fR's rules and dependencies after
559processing. (This is the default.)697processing. (This is the default.)
560.TP698.TP
699.B -showextraoptions
700Show the list of extra \fIlatex\fR and \fIpdflatex\fR options that
701\fIlatexmk\fR recognizes. These are options for the \fIlatex\fR and
702\fIpdflatex\fR that \fIlatexmk\fR recognizes, but simply passes
703through to these programs when they are run. These options are
704(currently) a combination of those allowed by the TeXLive and MiKTeX
705implementations. (If a particular option is given to \fIlatexmk\fR
706but is not handled by the particular implementation of \fIlatex\fR or
707\fIpdflatex\fR that is being used, that program will probably give an
708error message.) These options are very numerous, but are not listed
709in this documentation because they have no effect on \fIlatexmk\fR's
710actions.
711
712There are a few options (\fB-includedirectory=dir\fR,
713\fB-initialize\fR, \fB-ini\fR) that are not recognized, either because
714they don't fit with \fIlatexmk\fR's intended operations, or because
715they need special processing by \fIlatexmk\fR that isn't implemented
716(at least, not yet).
717
718There are also options that are accepted by \fIlatex\fR etc, but
719instead trigger actions by \fIlatexmk\fR: \fB-help\fR,
720\fB-version\fR.
721
722Finally, there are certain options for \fIlatex\fR and \fIpdflatex\fR
723(e.g., \fB-recorder\fR) that trigger special actions or behavior by
724\fIlatexmk\fR itself as well as being passed in some form to the
725called \fIlatex\fR and \fIpdflatex\fR program, or that affect other
726programs as well. These options do have entries in this
727documentation. These options are:
728\fB-jobname=STRING\fR, \fB-aux-directory=dir\fR,
729\fB-output-directory=DIR\fR, \fB-quiet\fR, and \fB-recorder\fR.
730
731.TP
561.B -silent732.B -silent
562Run commands silently, i.e., with options that reduce the amount of733Run commands silently, i.e., with options that reduce the amount of
563diagnostics generated. For example, with the default settings, the734diagnostics generated. For example, with the default settings, the
@@ -569,9 +740,9 @@
569To change the options used to make the commands run silently, you need740To change the options used to make the commands run silently, you need
570to configure \fIlatexmk\fR with changed values of its configuration741to configure \fIlatexmk\fR with changed values of its configuration
571variables, the relevant ones being \fI$bibtex_silent_switch\fR,742variables, the relevant ones being \fI$bibtex_silent_switch\fR,
572\fI$biber_silent_switch\fR,743\fI$biber_silent_switch\fR, \fI$dvipdf_silent_switch\fR,
573\fI$dvips_silent_switch\fR, \fI$latex_silent_switch\fR, and744\fI$dvips_silent_switch\fR, \fI$latex_silent_switch\fR,
574\fI$pdflatex_silent_switch\fR.745\fI$makeindex_silent_switch\fR, and \fI$pdflatex_silent_switch\fR.
575.TP746.TP
576.B -use-make747.B -use-make
577When after a run of \fIlatex\fR or \fIpdflatex\fR, there are warnings748When after a run of \fIlatex\fR or \fIpdflatex\fR, there are warnings
@@ -604,6 +775,14 @@
604Set the kind of file used when previewing is requested (e.g., by the775Set the kind of file used when previewing is requested (e.g., by the
605\fB-pv\fR or \fB-pvc\fR switches). The default is to view the "highest"776\fB-pv\fR or \fB-pvc\fR switches). The default is to view the "highest"
606kind of requested file (in the order dvi, ps, pdf). 777kind of requested file (in the order dvi, ps, pdf).
778.TP
779.B -xelatex
780Use xelatex. That is, use xelatex to process the source file(s) to
781pdf (in place of pdflatex). This option is exactly equivalent to
782specifying the following sequence of options:
783
784 -pdflatex="xelatex %O %S" -pdf -dvi- -ps
785
607.PP786.PP
608The preview-continuous option \fB-pvc\fR can only work with one file.787The preview-continuous option \fB-pvc\fR can only work with one file.
609So in this case you will normally only specify one filename on788So in this case you will normally only specify one filename on
@@ -647,16 +826,19 @@
647 "/usr/local/lib/latexmk/LatexMk".826 "/usr/local/lib/latexmk/LatexMk".
648 On a MS-WINDOWS system it looks for "C:\\latexmk\\LatexMk".827 On a MS-WINDOWS system it looks for "C:\\latexmk\\LatexMk".
649 On a cygwin system (i.e., a MS-Windows system in which perl is828 On a cygwin system (i.e., a MS-Windows system in which perl is
650 that of cygwin), \fIlatexmk\fR reads for the first it finds of829that of cygwin), \fIlatexmk\fR reads for the first it finds of
651 "/cygdrive/c/latexmk/LatexMk",830 "/cygdrive/c/latexmk/LatexMk",
652 "/opt/local/share/latexmk/LatexMk",831 "/opt/local/share/latexmk/LatexMk",
653 "/usr/local/share/latexmk/LatexMk",832 "/usr/local/share/latexmk/LatexMk",
654 "/usr/local/lib/latexmk/LatexMk".833 "/usr/local/lib/latexmk/LatexMk".
655.PP834.PP
6562) The user's RC file, "$HOME/.latexmkrc", if it exists. Here $HOME8352) The user's RC file, "$HOME/.latexmkrc", if it exists. Here $HOME
657is the value of the environment variable HOME. On UNIX and clones836is the user's home directory. [\fILatexmk\fR determines the user's
658(including LINUX), this variable is set by the system; on MS-Windows,837home directory as follows: It is the value of the environment variable
659the user may choose to set it.838HOME, if this variable exists, which normally is the case on UNIX-like
839systems (including LINUX and OS-X). Otherwise the environment
840variable USERPROFILE is used, if it exists, which normally is the case
841on MS-Windows systems. Otherwise a blank string is used instead of $HOME.]
660.PP842.PP
6613) The RC file in the current working directory. This file can be8433) The RC file in the current working directory. This file can be
662named either "latexmkrc" or ".latexmkrc", and the first of these to be844named either "latexmkrc" or ".latexmkrc", and the first of these to be
@@ -679,6 +861,12 @@
679\fB-e\fR option, which allows initialization code to be specified in861\fB-e\fR option, which allows initialization code to be specified in
680\fIlatexmk\fR's command line.862\fIlatexmk\fR's command line.
681863
864\fI
865For possible examples of code for in an RC file, see the directory
866example_rcfiles in the distribution of latexmk (e.g., at
867http://ctan.tug.org/tex-archive/support/latexmk/example_rcfiles).
868\fR
869
682.SH HOW TO SET VARIABLES IN INITIALIZATION FILES870.SH HOW TO SET VARIABLES IN INITIALIZATION FILES
683.PP871.PP
684The important variables that can be configured are described in the872The important variables that can be configured are described in the
@@ -759,6 +947,20 @@
759.TP947.TP
760.B %T948.B %T
761The name of the primary tex file.949The name of the primary tex file.
950.TP
951.B %Y
952Name of directory for auxiliary output files (see the configuration
953variable \fI$aux_dir\fR). A directory separation character ('/') is
954appended if \fI$aux_dir\fR is non-empty and does not end in a suitable
955character, with suitable characters being those appropriate to UNIX
956and MS-Windows, i.e., ':', '/' and '\\'.
957.TP
958.B %Z
959Name of directory for output files (see the configuration
960variable \fI$out_dir\fR). A directory separation character ('/') is
961appended if \fI$out_dir\fR is non-empty and does not end in a suitable
962character, with suitable characters being those appropriate to UNIX
963and MS-Windows, i.e., ':', '/' and '\\'.
762.PP964.PP
763If for some reason you need a literal % character in your string not965If for some reason you need a literal % character in your string not
764subject to the above rules, use a pair of these characters. Thus with966subject to the above rules, use a pair of these characters. Thus with
@@ -768,7 +970,7 @@
768name of a postscript file to be viewed. 970name of a postscript file to be viewed.
769.PP971.PP
770Appropriate quoting will be applied to the filename substitutions, so972Appropriate quoting will be applied to the filename substitutions, so
771you mustn't supply them yourself even if you the names of your have973you mustn't supply them yourself even if the names of your files have
772spaces in them. (But if your TeX filenames have spaces in them,974spaces in them. (But if your TeX filenames have spaces in them,
773beware that many versions of the TeX program cannot correctly handle975beware that many versions of the TeX program cannot correctly handle
774filenames containing spaces.) In case latexmk's quoting does not work976filenames containing spaces.) In case latexmk's quoting does not work
@@ -828,6 +1030,9 @@
828should be enclosed in double quotes, as in1030should be enclosed in double quotes, as in
829.PP1031.PP
830 $lpr_pdf = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p %S';1032 $lpr_pdf = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p %S';
1033 $pdf_previewer = 'start "c:/Program Files/SumatraPDF/SumatraPDF.exe" %O %S';
1034 $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/SumatraPDF.exe" %O %S';
1035
831.PP1036.PP
832(Note about the above example: Forward slashes are equivalent to1037(Note about the above example: Forward slashes are equivalent to
833backslashes in filenames under MS-Windows, provided that the filename1038backslashes in filenames under MS-Windows, provided that the filename
@@ -836,6 +1041,14 @@
836about the rules for dealing with forward slashes in strings in the1041about the rules for dealing with forward slashes in strings in the
837Perl language.)1042Perl language.)
8381043
1044\fBCommand names under Cygwin\fR: If latexmk is executed by Cygwin's
1045perl, \fI be particularly certain that pathnames in commands have
1046\fBforward\fI slashes\fR not the usual backslashes for the separator
1047of pathname components. See the above examples. Backslashes often
1048get misinterpreted by the Unix shell used by Cygwin's Perl to execute
1049external commands. Forward slashes don't suffer from this problem,
1050and (when quoted, as above) are equally acceptable to MS-Windows.
1051
839\fBUsing MS-Windows file associations\fR: A useful trick under modern1052\fBUsing MS-Windows file associations\fR: A useful trick under modern
840versions of MS-Windows (e.g., WinXP) is to use just the 1053versions of MS-Windows (e.g., WinXP) is to use just the
841command 'start' by itself:1054command 'start' by itself:
@@ -844,7 +1057,11 @@
844.PP1057.PP
845Under recent versions of MS-Windows, this will cause to be run1058Under recent versions of MS-Windows, this will cause to be run
846whatever program the system has associated with dvi files. (The same1059whatever program the system has associated with dvi files. (The same
847applies for a postscript viewer and a pdf viewer.) 1060applies for a postscript viewer and a pdf viewer.) But note that this
1061trick is not always suitable for the pdf previwer, if your system has
1062acroread for the default pdf viewer. As explained elsewhere, acroread
1063under MS-Windows does not work well with \fIlatex\fR and
1064\fIlatexmk\fR, because acroread locks the pdf file.
8481065
849\fBNot using a certain command\fR: If a command is not to be run, the1066\fBNot using a certain command\fR: If a command is not to be run, the
850command name NONE is used, as in1067command name NONE is used, as in
@@ -864,6 +1081,17 @@
864 $latex = 'latex --src-specials %O %S';1081 $latex = 'latex --src-specials %O %S';
865.PP1082.PP
8661083
1084\fBRunning a subroutine instead of an external command\fR: Use a
1085specification starting with "internal", as in
1086.PP
1087 $latex = 'internal mylatex %O %S';
1088 sub mylatex {
1089 my @args = @_;
1090 # Possible preprocessing here
1091 return system 'latex', @args;
1092 }
1093.PP
1094
867\fBAdvanced tricks\fR: Normally one specifies a single command for the1095\fBAdvanced tricks\fR: Normally one specifies a single command for the
868commands invoked by \fIlatexmk\fR. Naturally, if there is some1096commands invoked by \fIlatexmk\fR. Naturally, if there is some
869complicated additional processing you need to do in your special1097complicated additional processing you need to do in your special
@@ -878,10 +1106,20 @@
8781106
879 $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk %B';1107 $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk %B';
8801108
881This definition assumes you are using a UNIX-like system, so that the1109This definition assumes you are using a UNIX-like system (which
1110includes Linux and OS-X), so that the
882two commands to be run are separated by the semicolon in the middle of1111two commands to be run are separated by the semicolon in the middle of
883the string. 1112the string.
8841113
1114If you are using MS-Windows, you would replace the above line by
1115
1116 $pdflatex = 'cmd /c pdflatex --shell-escape %O %S'
1117 . '&& pst2pdf_for_latexmk %B';
1118
1119Here, the UNIX command separator ; is replaced by &&. In addition,
1120there is a problem that some versions of \fIPerl\fR on MS-Windows do
1121not obey the command separator; this problem is overcome by explicitly
1122invoking the MS-Windows command-line processor \fIcmd.exe\fR.
8851123
886.SH LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES1124.SH LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
887.PP1125.PP
@@ -904,6 +1142,34 @@
904file is created. 1142file is created.
9051143
906.TP1144.TP
1145.B $auto_rc_use [1]
1146Whether to automatically read the standard initialization (rc) files,
1147which are the system RC file, the user's RC file, and the RC file in
1148the current directory. The command line option \fB-norc\fR can be
1149used to turn this setting off. Each RC file could also turn this
1150setting off, i.e., it could set \fI$auto_rc_use\fR to zero to prevent
1151automatic reading of the later RC files.
1152
1153This variable does not affect the reading of RC files specified on the
1154command line by the \fB-r\fR option.
1155
1156.TP
1157.B $aux_dir [""]
1158The directory in which auxiliary files (aux, log, etc) are to be
1159written by a run of (pdf)latex. If this variable is not set, but
1160\fI$out_dir\fR is set, then \fI$aux_dir\fR is set to \fI$out_dir\fR,
1161which is the directory to which general output files are to be
1162written.
1163
1164\fBImportant note\fR: The effect of \fI$aux_dir\fR, if different from
1165\fI$out_dir\fR, is achieved by giving (pdf)latex the
1166\fB-aux-directory\fR. Currently (Dec. 2011) this only works on the
1167MiKTeX version of (pdf)latex.
1168
1169See also the documentation of \fI$out_dir\fR for some complications on
1170what directory names are suitable.
1171
1172.TP
907.B $banner [0]1173.B $banner [0]
908If nonzero, the banner message is printed across each page when1174If nonzero, the banner message is printed across each page when
909converting the dvi file to postscript. Without modifying the variable1175converting the dvi file to postscript. Without modifying the variable
@@ -953,7 +1219,7 @@
953two and the second two examples are equivalent. Each backward slash1219two and the second two examples are equivalent. Each backward slash
954should be doubled to avoid running afoul of \fIPerl\fR's rules for writing1220should be doubled to avoid running afoul of \fIPerl\fR's rules for writing
955strings. 1221strings.
956.PP1222
957\fIImportant note:\fR This variable is now mostly obsolete in the1223\fIImportant note:\fR This variable is now mostly obsolete in the
958current version of \fIlatexmk\fR, 1224current version of \fIlatexmk\fR,
959since it has a better method of searching for files using the1225since it has a better method of searching for files using the
@@ -990,7 +1256,7 @@
990.B $cleanup_includes_cusdep_generated [0]1256.B $cleanup_includes_cusdep_generated [0]
991If nonzero, specifies that cleanup also deletes files that are1257If nonzero, specifies that cleanup also deletes files that are
992generated by custom dependencies.1258generated by custom dependencies.
993(When doing a clean up, e.g., by use of the \fI-C\fR option, custom1259(When doing a clean up, e.g., by use of the \fB-C\fR option, custom
994dependencies are those listed in the \fI.fdb_latexmk\fR file from a1260dependencies are those listed in the \fI.fdb_latexmk\fR file from a
995previous run.)1261previous run.)
996.TP1262.TP
@@ -1006,7 +1272,7 @@
1006files. (There is also extra cleaning as specified by the1272files. (There is also extra cleaning as specified by the
1007\fI$clean_ext\fR, \fI$clean_full_ext\fR and \fI@generated_exts\fR1273\fI$clean_ext\fR, \fI$clean_full_ext\fR and \fI@generated_exts\fR
1008variables.)1274variables.)
1009.PP1275
1010This variable is equivalent to specifying one of1276This variable is equivalent to specifying one of
1011the \fB-c\fR or \fB-C\fR options. But there should be no need1277the \fB-c\fR or \fB-C\fR options. But there should be no need
1012to set this variable from an RC file.1278to set this variable from an RC file.
@@ -1032,9 +1298,50 @@
1032Extra extensions of files for \fIlatexmk\fR to remove when the \fB-C\fR1298Extra extensions of files for \fIlatexmk\fR to remove when the \fB-C\fR
1033option is selected, i.e., extensions of files to remove when the .dvi,1299option is selected, i.e., extensions of files to remove when the .dvi,
1034etc files are to be cleaned-up.1300etc files are to be cleaned-up.
1301
1302More general patterns are allowed, as for \fI$clean_ext\fR.
1303
1304.TP
1305.B $compiling_cmd [undefined], $failure_cmd [undefined], $success_cmd [undefined]
1306
1307These variables specify commands that are executed at certain points
1308of compilations during preview-continuous mode. One motivation for
1309their existance is to allow convenient visual indications of
1310compilation status even when the window receiving the screen output of
1311the compilation is hidden.
1312
1313The commands are executed at the following points:
1314$compiling_cmd at the start of compilation, $success_cmd at the end of
1315a successful compilation, and $failure_cmd at the end of an
1316unsuccessful compilation. If any of above variables is undefined (the
1317default situation) or blank, then the corresponding command is not
1318executed.
1319
1320An example of a typical setting of these variables is as follows
1321
1322 $compiling_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D compiling\\"";
1323 $success_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D OK\\"";
1324 $failure_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D FAILURE\\"";
1325
1326These assume that the program \fIxdotool\fR is installed, that the
1327previewer is using an X-Window system for display, and that the title
1328of the window contains the name of the displayed file, as it normally
1329does. When the commands are executed, the placeholder string %D is replaced by
1330the name of the destination file, which is the previewed file. The
1331above commands result in an appropriate string being appended to the
1332filename in the window title: " compiling", " OK", or " FAILURE".
1333
1334Other placeholders that can be used are %S, %T, and %R, with %S and %T
1335normally being identical. These can be useful for a command changing
1336the title of the edit window. The visual indication in a window title
1337can useful, since the user does not have to keep shifting attention to
1338the (possibly hidden) compilation window to know the status of the
1339compilation.
1340
1035.TP1341.TP
1036.B @cus_dep_list [()]1342.B @cus_dep_list [()]
1037Custom dependency list -- see section on "Custom Dependencies".1343Custom dependency list -- see section on "Custom Dependencies".
1344
1038.TP1345.TP
1039.B @default_files [("*.tex")]1346.B @default_files [("*.tex")]
1040Default list of files to be processed. 1347Default list of files to be processed.
@@ -1063,6 +1370,13 @@
1063\fI@default_files\fR is an array variable, i.e., a sequence of1370\fI@default_files\fR is an array variable, i.e., a sequence of
1064filename specifications is possible.1371filename specifications is possible.
1065.TP1372.TP
1373.B $dependents_phony [0]
1374If a list of dependencies is output, this variable determines whether
1375to include a phony target for each source file. If you use the
1376dependents list in a Makefile, the dummy rules work around errors make
1377gives if you remove header files without updating the Makefile to
1378match.
1379.TP
1066.B $dependents_list [0]1380.B $dependents_list [0]
1067Whether to display a list(s) of dependencies at the end of a run.1381Whether to display a list(s) of dependencies at the end of a run.
1068.TP1382.TP
@@ -1073,7 +1387,7 @@
1073.B $dvi_mode [See below for default]1387.B $dvi_mode [See below for default]
1074If nonzero, generate a dvi version of the document. 1388If nonzero, generate a dvi version of the document.
1075Equivalent to the \fB-dvi\fR option.1389Equivalent to the \fB-dvi\fR option.
1076.PP1390
1077The variable $dvi_mode defaults to 0, but if no explicit requests are1391The variable $dvi_mode defaults to 0, but if no explicit requests are
1078made for other types of file (postscript, pdf), then $dvi_mode will be1392made for other types of file (postscript, pdf), then $dvi_mode will be
1079set to 1. In addition, if a request for a file for which a .dvi file1393set to 1. In addition, if a request for a file for which a .dvi file
@@ -1083,7 +1397,18 @@
1083The command to invoke a dvi-previewer.1397The command to invoke a dvi-previewer.
1084[Default is "start" under MS-WINDOWS; under more recent versions of1398[Default is "start" under MS-WINDOWS; under more recent versions of
1085Windows, this will cause to be run whatever command the system has1399Windows, this will cause to be run whatever command the system has
1086associated with .dvi files.] 1400associated with .dvi files.]
1401
1402\fBImportant note\fR: Normally you will want to have a previewer run
1403detached, so that \fIlatexmk\fR doesn't wait for the previewer to
1404terminate before continuing its work. So normally you should prefix
1405the command by "start ", which flags to \fIlatexmk\fR that it should
1406do the detaching of the previewer itself (by whatever method is
1407appropriate to the operating system). But sometimes letting
1408\fIlatexmk\fR do the detaching is not appropriate (for a variety of
1409non-trivial reasons), so you should put the "start " bit in
1410yourself, whenever it is needed.
1411
1087.TP1412.TP
1088.B $dvi_previewer_landscape ["start xdvi %O %S"]1413.B $dvi_previewer_landscape ["start xdvi %O %S"]
1089The command to invoke a dvi-previewer in landscape mode.1414The command to invoke a dvi-previewer in landscape mode.
@@ -1102,6 +1427,14 @@
1102should be modified to give dvips the options "-P pdf" to ensure that1427should be modified to give dvips the options "-P pdf" to ensure that
1103type 1 fonts are used in the pdf file.1428type 1 fonts are used in the pdf file.
1104.TP1429.TP
1430.B $dvipdf_silent_switch ["-q"]
1431Switch(es) for dvipdf program when silent mode is on.
1432
1433N.B. The standard dvipdf program runs silently, so adding the silent
1434switch has no effect, but is actually innocuous. But if an
1435alternative program is used, e.g., dvipdfmx, then the silent switch
1436has an effect. The default setting is correct for dvipdfm and dvipdfmx.
1437.TP
1105.B $dvips ["dvips %O -o %D %S"]1438.B $dvips ["dvips %O -o %D %S"]
1106The program to used as a filter to convert a .dvi file to a .ps file. 1439The program to used as a filter to convert a .dvi file to a .ps file.
1107If pdf is going to be generated from pdf, then the value of the1440If pdf is going to be generated from pdf, then the value of the
@@ -1150,6 +1483,9 @@
1150\fI$dvi_update_method\fR. The default value is the one appropriate1483\fI$dvi_update_method\fR. The default value is the one appropriate
1151for xdvi on a UNIX system.1484for xdvi on a UNIX system.
1152.TP1485.TP
1486.B $failure_cmd [undefined]
1487See the documentation for $compiling_cmd.
1488.TP
1153.B $fdb_ext ["fdb_latexmk"]1489.B $fdb_ext ["fdb_latexmk"]
1154The extension of the file which \fIlatexmk\fR generates to contain a1490The extension of the file which \fIlatexmk\fR generates to contain a
1155database of information on source files. You will not normally need1491database of information on source files. You will not normally need
@@ -1353,6 +1689,9 @@
1353.B $makeindex ["makeindex %O -o %D %S"]1689.B $makeindex ["makeindex %O -o %D %S"]
1354The index processing program.1690The index processing program.
1355.TP1691.TP
1692.B $makeindex_silent_switch ["-q"]
1693\fBSwitch(es)\fR for the index processing program when silent mode is on.
1694.TP
1356.B $max_repeat [5]1695.B $max_repeat [5]
1357The maximum number of times \fIlatexmk\fR will run latex/pdflatex1696The maximum number of times \fIlatexmk\fR will run latex/pdflatex
1358before deciding that there may be an infinite loop and that it needs1697before deciding that there may be an infinite loop and that it needs
@@ -1362,6 +1701,23 @@
1362(Note that the "etc" covers a lot of cases where one run of1701(Note that the "etc" covers a lot of cases where one run of
1363latex/pdflatex generates files to be read in on a later run.)1702latex/pdflatex generates files to be read in on a later run.)
1364.TP1703.TP
1704.B $MSWin_back_slash [1]
1705This configuration variable only has an effect when \fIlatexmk\fR is
1706running under MS-Windows. It determines whether, when a command is
1707executed under MS-Windows, there should be substituted "\\" for the
1708separator character between components of a directory name.
1709Internally, \fIlatexmk\fR uses "/" for the directory separator
1710character, which is the character used by Unix-like systems.
1711
1712For many programs under MS-Windows, both "\\" and "/" are acceptable
1713as the directory separator character. But some programs only accept
1714"\\". So for safety \fIlatexmk\fR makes a translation, by default.
1715It is conceivable that under certain situations this is undesirable,
1716so the configuration can be changed. (A possible example might be
1717when some of the software is implemented using Cygwin, which provides
1718an Unix-like environment inside MS-Windows.)
1719
1720.TP
1365.B $new_viewer_always [0]1721.B $new_viewer_always [0]
1366This variable applies to \fIlatexmk\fR \fBonly\fR in1722This variable applies to \fIlatexmk\fR \fBonly\fR in
1367continuous-preview mode. If \fI$new_viewer_always\fR is 0,1723continuous-preview mode. If \fI$new_viewer_always\fR is 0,
@@ -1370,6 +1726,34 @@
1370\fI$new_viewer_always\fR is non-zero, this check will be skipped, and1726\fI$new_viewer_always\fR is non-zero, this check will be skipped, and
1371\fIlatexmk\fR will behave as if no viewer is running.1727\fIlatexmk\fR will behave as if no viewer is running.
1372.TP1728.TP
1729
1730.B $out_dir [""]
1731The directory in which output files are to be written by a run of
1732(pdf)latex. See also the variable \fI$aux_dir\fR.
1733
1734The effect of this variable (when non-blank) is achieved by using the
1735\fB-output-directory\fR option of (pdf)latex. This exists in the
1736usual current (Dec. 2011) implementations of TeX, i.e., MiKTeX and
1737TeXLive. But it may not be present in other versions.
1738
1739Commonly, the directory specified for output files is a subdirectory
1740of the current working directory. However, if you specify some other
1741directory, e.g., "/tmp/foo" or "../output", be aware that this could
1742cause problems, e.g., with \fImakeindex\fR or \fIbibtex\fR. This is
1743because modern versions of these programs, by default, will refuse to
1744work when they find that they are asked to write to a file in a
1745directory that appears not to be the current working directory or one
1746of its subdirectories. This is part of security measures by the whole
1747TeX system that try to prevent malicious or errant TeX documents from
1748incorrectly messing with a user's files. If for \fI$out_dir\fR or
1749\fI$aux_dir\fR you really do need to specify an absolute pathname
1750(e.g., "/tmp/foo") or a path (e.g., "../output") that includes a
1751higher-level directory, then you need to disable the security measures
1752(and assume any risks). This can be done by temporarily setting the
1753operating system's environment variable openout_any to "a" (as in
1754"all"), to override the default "paranoid" setting.
1755.TP
1756
1373.B $pdf_mode [0]1757.B $pdf_mode [0]
1374If zero, do NOT generate a pdf version of the document.1758If zero, do NOT generate a pdf version of the document.
1375If equal to 1, generate a pdf version of the document using pdflatex. 1759If equal to 1, generate a pdf version of the document using pdflatex.
@@ -1381,9 +1765,24 @@
1381Equivalent to the \fB-pdf-\fR, \fB-pdf\fR, \fB-pdfdvi\fR, 1765Equivalent to the \fB-pdf-\fR, \fB-pdf\fR, \fB-pdfdvi\fR,
1382\fB-pdfps\fR options.1766\fB-pdfps\fR options.
1383.TP1767.TP
1768
1384.B $pdflatex ["pdflatex %O %S"]1769.B $pdflatex ["pdflatex %O %S"]
1385The LaTeX processing program in the version that makes a pdf file instead1770The LaTeX processing program in the version that makes a pdf file instead
1386of a dvi file.1771of a dvi file.
1772
1773An example of the use of this variable is to arrange for \fIxelatex\fR
1774to be used instead of \fIpdflatex\fR, when you could set
1775
1776 $pdflatex = "xelatex %O %S";
1777
1778Note that \fIxelatex\fR only produces .pdf files (and not .dvi), so to
1779use it you will also need to turn on production of .pdf files, and to
1780turn off the production of .dvi (and .ps) files, either by command
1781line options or by the following settings in an initialization file
1782
1783 $pdf_mode = 1; $postscript_mode = $dvi_mode = 0;
1784
1785
1387.TP1786.TP
1388.B %pdflatex_input_extensions1787.B %pdflatex_input_extensions
1389This variable specifies the extensions tried by latexmk when it finds1788This variable specifies the extensions tried by latexmk when it finds
@@ -1431,17 +1830,36 @@
1431.TP1830.TP
1432.B $pdf_previewer ["start acroread %O %S"]1831.B $pdf_previewer ["start acroread %O %S"]
1433The command to invoke a pdf-previewer.1832The command to invoke a pdf-previewer.
1434[Default is changed to "start" on MS-WINDOWS; under more recent versions of1833
1834On MS-WINDOWS, the default is changed to "cmd /c start """; under more recent versions of
1435Windows, this will cause to be run whatever command the system has1835Windows, this will cause to be run whatever command the system has
1436associated with .pdf files.] 1836associated with .pdf files. But this may be undesirable if this
14371837association is to \fIacroread\fR -- see the notes in the explanation
1438\fBWARNING\fR: Potential problem under MS-Windows:1838of the \fB-pvc\fR option.]
1839
1840On OS-X the default is changed to "open %S", which results in OS-X
1841starting up (and detaching) the viewer associated with the file. By
1842default, for pdf files this association is to OS-X's preview, which is
1843quite satisfactory.
1844
1845\fBWARNING\fR: Problem under MS-Windows:
1439if acroread is used as the pdf previewer, and it is1846if acroread is used as the pdf previewer, and it is
1440actually viewing a pdf file, the pdf file cannot be updated. Thus1847actually viewing a pdf file, the pdf file cannot be updated. Thus
1441makes acroread a bad choice of previewer if you use \fIlatexmk\fR's1848makes acroread a bad choice of previewer if you use \fIlatexmk\fR's
1442previous-continuous mode (option \fB-pvc\fR) under MS-windows.1849previous-continuous mode (option \fB-pvc\fR) under MS-windows.
1443This problem does not occur if ghostview, gv or gsview is used to1850This problem does not occur if, for example, SumatraPDF or gsview is
1444view pdf files.1851used to view pdf files.
1852
1853\fBImportant note\fR: Normally you will want to have a previewer run
1854detached, so that \fIlatexmk\fR doesn't wait for the previewer to
1855terminate before continuing its work. So normally you should prefix
1856the command by "start ", which flags to \fIlatexmk\fR that it should
1857do the detaching of the previewer itself (by whatever method is
1858appropriate to the operating system). But sometimes letting
1859\fIlatexmk\fR do the detaching is not appropriate (for a variety of
1860non-trivial reasons), so you should put the "start " bit in
1861yourself, whenever it is needed.
1862
1445.TP1863.TP
1446.B $pdf_update_command [""]1864.B $pdf_update_command [""]
1447When the pdf previewer is set to be updated by running a command, this1865When the pdf previewer is set to be updated by running a command, this
@@ -1490,7 +1908,7 @@
1490.B $postscript_mode [0]1908.B $postscript_mode [0]
1491If nonzero, generate a postscript version of the document. 1909If nonzero, generate a postscript version of the document.
1492Equivalent to the \fB-ps\fR option.1910Equivalent to the \fB-ps\fR option.
1493.PP1911
1494If some other request is made for which a postscript file is needed,1912If some other request is made for which a postscript file is needed,
1495then $postscript_mode will be set to 1.1913then $postscript_mode will be set to 1.
1496.TP1914.TP
@@ -1541,7 +1959,7 @@
1541file before other processing. Equivalent to specifying the \fB-pF\fR1959file before other processing. Equivalent to specifying the \fB-pF\fR
1542option.1960option.
1543.TP1961.TP
1544.B $ps_previewer ["start gv %O %S", but \(dqstart %O %S" under MS-WINDOWS]1962.B $ps_previewer ["start gv %O %S", but "start %O %S" under MS-WINDOWS]
1545The command to invoke a ps-previewer. (The default under MS-WINDOWS1963The command to invoke a ps-previewer. (The default under MS-WINDOWS
1546will cause to be run whatever command the system has associated 1964will cause to be run whatever command the system has associated
1547with .ps files.)1965with .ps files.)
@@ -1554,8 +1972,19 @@
1554\fBWARNING\fR: Linux systems may have installed one (or more) versions1972\fBWARNING\fR: Linux systems may have installed one (or more) versions
1555of gv under different names, e.g., ggv, kghostview, etc, but perhaps1973of gv under different names, e.g., ggv, kghostview, etc, but perhaps
1556not one called gv. 1974not one called gv.
1975
1976\fBImportant note\fR: Normally you will want to have a previewer run
1977detached, so that \fIlatexmk\fR doesn't wait for the previewer to
1978terminate before continuing its work. So normally you should prefix
1979the command by "start ", which flags to \fIlatexmk\fR that it should
1980do the detaching of the previewer itself (by whatever method is
1981appropriate to the operating system). But sometimes letting
1982\fIlatexmk\fR do the detaching is not appropriate (for a variety of
1983non-trivial reasons), so you should put the "start " bit in
1984yourself, whenever it is needed.
1985
1557.TP1986.TP
1558.B $ps_previewer_landscape ["start gv -swap %O %S", but \(dqstart %O %S" under MS-WINDOWS]1987.B $ps_previewer_landscape ["start gv -swap %O %S", but "start %O %S" under MS-WINDOWS]
1559The command to invoke a ps-previewer in landscape mode.1988The command to invoke a ps-previewer in landscape mode.
1560.TP1989.TP
1561.B $ps_update_command [""]1990.B $ps_update_command [""]
@@ -1589,7 +2018,7 @@
1589specifications (as in \fI$pdflatex\fR) are surrounded by double2018specifications (as in \fI$pdflatex\fR) are surrounded by double
1590quotes. If this variable is 1 (or any other value Perl regards as2019quotes. If this variable is 1 (or any other value Perl regards as
1591true), then quoting is done. Otherwise quoting is omitted. 2020true), then quoting is done. Otherwise quoting is omitted.
1592.PP2021
1593The quoting method used by latexmk is tested to work correctly under2022The quoting method used by latexmk is tested to work correctly under
1594UNIX systems (including Linux and Mac OS-X) and under MS-Windows. It2023UNIX systems (including Linux and Mac OS-X) and under MS-Windows. It
1595allows the use of filenames containing special characters, notably2024allows the use of filenames containing special characters, notably
@@ -1599,7 +2028,7 @@
1599operating system in passing arguments to programs.)2028operating system in passing arguments to programs.)
1600.TP2029.TP
1601.B $recorder [0]2030.B $recorder [0]
1602Whether to use the \fI-recorder\fR option to \fIlatex\fR and2031Whether to use the \fB-recorder\fR option to \fIlatex\fR and
1603\fIpdflatex\fR. Use of this option results in a file of extension2032\fIpdflatex\fR. Use of this option results in a file of extension
1604\fI.fls\fR containing a list of the files that these programs have2033\fI.fls\fR containing a list of the files that these programs have
1605read and written. \fILatexmk\fR will then use this file to improve2034read and written. \fILatexmk\fR will then use this file to improve
@@ -1618,6 +2047,33 @@
1618named for the program, i.e., latex.fls or pdflatex.fls. In this2047named for the program, i.e., latex.fls or pdflatex.fls. In this
1619second case, \fIlatexmk\fR copies the latex.fls or pdflatex.fls to a2048second case, \fIlatexmk\fR copies the latex.fls or pdflatex.fls to a
1620file with the basename of the main LaTeX document, e.g., Document.fls.2049file with the basename of the main LaTeX document, e.g., Document.fls.
2050
2051.TP
2052.B $search_path_separator [See below for default]
2053The character separating paths in the environment variables TEXINPUTS,
2054BIBINPUTS, and BSTINPUTS. This variable is mainly used by
2055\fIlatexmk\fR when the \fB-outdir\fR, \fB-output-directory\fR,
2056\fB-auxdir\fR, and/or \fB-aux-directory\fR options are used. In that
2057case \fIlatexmk\fR needs to communicate appropriately modified search
2058paths to $\fIbibtex\fR, \fIdvipdf\fR, \fIdvips\fR, and
2059\fI(pdf)latex\fR.
2060
2061[Comment to technically savvy readers: \fI(pdf)latex\fR doesn't
2062actually need the modified search path, because it corrects it
2063internally. But, surprisingly, \fIdvipdf\fR and \fIdvips\fR do,
2064because sometimes graphics files get generated in the output or aux
2065directories.]
2066
2067The default under MSWin and Cygwin is ';' and under UNIX-like
2068operating systems (including Linux and OS-X) is ':'. Normally the
2069defaults give correct behavior. But there can be difficulties if your
2070operating system is of one kind, but some of your software is running
2071under an emulator for the other kind of operating system; in that case
2072you'll need to find out what is needed, and set
2073\fI$search_path_separator\fR explicitly. (The same goes, of course,
2074for unusual operating systems that are not in the MSWin, Linux, OS-X,
2075Unix collection.)
2076
1621.TP2077.TP
1622.B $sleep_time [2]2078.B $sleep_time [2]
1623The time to sleep (in seconds) between checking for source file2079The time to sleep (in seconds) between checking for source file
@@ -1635,6 +2091,11 @@
1635\fI$texfile_search\fR, it is a string of space-separated filenames, and2091\fI$texfile_search\fR, it is a string of space-separated filenames, and
1636then \fIlatexmk\fR replaces \fI@default_files\fR with the filenames in2092then \fIlatexmk\fR replaces \fI@default_files\fR with the filenames in
1637\fI$texfile_search\fR to which is added "*.tex".2093\fI$texfile_search\fR to which is added "*.tex".
2094
2095.TP
2096.B $success_cmd [undefined]
2097See the documentation for $compiling_cmd.
2098
1638.TP2099.TP
1639.B $tmpdir [See below for default]2100.B $tmpdir [See below for default]
1640Directory to store temporary files that \fIlatexmk\fR may generate while2101Directory to store temporary files that \fIlatexmk\fR may generate while
@@ -1732,7 +2193,7 @@
17322193
1733 add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );2194 add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
1734 sub fig2eps {2195 sub fig2eps {
1735 system("fig2dev -Leps $_[0].fig $_[0].eps"); 2196 system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
1736 }2197 }
17372198
1738The first line adds a custom dependency that converts a file with2199The first line adds a custom dependency that converts a file with
@@ -1760,32 +2221,35 @@
1760statement, i.e., the invocation of system, which returns the value 02221statement, i.e., the invocation of system, which returns the value 0
1761on success.2222on success.
17622223
1763If you use filenames with spaces in them, and if your LaTeX system and
1764all other relevant software correctly handle such filenames, then you
1765could put single quotes around filenames in the command line that is
1766executed:
1767
1768 add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
1769 sub fig2eps {
1770 system("fig2dev -Lps '$_[0].fig' '$_[0].eps'");
1771 }
1772
1773This causes the invocation of the \fIfig2dev\fR program to have quoted
1774filenames; it should therefore work with filenames containing spaces.
1775\fBHowever, not all software deals correctly with filenames that
1776contain spaces. Moreover, the rules, if any, for quoting filenames
1777vary between operating systems, command shells and individual pieces
1778of software, so this code may not always work.\fR
1779
1780If you use pdflatex instead of latex, then you will probably prefer to2224If you use pdflatex instead of latex, then you will probably prefer to
1781convert your graphics files to pdf format, in which case you would2225convert your graphics files to pdf format, in which case you would
1782replace the above code in an initialization file by2226replace the above code in an initialization file by
17832227
1784 add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );2228 add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
1785 sub fig2pdf {2229 sub fig2pdf {
1786 system("fig2dev -Lpdf $_[0].fig $_[0].pdf"); 2230 system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
1787 }2231 }
17882232
2233\fBNote 1:\fR In the command lines given in the system commands in the
2234above examples, double quotes have been inserted around the file names
2235(implemented by '\"' in the Perl language). They immunize the running
2236of the program against special characters in filenames. Very often
2237these quotes are not necessary, i.e., they can be omitted. But it is
2238normally safer to keep them in. Even though the rules for quoting
2239vary between operating systems, command shells and individual pieces
2240of software, the quotes in the above examples do not cause problems in
2241the cases I have tested.
2242
2243\fBNote 2:\fR One case in which the quotes are important is when the
2244files are in a subdirectory and your operating system is Microsoft
2245Windows. Then the separator character for directory components can be
2246either a forward slash '/' or Microsoft's more usual backward slash
2247'\\'. Forward slashes are generated by latexmk, to maintain its
2248sanity from software like MiKTeX that mixes both directory
2249separators; but their correct use normally requires quoted filenames.
2250(See a log file from a run of MiKTeX (at least in v. 2.9) for an
2251example of the use of both directory separators.)
2252
1789If you have some general custom dependencies defined in the system or2253If you have some general custom dependencies defined in the system or
1790user initialization file, you may find that for a particular project2254user initialization file, you may find that for a particular project
1791they are undesirable. So you might want to delete the unneeded ones.2255they are undesirable. So you might want to delete the unneeded ones.
@@ -1816,7 +2280,7 @@
18162280
1817 add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');2281 add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');
1818 sub makendx2nnd {2282 sub makendx2nnd {
1819 system("makeindex -o $_[0].nnd $_[0].ndx");2283 system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx"\" );
1820 }2284 }
18212285
1822(You will need to modify this code if you use filenames2286(You will need to modify this code if you use filenames
@@ -1854,7 +2318,7 @@
18542318
1855 push @cus_dep_list, "fig eps 0 fig2eps";2319 push @cus_dep_list, "fig eps 0 fig2eps";
1856 sub fig2eps {2320 sub fig2eps {
1857 system("fig2dev -Lps $_[0].fig $_[0].eps");2321 system( "fig2dev -Lps \"$_[0].fig\" \"$_[0].eps\"" );
1858 }2322 }
18592323
1860This method still works, and is equivalent to the earlier code using2324This method still works, and is equivalent to the earlier code using
@@ -1977,11 +2441,11 @@
1977make .pdf files from .fig files produced by the \fIxfig\fR program;2441make .pdf files from .fig files produced by the \fIxfig\fR program;
1978these are commonly used for graphics insertions in LaTeX documents.2442these are commonly used for graphics insertions in LaTeX documents.
1979\fILatexmk\fR is arranged to output a dependency file after each run.2443\fILatexmk\fR is arranged to output a dependency file after each run.
1980It is given the \fI-recorder\fR option, which improves its detection2444It is given the \fB-recorder\fR option, which improves its detection
1981of files generated during a run of \fIpdflatex\fR; such files should2445of files generated during a run of \fIpdflatex\fR; such files should
1982not be in the dependency list. The \fI-e\fR options are used to turn2446not be in the dependency list. The \fB-e\fR options are used to turn
1983off all custom dependencies, and to document this. Instead the2447off all custom dependencies, and to document this. Instead the
1984\fI-use-make\fR is used to delegate the making of missing files to2448\fB-use-make\fR is used to delegate the making of missing files to
1985\fImake\fR itself.2449\fImake\fR itself.
19862450
1987Suppose in the LaTeX file there is a command \\includegraphics{graph},2451Suppose in the LaTeX file there is a command \\includegraphics{graph},
@@ -2015,8 +2479,8 @@
2015Acroread under UNIX/LINUX views pdf, but the file needs to be closed2479Acroread under UNIX/LINUX views pdf, but the file needs to be closed
2016and reopened to view an updated version.2480and reopened to view an updated version.
2017Under MS-Windows, acroread locks its input file and so the2481Under MS-Windows, acroread locks its input file and so the
2018pdf file cannot be updated. (Remedy: configure \fIlatexmk\fR to use gsview2482pdf file cannot be updated. (Remedy: configure \fIlatexmk\fR to use
2019instead.) 2483\fIsumatrapdf\fR instead.)
2020.SH THANKS TO2484.SH THANKS TO
2021Authors of previous versions. Many users with their feedback, and2485Authors of previous versions. Many users with their feedback, and
2022especially 2486especially
@@ -2027,7 +2491,7 @@
2027harvested by worms and viruses.)2491harvested by worms and viruses.)
2028.SH AUTHOR2492.SH AUTHOR
2029Current version, by John Collins (username collins at node phys.psu.edu).2493Current version, by John Collins (username collins at node phys.psu.edu).
2030(Version 4.24).2494(Version 4.35).
20312495
2032Released version can be obtained from CTAN:2496Released version can be obtained from CTAN:
2033<http://www.tug.org/tex-archive/support/latexmk/>, and from the2497<http://www.tug.org/tex-archive/support/latexmk/>, and from the
20342498
=== modified file 'latexmk.bat'
--- latexmk.bat 2006-06-12 00:43:25 +0000
+++ latexmk.bat 2012-12-28 00:31:23 +0000
@@ -1,5 +1,5 @@
1Rem Execute latexmk.pl, searching for it in the PATH1Rem Execute latexmk.pl, searching for it in the PATH
2Rem Assume perl is in the PATH. If not, you should replace 'perl' by 2Rem Assume perl is in the PATH. If not, you should replace 'perl' by
3Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'3Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'
44
5perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %95perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
66
=== modified file 'latexmk.pdf'
7Binary files latexmk.pdf 2011-06-11 22:09:09 +0000 and latexmk.pdf 2012-12-28 00:31:23 +0000 differ7Binary files latexmk.pdf 2011-06-11 22:09:09 +0000 and latexmk.pdf 2012-12-28 00:31:23 +0000 differ
=== modified file 'latexmk.pl'
--- latexmk.pl 2011-06-11 22:09:09 +0000
+++ latexmk.pl 2012-12-28 00:31:23 +0000
@@ -1,4 +1,8 @@
1#!/usr/bin/env perl1#!/usr/bin/env perl
2
3# N.B. !!!!!!!!!!! See 17 July 2012 comments !!!!!!!!!!!!!!!!!!
4
5
2# On a UNIX-like system, the above enables latexmk to run independently6# On a UNIX-like system, the above enables latexmk to run independently
3# of the location of the perl executable. This line relies on the 7# of the location of the perl executable. This line relies on the
4# existence of the program /usr/bin/env8# existence of the program /usr/bin/env
@@ -9,7 +13,6 @@
913
10# with the path of the perl executable adjusted for your system. 14# with the path of the perl executable adjusted for your system.
1115
12
13use warnings;16use warnings;
1417
15# Delete #??!! when working18# Delete #??!! when working
@@ -22,6 +25,7 @@
22## (I have hooks for this).25## (I have hooks for this).
2326
2427
28
25#=======================================29#=======================================
2630
27#?? Force mode doesn't appear to do force (if error in latex file)31#?? Force mode doesn't appear to do force (if error in latex file)
@@ -107,15 +111,15 @@
107111
108$my_name = 'latexmk';112$my_name = 'latexmk';
109$My_name = 'Latexmk';113$My_name = 'Latexmk';
110$version_num = '4.24';114$version_num = '4.35';
111$version_details = "$My_name, John Collins, 7 May 2011";115$version_details = "$My_name, John Collins, 11 Nov. 2012";
112
113116
114use Config;117use Config;
115use File::Copy;118use File::Copy;
116use File::Basename;119use File::Basename;
117use FileHandle;120use FileHandle;
118use File::Find;121use File::Find;
122use List::Util qw( max );
119use Cwd; # To be able to change cwd123use Cwd; # To be able to change cwd
120use Cwd "chdir"; # Ensure $ENV{PWD} tracks cwd124use Cwd "chdir"; # Ensure $ENV{PWD} tracks cwd
121use Digest::MD5;125use Digest::MD5;
@@ -141,7 +145,7 @@
141 warn "Something wrong with the perl configuration: No signals?\n";145 warn "Something wrong with the perl configuration: No signals?\n";
142}146}
143147
144## Copyright John Collins 1998-2011148## Copyright John Collins 1998-2012
145## (username collins at node phys.psu.edu)149## (username collins at node phys.psu.edu)
146## (and thanks to David Coppit (username david at node coppit.org) 150## (and thanks to David Coppit (username david at node coppit.org)
147## for suggestions) 151## for suggestions)
@@ -175,37 +179,94 @@
175## 5. Parsing of log file instead of source file is used to179## 5. Parsing of log file instead of source file is used to
176## obtain dependencies, by default.180## obtain dependencies, by default.
177##181##
178## Modification log from 1 Jan 2011 onwards in detail182## Modification log from 9 Dec 2011 onwards in detail
179##183##
180## 7 May 2011, John Collins With biber, use kpsewhich to find source184## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
181## files (e.g., .bib)185## 11 Nov 2012 John Collins V. 4.35
182## 24 Mar 2011, John Collins Correct bug in detection of source files186## Correct bug that under some combinations of
183## listed in .fls187## MS-Windows, cygwin and distributions of
184## 21 Mar 2011, John Collins Add 'bcf' to list of generated extensions188## TeX, line endings in fls file (CRLF v. LF)
185## Deal with case that fls files are latex.fls189## were misparsed, resulting in source
186## and pdflatex.fls190## filenames that incorrectly contained CR
187## 19--21 Mar 2011, John Collins -deps and -rules options191## characters.
188## $use_make_for_missing_files192## Correct bug that when --gg mode is on, the
189## -recorder option193## rule database contained items from the OLD
190## 12 Mar 2011, John Collins Deal with problem that if maximum number of194## fdb file. Using --gg mode implies that
191## runs of (pdf)latex is exceeded, -pvc mode195## the rules in the OLD fdb file must be
192## infinitely repeats (pdf)latex196## ignored (since they may be wrong).
193## 11 Mar 2011, John Collins Fix problem that changes in generated files197## 1 Oct 2012 John Collins V. 4.34
194## during run of (pdf)latex may not be detected198## Correct problem that if a file is read by
195## if the run is shorter than the granularity 199## latex only after being written, it is
196## of file times.200## not a true source file.
197## 28 Feb 2011, John Collins Corrections of comments and messages201## 19 Aug 2012 John Collins V. 4.33c
198## 22 Feb 2011, John Collins Documentation improvement.202## Correct infinite loop when maximum passes
199## 16 Feb 2011, John Collins Correctly parse blg files of biber 0.8203## exceeded.
200## Version 4.23.204## Improve error messages
201## 3 Feb 2011, John Collins Correct handling of errors in rc files205## 12 Aug 2012 John Collins V. 4.33b
202## 23 Jan 2011, John Collins Fix detection of makeindex files with206## Improve text displayed by -showextraoptions
203## MiKTeX v >= 2.8207## 8 Aug 2012 John Collins V. 4.33a
204## 23 Jan 2011, John Collins Fix detection of biber use with MiKTeX 208## Fix problem that with Cygwin,
205## (which doesn't put openout lines in log file).209## latexmk runs very slowly, because
206## 9 Jan 2011, John Collins Correct parsing of blg file for biber 0.7.2210## subroutine good_cwd() runs the
207## 3 Jan 2011, John Collins Small correction on reading .fdb_file211## program cygpath on every
208## 1 Jan 2011, John Collins Biber implementation212## invocation. Solution: cach cwd.
213## 6 Aug 2012 John Collins Version number to 4.33
214## 4 Aug 2012 John Collins Further fixes of filename treatment:
215## normalize_filename routine to remove
216## string for current directory, and
217## convert '\' directory separator to '/'
218## (Note MiKTeX uses BOTH, see e.g., its
219## log file, so MSWin systems are NOT
220## guaranteed to be consistent. But latexmk
221## needs to treat filenames differing by
222## change of directory separator as equivalent.
223## Warning: SOME MWWin programs, e.g., current
224## cmd.exe (as tested yesterday on PSU computer
225## in library) do not accept '/' as directory
226## separator, so it may be worth allowing conversion
227## to '\' in executed files.)
228## Also improve running when $silent is on:
229## don't print warnings about undefined references
230## and citations, but simply display a summary, whose
231## criterion for being shown had to be fixed.
232## 3 Aug 2012 John Collins Fix finding of files in aux-dir
233## 1 Aug 2012 John Collins Handle aliasing of cwd in output file
234## to avoid unnecessary warnings about
235## actual o/p file .ne. expected with MiKTeX
236## Clean up subroutine names:
237## parse_logB to parse_log
238## make_preview_continuousB to make_preview_continuous
239## rdb_find_new_filesB to rdb_find_new_files
240## rdb_set_dependentsA to rdb_set_dependents
241## rdb_makeB to rdb_make
242## rdb_makeB1 to rdb_make1
243## rdb_one_depA to rdb_one_dep
244## rdb_recurseA to rdb_recurse
245## rdb_update_filesA to rdb_update_files
246## 28, 29, 30 Jul 2012 John Collins Try better file-name normalization in reading fls file.
247## 18 Jul 2012 John Collins Change ver. to 4.32d.
248## Merge changes from 29 June 2012:
249## Add $dvipdf_silent_switch
250## 17 Jul 2012 John Collins Try better fix for error/rerun and retest issue.
251## Now rdb_primary_run doesn't have so many complications
252## rdb_makeB's PASS loop is simpler
253## rdb_submakeB is unneeded.
254## See the lines starting #??
255## See comments nearby
256## Compare w/ v. 4.32a
257## V. 4.32b
258## 17 Jul 2012 John Collins Fix problem that after finding error in a run
259## of (pdf)latex, latexmk didn't check for
260## changed files before giving up.
261## To do that, I reverted some changes in
262## rdb_primary_run to pre v. 4.31
263## Remove unused code
264## v. 4.32a
265## 8 May 2012 John Collins Possibility to substitute backslashes for
266## forward slashes in file and directory
267## names in executed command line,
268## for MSWin
269## 5 May 2012 John Collins Comment on ctrl/C handling in WAIT loop
209##270##
210## 1998-2010, John Collins. Many improvements and fixes.271## 1998-2010, John Collins. Many improvements and fixes.
211## See CHANGE-log.txt for full list, and CHANGES for summary272## See CHANGE-log.txt for full list, and CHANGES for summary
@@ -325,6 +386,7 @@
325 '^LaTeX Warning: File `([^\\\']*)\\\' not found',386 '^LaTeX Warning: File `([^\\\']*)\\\' not found',
326 '^Package .* [fF]ile `([^\\\']*)\\\' not found',387 '^Package .* [fF]ile `([^\\\']*)\\\' not found',
327 'Error: pdflatex \(file ([^\)]*)\): cannot find image file',388 'Error: pdflatex \(file ([^\)]*)\): cannot find image file',
389 ': File (.*) not found:\s*$',
328);390);
329391
330## Hash mapping file extension (w/o period, e.g., 'eps') to a single regexp,392## Hash mapping file extension (w/o period, e.g., 'eps') to a single regexp,
@@ -369,9 +431,152 @@
369# 'pdflatex' => { 'tex' => 1, 'pdf' => 1, 'jpg' => 1, 'png' => 1 }; );431# 'pdflatex' => { 'tex' => 1, 'pdf' => 1, 'jpg' => 1, 'png' => 1 }; );
370# Instead we'll exercise the user-friendly access routines:432# Instead we'll exercise the user-friendly access routines:
371add_input_ext( 'latex', 'tex', 'eps' );433add_input_ext( 'latex', 'tex', 'eps' );
372add_input_ext( 'pdflatex', 'tex', 'jpg', 'pdf' );434add_input_ext( 'pdflatex', 'tex', 'jpg', 'pdf', 'png' );
373#show_input_ext( 'latex' ); show_input_ext( 'pdflatex' );435#show_input_ext( 'latex' ); show_input_ext( 'pdflatex' );
374436
437# Information about options to latex and pdflatex that latexmk will simply
438# pass through to (pdf)latex
439# Option without arg. maps to itself.
440# Option with arg. maps the option part to the full specification
441# e.g., -kpathsea-debug => -kpathsea-debug=NUMBER
442%allowed_latex_options = ();
443%allowed_latex_options_with_arg = ();
444foreach (
445 #####
446 # TeXLive options
447 "-draftmode switch on draft mode (generates no output PDF)",
448 "-enc enable encTeX extensions such as \\mubyte",
449 "-etex enable e-TeX extensions",
450 "-file-line-error enable file:line:error style messages",
451 "-no-file-line-error disable file:line:error style messages",
452 "-fmt=FMTNAME use FMTNAME instead of program name or a %& line",
453 "-halt-on-error stop processing at the first error",
454 "-interaction=STRING set interaction mode (STRING=batchmode/nonstopmode/\n".
455 " scrollmode/errorstopmode)",
456 "-ipc send DVI output to a socket as well as the usual\n".
457 " output file",
458 "-ipc-start as -ipc, and also start the server at the other end",
459 "-kpathsea-debug=NUMBER set path searching debugging flags according to\n".
460 " the bits of NUMBER",
461 "-mktex=FMT enable mktexFMT generation (FMT=tex/tfm/pk)",
462 "-no-mktex=FMT disable mktexFMT generation (FMT=tex/tfm/pk)",
463 "-mltex enable MLTeX extensions such as \charsubdef",
464 "-output-comment=STRING use STRING for DVI file comment instead of date\n".
465 " (no effect for PDF)",
466 "-output-format=FORMAT use FORMAT for job output; FORMAT is `dvi\" or `pdf\"",
467 "-parse-first-line enable parsing of first line of input file",
468 "-no-parse-first-line disable parsing of first line of input file",
469 "-progname=STRING set program (and fmt) name to STRING",
470 "-shell-escape enable \\write18{SHELL COMMAND}",
471 "-no-shell-escape disable \\write18{SHELL COMMAND}",
472 "-shell-restricted enable restricted \\write18",
473 "-src-specials insert source specials into the DVI file",
474 "-src-specials=WHERE insert source specials in certain places of\n".
475 " the DVI file. WHERE is a comma-separated value\n".
476 " list: cr display hbox math par parend vbox",
477 "-synctex=NUMBER generate SyncTeX data for previewers if nonzero",
478 "-translate-file=TCXNAME use the TCX file TCXNAME",
479 "-8bit make all characters printable by default",
480
481 #####
482 # MikTeX options not in TeXLive
483 "-alias=app pretend to be app",
484 "-buf-size=n maximum number of characters simultaneously present\n".
485 " in current lines",
486 "-c-style-errors C-style error messages",
487 "-disable-installer disable automatic installation of missing packages",
488 "-disable-pipes disable input (output) from (to) child processes",
489 "-disable-write18 disable the \\write18{command} construct",
490 "-dont-parse-first-line disable checking whether the first line of the main\n".
491 " input file starts with %&",
492 "-enable-enctex enable encTeX extensions such as \\mubyte",
493 "-enable-installer enable automatic installation of missing packages",
494 "-enable-mltex enable MLTeX extensions such as \charsubdef",
495 "-enable-pipes enable input (output) from (to) child processes",
496 "-enable-write18 fully enable the \\write18{command} construct",
497 "-error-line=n set the width of context lines on terminal error\n".
498 " messages",
499 "-extra-mem-bot=n set the extra size (in memory words) for large data\n".
500 " structures",
501 "-extra-mem-top=n set the extra size (in memory words) for chars,\n".
502 " tokens, et al",
503 "-font-max=n set the maximum internal font number",
504 "-font-mem-size=n set the size, in TeX memory words, of the font memory",
505 "-half-error-line=n set the width of first lines of contexts in terminal\n".
506 " error messages",
507 "-hash-extra=n set the extra space for the hash table of control\n".
508 " sequences",
509 "-job-time=file set the time-stamp of all output files equal to\n".
510 " file'stime-stamp",
511 "-main-memory=n change the total size (in memory words) of the main\n".
512 " memory array",
513 "-max-in-open=n set the maximum number of input files and error\n".
514 " insertions that can be going on simultaneously",
515 "-max-print-line=n set the width of longest text lines output",
516 "-max-strings=n set the maximum number of strings",
517 "-nest-size=n set the maximum number of semantic levels\n".
518 " simultaneously active",
519 "-no-c-style-errors standard error messages",
520 "-param-size=n set the the maximum number of simultaneous macro\n".
521 " parameters",
522 "-pool-size=n set the maximum number of characters in strings",
523 "-record-package-usages=file record all package usages and write them into\n".
524 " file",
525 "-restrict-write18 partially enable the \\write18{command} construct",
526 "-save-size=n set the the amount of space for saving values\n".
527 " outside of current group",
528 "-stack-size=n set the maximum number of simultaneous input sources",
529 "-string-vacancies=n set the minimum number of characters that should be\n".
530 " available for the user's control sequences and font\n".
531 " names",
532 "-tcx=name process the TCX table name",
533 "-time-statistics show processing time statistics",
534 "-trace enable trace messages",
535 "-trace=tracestreams enable trace messages. The tracestreams argument is\n".
536 " a comma-separated list of trace stream names",
537 "-trie-size=n set the amount of space for hyphenation patterns",
538 "-undump=name use name as the name of the format to be used,\n".
539 " instead of the name by which the program was\n".
540 " called or a %& line.",
541
542 #####
543 # Options passed to (pdf)latex that have special processing by latexmk,
544 # so they are commented out here.
545 #-jobname=STRING set the job name to STRING
546 #-aux-directory=dir Set the directory dir to which auxiliary files are written
547 #-output-directory=DIR use existing DIR as the directory to write files in
548 #-quiet
549 #-recorder enable filename recorder
550 #
551 # Options with different processing by latexmk than (pdf)latex
552 #-help
553 #-version
554 #
555 # Options NOT used by latexmk
556 #-includedirectory=dir prefix dir to the search path
557 #-initialize become the INI variant of the compiler
558 #-ini be pdfinitex, for dumping formats; this is implicitly
559 # true if the program name is `pdfinitex'
560) {
561 if ( /^([^\s=]+)=/ ) {
562 $allowed_latex_options_with_arg{$1} = $_;
563 }
564 elsif ( /^([^\s=]+)\s/ ) {
565 $allowed_latex_options{$1} = $_;
566 }
567 else {
568 $allowed_latex_options{$_} = $_;
569 }
570}
571
572# Arrays of options that will be added to latex and pdflatex.
573# These need to be stored until after the command line parsing is finished,
574# in case the values of $latex and/or $pdflatex change after an option
575# is added.
576@extra_latex_options = ();
577@extra_pdflatex_options = ();
578
579
375## Command to invoke biber & bibtex580## Command to invoke biber & bibtex
376$biber = 'biber %O %B';581$biber = 'biber %O %B';
377$bibtex = 'bibtex %O %B';582$bibtex = 'bibtex %O %B';
@@ -394,6 +599,12 @@
394599
395## Command to convert dvi file to pdf file directly:600## Command to convert dvi file to pdf file directly:
396$dvipdf = 'dvipdf %O %S %D';601$dvipdf = 'dvipdf %O %S %D';
602# N.B. Standard dvipdf runs dvips and gs with their silent switch, so for
603# standard dvipdf $dvipdf_silent_switch is unneeded, but innocuous.
604# But dvipdfmx can be used instead, and it has a silent switch (-q).
605# So implementing $dvipdf_silent_switch is useful.
606
607$dvipdf_silent_switch = '-q';
397608
398## Command to convert dvi file to ps file:609## Command to convert dvi file to ps file:
399$dvips = 'dvips %O -o %D %S';610$dvips = 'dvips %O -o %D %S';
@@ -428,6 +639,10 @@
428## Current tex's treat extensions like UNIX teTeX:639## Current tex's treat extensions like UNIX teTeX:
429$extension_treatment = 'unix';640$extension_treatment = 'unix';
430641
642## Substitute backslashes in file and directory names for
643## MSWin command line
644$MSWin_back_slash = 1;
645
431$dvi_update_signal = undef;646$dvi_update_signal = undef;
432$ps_update_signal = undef;647$ps_update_signal = undef;
433$pdf_update_signal = undef;648$pdf_update_signal = undef;
@@ -442,7 +657,8 @@
442657
443$quote_filenames = 1; # Quote filenames in external commands658$quote_filenames = 1; # Quote filenames in external commands
444659
445660$del_dir = ''; # Directory into which cleaned up files are to be put.
661 # If $del_dir is '', just delete the files
446662
447#########################################################################663#########################################################################
448664
@@ -459,7 +675,7 @@
459$MSWin_fudge_break = 1; # Give special treatment to ctrl/C and ctrl/break675$MSWin_fudge_break = 1; # Give special treatment to ctrl/C and ctrl/break
460 # in -pvc mode under MSWin676 # in -pvc mode under MSWin
461 # Under MSWin32 (at least with perl 5.8 and WinXP)677 # Under MSWin32 (at least with perl 5.8 and WinXP)
462 # when latemk is running another program, and the 678 # when latexmk is running another program, and the
463 # user gives ctrl/C or ctrl/break, to stop the 679 # user gives ctrl/C or ctrl/break, to stop the
464 # daughter program, not only does it reach680 # daughter program, not only does it reach
465 # the daughter, but also latexmk/perl, so681 # the daughter, but also latexmk/perl, so
@@ -570,7 +786,7 @@
570 # example).786 # example).
571 # Cygwin executables for tex and latex may only know cygwin787 # Cygwin executables for tex and latex may only know cygwin
572 # filenames. 788 # filenames.
573 # 4. The BIBINPUTS and TEXINPUTS environment variables may be789 # 4. The BIBINPUTS environment variables may be
574 # UNIX-style or MSWin-style depending on whether native NT or790 # UNIX-style or MSWin-style depending on whether native NT or
575 # cygwin executables are used. They are therefore parsed791 # cygwin executables are used. They are therefore parsed
576 # differently. Here is the clash:792 # differently. Here is the clash:
@@ -763,12 +979,29 @@
763 }979 }
764 elsif ( $^O eq "darwin" ) {980 elsif ( $^O eq "darwin" ) {
765 # OS-X on Macintosh981 # OS-X on Macintosh
766 $lpr_pdf = 'lpr %O %S'; 982 # open starts command associated with a file.
983 # For pdf, this is set by default to OS-X's preview, which is suitable.
984 # Manual update is simply by clicking on window etc, which is OK.
985 # For ps, this is set also to preview. This works, but since it
986 # converts the file to pdf and views the pdf file, it doesn't
987 # see updates, and a refresh cannot be done. This is far from
988 # optimal.
989 # For a full installation of MacTeX, which is probably the most common
990 # on OS-X, an association is created between dvi files and TeXShop.
991 # This also converts the file to pdf, so again while it works, it
992 # does not deal with changed dvi files, as far as I can see.
993 $pdf_previewer = 'open %S';
994 $pdf_update_method = 1; # manual
995 $dvi_previewer = $dvi_previewer_landscape = 'NONE';
996 $ps_previewer = $ps_previewer_landscape = 'NONE';
997 # Others
998 $lpr_pdf = 'lpr %O %S';
767 $pscmd = "ps -ww -u $ENV{USER}"; 999 $pscmd = "ps -ww -u $ENV{USER}";
768 }1000 }
769}1001}
7701002
771## default parameters1003## default parameters
1004$auto_rc_use = 1; # Whether to read rc files automatically
772$max_repeat = 5; # Maximum times I repeat latex. Normally1005$max_repeat = 5; # Maximum times I repeat latex. Normally
773 # 3 would be sufficient: 1st run generates aux file,1006 # 3 would be sufficient: 1st run generates aux file,
774 # 2nd run picks up aux file, and maybe toc, lof which 1007 # 2nd run picks up aux file, and maybe toc, lof which
@@ -824,10 +1057,14 @@
824 # command line has same effect as with current1057 # command line has same effect as with current
825 # tex, etc. (If $jobname is non-empty, then1058 # tex, etc. (If $jobname is non-empty, then
826 # the --jobname=... option is used on tex.)1059 # the --jobname=... option is used on tex.)
1060$out_dir = ''; # Directory for output files.
1061 # Cf. --output-directory of current (pdf)latex
1062$aux_dir = ''; # Directory for aux files (log, aux, etc).
1063 # Cf. --aux-directory of current (pdf)latex in MiKTeX.
8271064
8281065
829## default flag settings.1066## default flag settings.
830$recorder = 0; # Whether to use recorder option on latex/pdflatex1067$recorder = 1; # Whether to use recorder option on latex/pdflatex
831$silent = 0; # silence latex's messages?1068$silent = 0; # silence latex's messages?
832$landscape_mode = 0; # default to portrait mode1069$landscape_mode = 0; # default to portrait mode
8331070
@@ -873,9 +1110,14 @@
873$do_cd = 0; # Do not do cd to directory of source file.1110$do_cd = 0; # Do not do cd to directory of source file.
874 # Thus behave like latex.1111 # Thus behave like latex.
875$dependents_list = 0; # Whether to display list(s) of dependencies1112$dependents_list = 0; # Whether to display list(s) of dependencies
1113$dependents_phony = 0; # Whether list(s) of dependencies includes phony targets
1114 # (as with 'gcc -MP').
876$deps_file = '-'; # File for dependency list output. Default stdout.1115$deps_file = '-'; # File for dependency list output. Default stdout.
877$rules_list = 0; # Whether to display list(s) of dependencies1116$rules_list = 0; # Whether to display list(s) of dependencies
878@dir_stack = (); # Stack of pushed directories.1117@dir_stack = (); # Stack of pushed directories, each of form of
1118 # pointer to array [ cwd, good_cwd ], where
1119 # good_cwd differs from cwd by being converted
1120 # to native MSWin path when cygwin is used.
879$cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.1121$cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.
880 # $cleanup_mode = 0: no cleanup1122 # $cleanup_mode = 0: no cleanup
881 # $cleanup_mode = 1: full cleanup 1123 # $cleanup_mode = 1: full cleanup
@@ -925,21 +1167,22 @@
925$bad_reference = 0;1167$bad_reference = 0;
926$bad_citation = 0;1168$bad_citation = 0;
9271169
1170# Cache of expensive-to-compute state variables, e.g., cwd in form
1171# fixed to deal with cygwin issues.
1172%cache = ();
1173&cache_good_cwd;
9281174
929# Set search paths for includes.1175# Set search paths for includes.
930# Set them early so that they can be overridden1176# Set them early so that they can be overridden
931$BIBINPUTS = $ENV{'BIBINPUTS'};1177$BIBINPUTS = $ENV{'BIBINPUTS'};
932if (!$BIBINPUTS) { $BIBINPUTS = '.'; }1178if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
933#?? OBSOLETE
934$TEXINPUTS = $ENV{'TEXINPUTS'};
935if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
9361179
937# Convert search paths to arrays:1180# Convert search paths to arrays:
938# If any of the paths end in '//' then recursively search the1181# If any of the paths end in '//' then recursively search the
939# directory. After these operations, @BIBINPUTS should1182# directory. After these operations, @BIBINPUTS should
940# have all the directories that need to be searched1183# have all the directories that need to be searched
9411184
942@BIBINPUTS = find_dirs1 ($BIBINPUTS);1185@BIBINPUTS = find_dirs1( $BIBINPUTS );
9431186
9441187
945######################################################################1188######################################################################
@@ -1060,7 +1303,7 @@
1060%primaries = (); # Hash of rules for primary part of make. Keys are 1303%primaries = (); # Hash of rules for primary part of make. Keys are
1061 # currently 'latex', 'pdflatex' or both. Value is1304 # currently 'latex', 'pdflatex' or both. Value is
1062 # currently irrelevant. Use hash for ease of lookup1305 # currently irrelevant. Use hash for ease of lookup
1063 # Make remove this later, if use makeB1306 # Make remove this later, if use rdb_makeB
10641307
1065# Hashes, whose keys give names of particular kinds of rule. We use1308# Hashes, whose keys give names of particular kinds of rule. We use
1066# hashes for ease of lookup.1309# hashes for ease of lookup.
@@ -1077,7 +1320,9 @@
1077 # Rule data:1320 # Rule data:
1078 # 0: [ cmd_type, ext_cmd, int_cmd, test_kind, 1321 # 0: [ cmd_type, ext_cmd, int_cmd, test_kind,
1079 # source, dest, base,1322 # source, dest, base,
1080 # out_of_date, out_of_date_user, time_of_last_run, changed1323 # out_of_date, out_of_date_user,
1324 # time_of_last_run, time_of_last_file_check,
1325 # changed
1081 # last_result, last_message,1326 # last_result, last_message,
1082 # default_extra_generated1327 # default_extra_generated
1083 # ]1328 # ]
@@ -1087,7 +1332,8 @@
1087 # with substitutions (%D for destination, %S1332 # with substitutions (%D for destination, %S
1088 # for source, %B for base of current rule,1333 # for source, %B for base of current rule,
1089 # %R for base of primary tex file, %T for1334 # %R for base of primary tex file, %T for
1090 # texfile name, and %O for options.1335 # texfile name, %O for options,
1336 # %Y for $aux_dir1, and %Z for $out_dir1
1091 # int_cmd specifies any internal command to be1337 # int_cmd specifies any internal command to be
1092 # used to implement the application of the1338 # used to implement the application of the
1093 # rule. If this is present, it overrides1339 # rule. If this is present, it overrides
@@ -1135,6 +1381,8 @@
1135 # last applied. (In standard units1381 # last applied. (In standard units
1136 # from perl, to be directly compared1382 # from perl, to be directly compared
1137 # with file modification times.)1383 # with file modification times.)
1384 # time_of_last_file_check = last time that a check
1385 # was made for changes in source files.
1138 # changed flags whether special changes have been made1386 # changed flags whether special changes have been made
1139 # that require file-existence status to be ignored1387 # that require file-existence status to be ignored
1140 # last_result is 1388 # last_result is
@@ -1143,11 +1391,15 @@
1143 # 1 if last run was successful, but1391 # 1 if last run was successful, but
1144 # failed to create an output file1392 # failed to create an output file
1145 # 2 if last run failed1393 # 2 if last run failed
1394 # 200 if last run gave a warning that is
1395 # important enough to be reported with
1396 # the error summary. The warning
1397 # message is stored in last_message.
1146 # last_message is error message for last run1398 # last_message is error message for last run
1147 # default_extra_generated is a reference to an array1399 # default_extra_generated is a reference to an array
1148 # of specifications of extra generated files (beyond1400 # of specifications of extra generated files (beyond
1149 # the main dest file. Standard place holders are used.1401 # the main dest file. Standard place holders are used.
1150 # Example ['%R.log'] for (pdf)latex, and ['%R.blg'] 1402 # Example ['%Y%R.log'] for (pdf)latex, and ['%R.blg']
1151 # for bibtex. (There's no need for '%R.aux', here,1403 # for bibtex. (There's no need for '%R.aux', here,
1152 # since such generated files are detected dynamically.)1404 # since such generated files are detected dynamically.)
1153 # 1: {Hash sourcefile -> [source-file data] }1405 # 1: {Hash sourcefile -> [source-file data] }
@@ -1185,9 +1437,6 @@
1185%fdb_current = (); # Fdb-hash for all files used.1437%fdb_current = (); # Fdb-hash for all files used.
11861438
11871439
1188#==================================================
1189## Read rc files:
1190
1191# User's home directory1440# User's home directory
1192$HOME = '';1441$HOME = '';
1193if (exists $ENV{'HOME'} ) {1442if (exists $ENV{'HOME'} ) {
@@ -1198,6 +1447,19 @@
1198}1447}
11991448
12001449
1450#==================================================
1451
1452# Options that are to be obeyed before rc files are read:
1453
1454foreach $_ ( @ARGV )
1455{
1456 if (/^-{1,2}norc$/ ) {
1457 $auto_rc_use = 0;
1458 }
1459}
1460
1461#==================================================
1462## Read rc files with this subroutine
12011463
1202sub read_first_rc_file_in_list {1464sub read_first_rc_file_in_list {
1203 foreach my $rc_file ( @_ ) {1465 foreach my $rc_file ( @_ ) {
@@ -1210,33 +1472,37 @@
1210 }1472 }
1211}1473}
12121474
1213# Read system rc file:1475# Note that each rc file may unset $auto_rc_use to
1214read_first_rc_file_in_list( @rc_system_files );1476# prevent lower-level rc files from being read.
1215# Read user rc file.1477# So test on $auto_rc_use in each case.
1216read_first_rc_file_in_list( "$HOME/.latexmkrc" );1478if ( $auto_rc_use ) {
1217# Read rc file in current directory.1479 # System rc file:
1218read_first_rc_file_in_list( "latexmkrc", ".latexmkrc" );1480 read_first_rc_file_in_list( @rc_system_files );
12191481}
1220#==================================================1482if ( $auto_rc_use ) {
12211483 # User rc file:
1222if ($bibtex_use > 1) {1484 read_first_rc_file_in_list( "$HOME/.latexmkrc" );
1223 push @generated_exts, 'bbl';1485}
1224}1486if ( $auto_rc_use ) {
12251487 # Rc file in current directory:
1226#show_array ("BIBINPUTS", @BIBINPUTS); die;1488 read_first_rc_file_in_list( "latexmkrc", ".latexmkrc" );
1489}
12271490
1228## Process command line args.1491## Process command line args.
1229@command_line_file_list = ();1492@command_line_file_list = ();
1230$bad_options = 0;1493$bad_options = 0;
12311494
1232#print "Command line arguments:\n"; for ($i = 0; $i <= $#ARGV; $i++ ) { print "$i: '$ARGV[$i]'\n"; }
1233
1234while ($_ = $ARGV[0])1495while ($_ = $ARGV[0])
1235{1496{
1236 # Make -- and - equivalent at beginning of option:1497 # Make -- and - equivalent at beginning of option,
1498 # but save original for possible use in (pdf)latex command line
1499 $original = $_;
1237 s/^--/-/;1500 s/^--/-/;
1238 shift;1501 shift;
1239 if (/^-bibtex$/) { $bibtex_use = 2; }1502 if ( /^-aux-directory=(.*)$/ || /^-auxdir=(.*)$/ ) {
1503 $aux_dir = $1;
1504 }
1505 elsif (/^-bibtex$/) { $bibtex_use = 2; }
1240 elsif (/^-bibtex-$/) { $bibtex_use = 0; }1506 elsif (/^-bibtex-$/) { $bibtex_use = 0; }
1241 elsif (/^-nobibtex$/) { $bibtex_use = 0; }1507 elsif (/^-nobibtex$/) { $bibtex_use = 0; }
1242 elsif (/^-bibtex-cond$/) { $bibtex_use = 1; }1508 elsif (/^-bibtex-cond$/) { $bibtex_use = 1; }
@@ -1247,12 +1513,13 @@
1247 elsif (/^-cd-$/) { $do_cd = 0; }1513 elsif (/^-cd-$/) { $do_cd = 0; }
1248 elsif (/^-commands$/) { &print_commands; exit; }1514 elsif (/^-commands$/) { &print_commands; exit; }
1249 elsif (/^-d$/) { $banner = 1; }1515 elsif (/^-d$/) { $banner = 1; }
1250 elsif (/^-dependents$/ || /^-deps$/ ) { $dependents_list = 1; }1516 elsif (/^-dependents$/ || /^-deps$/ || /^-M$/ ) { $dependents_list = 1; }
1251 elsif (/^-nodependents$/ || /^-dependents-$/ || /^-deps-$/) { $dependents_list = 0; }1517 elsif (/^-nodependents$/ || /^-dependents-$/ || /^-deps-$/) { $dependents_list = 0; }
1252 elsif (/^-deps-out=(.*)$/) {1518 elsif (/^-deps-out=(.*)$/) {
1253 $deps_file = $1;1519 $deps_file = $1;
1254 $dependents_list = 1; 1520 $dependents_list = 1;
1255 }1521 }
1522 elsif (/^-diagnostics/) { $diagnostics = 1; }
1256 elsif (/^-dvi$/) { $dvi_mode = 1; }1523 elsif (/^-dvi$/) { $dvi_mode = 1; }
1257 elsif (/^-dvi-$/) { $dvi_mode = 0; }1524 elsif (/^-dvi-$/) { $dvi_mode = 0; }
1258 elsif (/^-f$/) { $force_mode = 1; }1525 elsif (/^-f$/) { $force_mode = 1; }
@@ -1263,7 +1530,6 @@
1263 $go_mode = 2; $cleanup_mode = 1; $cleanup_fdb = 1; $cleanup_only = 0; 1530 $go_mode = 2; $cleanup_mode = 1; $cleanup_fdb = 1; $cleanup_only = 0;
1264 }1531 }
1265 elsif ( /^-h$/ || /^-help$/ ) { &print_help; exit;}1532 elsif ( /^-h$/ || /^-help$/ ) { &print_help; exit;}
1266 elsif (/^-diagnostics/) { $diagnostics = 1; }
1267 elsif (/^-jobname=(.*)$/) {1533 elsif (/^-jobname=(.*)$/) {
1268 $jobname = $1;1534 $jobname = $1;
1269 }1535 }
@@ -1272,24 +1538,44 @@
1272 elsif (/^-latex=(.*)$/) {1538 elsif (/^-latex=(.*)$/) {
1273 $latex = $1;1539 $latex = $1;
1274 }1540 }
1275 elsif (/^-pdflatex=(.*)$/) {1541 elsif (/^-latexoption=(.*)$/) {
1276 $pdflatex = $1;1542 push @extra_latex_options, $1;
1277 }1543 push @extra_pdflatex_options, $1;
1544 }
1545# See above for -M
1546 elsif (/^-MF$/) {
1547 if ( $ARGV[0] eq '' ) {
1548 &exit_help( "No file name specified after -MF switch");
1549 }
1550 $deps_file = $ARGV[0];
1551 shift;
1552 }
1553 elsif ( /^-MP$/ ) { $dependents_phony = 1; }
1278 elsif (/^-new-viewer$/) {1554 elsif (/^-new-viewer$/) {
1279 $new_viewer_always = 1; 1555 $new_viewer_always = 1;
1280 }1556 }
1281 elsif (/^-new-viewer-$/) {1557 elsif (/^-new-viewer-$/) {
1282 $new_viewer_always = 0; 1558 $new_viewer_always = 0;
1559 }
1560 elsif (/^-norc$/ ) {
1561 $auto_rc_use = 0;
1562 # N.B. This has already been obeyed.
1563 }
1564 elsif ( /^-output-directory=(.*)$/ ||/^-outdir=(.*)$/ ) {
1565 $out_dir = $1;
1283 }1566 }
1284 elsif (/^-p$/) { $printout_mode = 1; 1567 elsif (/^-p$/) { $printout_mode = 1;
1285 $preview_continuous_mode = 0; # to avoid conflicts1568 $preview_continuous_mode = 0; # to avoid conflicts
1286 $preview_mode = 0; 1569 $preview_mode = 0;
1287 }1570 }
1288 elsif (/^-p-$/) { $printout_mode = 0; }1571 elsif (/^-p-$/) { $printout_mode = 0; }
1572 elsif (/^-pdf$/) { $pdf_mode = 1; }
1573 elsif (/^-pdf-$/) { $pdf_mode = 0; }
1289 elsif (/^-pdfdvi$/){ $pdf_mode = 3; }1574 elsif (/^-pdfdvi$/){ $pdf_mode = 3; }
1575 elsif (/^-pdflatex=(.*)$/) {
1576 $pdflatex = $1;
1577 }
1290 elsif (/^-pdfps$/) { $pdf_mode = 2; }1578 elsif (/^-pdfps$/) { $pdf_mode = 2; }
1291 elsif (/^-pdf$/) { $pdf_mode = 1; }
1292 elsif (/^-pdf-$/) { $pdf_mode = 0; }
1293 elsif (/^-print=(.*)$/) {1579 elsif (/^-print=(.*)$/) {
1294 $value = $1;1580 $value = $1;
1295 if ( $value =~ /^dvi$|^ps$|^pdf$/ ) {1581 if ( $value =~ /^dvi$|^ps$|^pdf$/ ) {
@@ -1317,21 +1603,44 @@
1317 elsif (/^-recorder-$/ ){ $recorder = 0; }1603 elsif (/^-recorder-$/ ){ $recorder = 0; }
1318 elsif (/^-rules$/ ) { $rules_list = 1; }1604 elsif (/^-rules$/ ) { $rules_list = 1; }
1319 elsif (/^-norules$/ || /^-rules-$/ ) { $rules_list = 0; }1605 elsif (/^-norules$/ || /^-rules-$/ ) { $rules_list = 0; }
1606 elsif (/^-showextraoptions$/) {
1607 print "List of extra latex and pdflatex options recognized by $my_name.\n",
1608 "These are passed as is to (pdf)latex. They may not be recognized by\n",
1609 "particular versions of (pdf)latex. This list is a combination of those\n",
1610 "for TeXLive and MikTeX.\n",
1611 "\n",
1612 "Note that in addition to the options in this list, there are several\n",
1613 "options known to the (pdf)latex programs that are also recognized by\n",
1614 "latexmk and trigger special behavior by latexmk. Since these options\n",
1615 "appear in the main list given by running 'latexmk --help', they do not\n",
1616 "appear in the following list\n",
1617 "\n";
1618 foreach $option ( sort( keys %allowed_latex_options, keys %allowed_latex_options_with_arg ) ) {
1619 if (exists $allowed_latex_options{$option} ) { print " $allowed_latex_options{$option}\n"; }
1620 if (exists $allowed_latex_options_with_arg{$option} ) { print " $allowed_latex_options_with_arg{$option}\n"; }
1621 }
1622 exit;
1623 }
1320 elsif (/^-silent$/ || /^-quiet$/ ){ $silent = 1; }1624 elsif (/^-silent$/ || /^-quiet$/ ){ $silent = 1; }
1321 elsif (/^-time$/) { $show_time = 1;}1625 elsif (/^-time$/) { $show_time = 1;}
1322 elsif (/^-time-$/) { $show_time = 0;}1626 elsif (/^-time-$/) { $show_time = 0;}
1323 elsif (/^-v$/ || /^-version$/) {
1324 print "\n$version_details. Version $version_num\n";
1325 exit;
1326 }
1327 elsif (/^-use-make$/) { $use_make_for_missing_files = 1; }1627 elsif (/^-use-make$/) { $use_make_for_missing_files = 1; }
1328 elsif (/^-use-make-$/) { $use_make_for_missing_files = 0; }1628 elsif (/^-use-make-$/) { $use_make_for_missing_files = 0; }
1629 elsif (/^-v$/ || /^-version$/) {
1630 print "\n$version_details. Version $version_num\n";
1631 exit;
1632 }
1329 elsif (/^-verbose$/) { $silent = 0; }1633 elsif (/^-verbose$/) { $silent = 0; }
1330 elsif (/^-view=default$/) { $view = "default";}1634 elsif (/^-view=default$/) { $view = "default";}
1331 elsif (/^-view=dvi$/) { $view = "dvi";}1635 elsif (/^-view=dvi$/) { $view = "dvi";}
1332 elsif (/^-view=none$/) { $view = "none";}1636 elsif (/^-view=none$/) { $view = "none";}
1333 elsif (/^-view=ps$/) { $view = "ps";}1637 elsif (/^-view=ps$/) { $view = "ps";}
1334 elsif (/^-view=pdf$/) { $view = "pdf"; }1638 elsif (/^-view=pdf$/) { $view = "pdf"; }
1639 elsif (/^-xelatex$/) {
1640 $pdflatex = "xelatex %O %S";
1641 $pdf_mode = 1;
1642 $dvi_mode = $postscript_mode = 0;
1643 }
1335 elsif (/^-e$/) { 1644 elsif (/^-e$/) {
1336 if ( $#ARGV < 0 ) {1645 if ( $#ARGV < 0 ) {
1337 &exit_help( "No code to execute specified after -e switch"); 1646 &exit_help( "No code to execute specified after -e switch");
@@ -1386,6 +1695,13 @@
1386 $ps_filter = $ARGV[0];1695 $ps_filter = $ARGV[0];
1387 shift; 1696 shift;
1388 }1697 }
1698 elsif ( ( exists( $allowed_latex_options{$_} ) )
1699 || ( /^(-.+)=/ && exists( $allowed_latex_options_with_arg{$1} ) )
1700 )
1701 {
1702 push @extra_latex_options, $original;
1703 push @extra_pdflatex_options, $original;
1704 }
1389 elsif (/^-/) {1705 elsif (/^-/) {
1390 warn "$My_name: $_ bad option\n"; 1706 warn "$My_name: $_ bad option\n";
1391 $bad_options++;1707 $bad_options++;
@@ -1403,6 +1719,28 @@
1403 "**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****\n"1719 "**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****\n"
1404 unless $silent;1720 unless $silent;
14051721
1722if ( ($out_dir ne '') && ($aux_dir eq '') ){
1723 $aux_dir = $out_dir;
1724}
1725
1726foreach ($out_dir, $aux_dir) {
1727 # Remove aliases to cwd:
1728 $_ = normalize_filename( $_ );
1729 if ($_ eq '.' ) { $_ = ''; }
1730}
1731# Versions terminating in directory/path separator
1732$out_dir1 = $out_dir;
1733$aux_dir1 = $aux_dir;
1734foreach ( $aux_dir1, $out_dir1 ) {
1735 if ( ($_ ne '') && ! m([\\/\:]$) ) {
1736 $_ .= '/';
1737 }
1738}
1739
1740if ($bibtex_use > 1) {
1741 push @generated_exts, 'bbl';
1742}
1743
1406# For backward compatibility, convert $texfile_search to @default_files1744# For backward compatibility, convert $texfile_search to @default_files
1407# Since $texfile_search is initialized to "", a nonzero value indicates1745# Since $texfile_search is initialized to "", a nonzero value indicates
1408# that an initialization file has set it.1746# that an initialization file has set it.
@@ -1410,9 +1748,6 @@
1410 @default_files = split / /, "*.tex $texfile_search";1748 @default_files = split / /, "*.tex $texfile_search";
1411}1749}
14121750
1413#printA "A: Command line file list:\n";
1414#for ($i = 0; $i <= $#command_line_file_list; $i++ ) { print "$i: '$command_line_file_list[$i]'\n"; }
1415
1416#Glob the filenames command line if the script was not invoked under a 1751#Glob the filenames command line if the script was not invoked under a
1417# UNIX-like environment.1752# UNIX-like environment.
1418# Cases: (1) MS/MSwin native Glob1753# Cases: (1) MS/MSwin native Glob
@@ -1431,8 +1766,6 @@
1431}1766}
1432else {1767else {
1433 @file_list = @command_line_file_list;1768 @file_list = @command_line_file_list;
1434#print "A2:File list:\n";
1435#for ($i = 0; $i <= $#file_list; $i++ ) { print "$i: '$file_list[$i]'\n"; }
1436}1769}
1437@file_list = uniq1( @file_list );1770@file_list = uniq1( @file_list );
14381771
@@ -1526,8 +1859,11 @@
1526&fix_cmds;1859&fix_cmds;
15271860
1528# Add common options1861# Add common options
1529add_option( \$latex, $latex_default_switches );1862add_option( $latex_default_switches, \$latex );
1530add_option( \$pdflatex, $pdflatex_default_switches );1863add_option( $pdflatex_default_switches, \$pdflatex );
1864
1865foreach (@extra_latex_options) { add_option( $_, \$latex ); }
1866foreach (@extra_pdflatex_options) { add_option( $_, \$pdflatex ); }
15311867
15321868
1533# If landscape mode, change dvips processor, and the previewers:1869# If landscape mode, change dvips processor, and the previewers:
@@ -1539,23 +1875,53 @@
1539}1875}
15401876
1541if ( $silent ) { 1877if ( $silent ) {
1542 add_option( \$latex, " $latex_silent_switch" ); 1878 add_option( "$latex_silent_switch", \$latex );
1543 add_option( \$pdflatex, " $pdflatex_silent_switch" ); 1879 add_option( "$pdflatex_silent_switch", \$pdflatex );
1544 add_option( \$biber, " $biber_silent_switch" ); 1880 add_option( "$biber_silent_switch", \$biber );
1545 add_option( \$bibtex, " $bibtex_silent_switch" ); 1881 add_option( "$bibtex_silent_switch", \$bibtex );
1546 add_option( \$makeindex, " $makeindex_silent_switch" ); 1882 add_option( "$makeindex_silent_switch", \$makeindex );
1547 add_option( \$dvips, " $dvips_silent_switch" ); 1883 add_option( "$dvipdf_silent_switch", \$dvipdf );
1884 add_option( "$dvips_silent_switch", \$dvips );
1548}1885}
15491886
1550if ( $recorder ) {1887if ( $recorder ) {
1551 add_option( \$latex, "-recorder" );1888 add_option( "-recorder", \$latex, \$pdflatex );
1552 add_option( \$pdflatex, "-recorder" );1889}
1890
1891if ( $out_dir ) {
1892 add_option( "-output-directory=\"$out_dir\"", \$latex, \$pdflatex );
1893 if ( ! -e $out_dir ) {
1894 warn "$My_name: making output directory '$out_dir'\n"
1895 if ! $silent;
1896 mkdir $out_dir;
1897 }
1898 elsif ( ! -d $out_dir ) {
1899 warn "$My_name: you requested output directory '$out_dir',\n",
1900 " but an ordinary file of the same name exists, which will\n",
1901 " probably give an error later\n";
1902 }
1903}
1904
1905if ( $aux_dir && ($aux_dir ne $out_dir) ) {
1906 # N.B. If $aux_dir and $out_dir are the same, then the -output-directory
1907 # option is sufficient, especially because the -aux-directory exists
1908 # only in MiKTeX, not in TeXLive.
1909 add_option( "-aux-directory=\"$aux_dir\"", \$latex, \$pdflatex );
1910 if ( ! -e $aux_dir ) {
1911 warn "$My_name: making auxiliary directory '$aux_dir'\n"
1912 if ! $silent;
1913 mkdir $aux_dir;
1914 }
1915 elsif ( ! -d $aux_dir ) {
1916 warn "$My_name: you requested aux directory '$aux_dir',\n",
1917 " but an ordinary file of the same name exists, which will\n",
1918 " probably give an error later\n";
1919 }
1553}1920}
15541921
1555if ( $jobname ne '' ) { 1922if ( $jobname ne '' ) {
1556 $jobstring = "--jobname=$jobname";1923 $jobstring = "--jobname=$jobname";
1557 add_option( \$latex, " $jobstring" ); 1924 add_option( "$jobstring", \$latex, \$pdflatex );
1558 add_option( \$pdflatex, " $jobstring" );
1559}1925}
15601926
1561# Which kind of file do we preview?1927# Which kind of file do we preview?
@@ -1606,7 +1972,7 @@
16061972
1607if ( $pdf_mode == 2 ) {1973if ( $pdf_mode == 2 ) {
1608 # We generate pdf from ps. Make sure we have the correct kind of ps.1974 # We generate pdf from ps. Make sure we have the correct kind of ps.
1609 add_option( \$dvips, " $dvips_pdf_switch" );1975 add_option( "$dvips_pdf_switch", \$dvips );
1610}1976}
16111977
1612# Note sleep has granularity of 1 second.1978# Note sleep has granularity of 1 second.
@@ -1636,6 +2002,22 @@
1636 $generated_exts_all{$_} = 1;2002 $generated_exts_all{$_} = 1;
1637}2003}
16382004
2005if ($aux_dir) {
2006 # Ensure $aux_dir is in TEXINPUTS search path.
2007 # This is used by dvips for files generated by mpost.
2008 if ( ! exists $ENV{TEXINPUTS} ) {
2009 # Note the trailing ":" which ensures that the last item
2010 # in the list of paths is the empty path, which actually
2011 # means the default path, i.e., the following means that
2012 # the TEXINPUTS search path is $aux_dir and the standard
2013 # value.
2014 $ENV{TEXINPUTS} = $aux_dir.$search_path_separator;
2015 }
2016 elsif ( $ENV{TEXINPUTS} !~ /$aux_dir$search_path_separator/ ) {
2017 $ENV{TEXINPUTS} = $aux_dir.$search_path_separator.$ENV{TEXINPUTS};
2018 }
2019}
2020
1639$quell_uptodate_msgs = $silent; 2021$quell_uptodate_msgs = $silent;
1640 # Whether to quell informational messages when files are uptodate2022 # Whether to quell informational messages when files are uptodate
1641 # Will turn off in -pvc mode2023 # Will turn off in -pvc mode
@@ -1690,26 +2072,30 @@
1690 $root_filename = $jobname;2072 $root_filename = $jobname;
1691 }2073 }
16922074
2075 $aux_main = "$aux_dir1$root_filename.aux";
2076 $log_name = "$aux_dir1$root_filename.log";
2077 $fdb_name = "$aux_dir1$root_filename.$fdb_ext";
2078
1693 # Initialize basic dependency information:2079 # Initialize basic dependency information:
16942080
1695 # For use under error conditions:2081 # For use under error conditions:
1696 @default_includes = ($texfile_name, "$root_filename.aux"); 2082 @default_includes = ($texfile_name, $aux_main);
16972083
1698 $fdb_file = "$root_filename.$fdb_ext";2084 # Initialize rule database.
1699 2085 # ?? Should I also initialize file database?
1700 # Initialize file and rule databases.
1701 %rule_list = ();2086 %rule_list = ();
1702 &rdb_make_rule_list;2087 &rdb_make_rule_list;
1703 &rdb_set_rules(\%rule_list);2088 &rdb_set_rules(\%rule_list);
17042089
1705 if ( $cleanup_mode > 0 ) {2090 if ( $cleanup_mode > 0 ) {
2091# ?? MAY NEED TO FIX THE FOLLOWING IF $aux_dir or $out_dir IS SET.
1706 my %other_generated = ();2092 my %other_generated = ();
1707 my @index_bibtex_generated = ();2093 my @index_bibtex_generated = ();
1708 my @aux_files = ();2094 my @aux_files = ();
1709 $have_fdb = 0;2095 $have_fdb = 0;
1710 if ( -e $fdb_file ) {2096 if ( -e $fdb_name ) {
1711 print "$My_name: Examining fdb file '$fdb_file' for rules ...\n";2097 print "$My_name: Examining fdb file '$fdb_name' for rules ...\n";
1712 $have_fdb = ( 0 == rdb_read( $fdb_file ) );2098 $have_fdb = ( 0 == rdb_read( $fdb_name ) );
1713 }2099 }
1714 if ( $have_fdb ) {2100 if ( $have_fdb ) {
1715 rdb_for_all(2101 rdb_for_all(
@@ -1733,10 +2119,10 @@
1733 );2119 );
1734 }2120 }
1735 else {2121 else {
1736 # No fdb file, so do inferior job by parse_logB2122 # No fdb file, so do inferior job by parse_log
1737 print "$My_name: Examining log file '$root_filename.log' for generated files...\n";2123 print "$My_name: Examining log file '$log_name' for generated files...\n";
17382124
1739 # Variables set by parse_logB. Can I remove them2125 # Variables set by parse_log. Can I remove them
1740 local %generated_log = ();2126 local %generated_log = ();
1741 local %dependents = (); # Maps files to status. Not used here.2127 local %dependents = (); # Maps files to status. Not used here.
1742 local @bbl_files = (); # Not used here.2128 local @bbl_files = (); # Not used here.
@@ -1745,7 +2131,7 @@
1745 # Maps output file created and read by (pdf)latex2131 # Maps output file created and read by (pdf)latex
1746 # to source file of conversion.2132 # to source file of conversion.
1747 local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.2133 local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
1748 &parse_logB;2134 &parse_log;
1749 %other_generated = %generated_log;2135 %other_generated = %generated_log;
1750 }2136 }
17512137
@@ -1776,31 +2162,36 @@
1776 ." (only deleted if \$cleanup_includes_generated is set): ",2162 ." (only deleted if \$cleanup_includes_generated is set): ",
1777 keys %other_generated );2163 keys %other_generated );
1778 }2164 }
1779 # files used in previous versions of latexmk2165 &cleanup1( $aux_dir1, $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
1780 &cleanup1( $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
1781 split(' ',$clean_ext), 2166 split(' ',$clean_ext),
1782 keys %generated_exts_all 2167 keys %generated_exts_all
1783 );2168 );
1784 unlink( 'texput.log', "texput.aux", 2169 unlink_or_move( 'texput.log', "texput.aux",
1785 keys %index_bibtex_generated, 2170 keys %index_bibtex_generated,
1786 keys %aux_files );2171 keys %aux_files );
1787 if ($cleanup_includes_generated) {2172 if ($cleanup_includes_generated) {
1788 unlink( keys %other_generated );2173 unlink_or_move( keys %other_generated );
1789 }2174 }
1790 if ( $cleanup_includes_cusdep_generated) {2175 if ( $cleanup_includes_cusdep_generated) {
1791 &cleanup_cusdep_generated;2176 &cleanup_cusdep_generated;
1792 }2177 }
1793 if ( $cleanup_mode == 1 ) { 2178 if ( $cleanup_mode == 1 ) {
1794 &cleanup1( 'dvi', 'dviF', 'ps', 'psF', 'pdf',2179 &cleanup1( $out_dir1, 'dvi', 'dviF', 'ps', 'psF', 'pdf',
1795 split(' ', $clean_full_ext)2180 split(' ', $clean_full_ext)
1796 );2181 );
1797 }2182 }
1798 }2183 }
1799 if ($cleanup_fdb) { unlink $fdb_file; }2184 if ($cleanup_fdb) {
2185 unlink_or_move( $fdb_name );
2186 # If the fdb file exists, it will have been read, and therefore changed
2187 # rule database. But deleting the fdb file implies we also want
2188 # a virgin rule database, so we must reset it:
2189 rdb_set_rules( \%rule_list );
2190 }
1800 if ($cleanup_only) { next FILE; }2191 if ($cleanup_only) { next FILE; }
18012192
18022193
1803#??? The following are not needed if use makeB. 2194#??? The following are not needed if use rdb_make.
1804# ?? They may be set too early?2195# ?? They may be set too early?
1805# Arrays and hashes for picking out accessible rules.2196# Arrays and hashes for picking out accessible rules.
1806# Distinguish rules for making files and others2197# Distinguish rules for making files and others
@@ -1826,7 +2217,7 @@
1826 }2217 }
18272218
1828 $have_fdb = 0;2219 $have_fdb = 0;
1829 if ( (! -e $fdb_file) && (! -e "$root_filename.aux") ) {2220 if ( (! -e $fdb_name) && (! -e $aux_main ) ) {
1830 # No aux and no fdb file => set up trivial aux file 2221 # No aux and no fdb file => set up trivial aux file
1831 # and corresponding fdb_file. Arrange them to provoke one run 2222 # and corresponding fdb_file. Arrange them to provoke one run
1832 # as minimum, but no more if actual aux file is trivial.2223 # as minimum, but no more if actual aux file is trivial.
@@ -1834,8 +2225,8 @@
1834 &set_trivial_aux_fdb;2225 &set_trivial_aux_fdb;
1835 }2226 }
18362227
1837 if ( -e $fdb_file ) {2228 if ( -e $fdb_name ) {
1838 $rdb_errors = rdb_read( $fdb_file );2229 $rdb_errors = rdb_read( $fdb_name );
1839 $have_fdb = ($rdb_errors == 0);2230 $have_fdb = ($rdb_errors == 0);
1840 }2231 }
1841 if (!$have_fdb) { 2232 if (!$have_fdb) {
@@ -1843,10 +2234,10 @@
1843 # previous run. So use filetime criterion for make2234 # previous run. So use filetime criterion for make
1844 # instead of change from previous run, until we have2235 # instead of change from previous run, until we have
1845 # done our own make.2236 # done our own make.
1846 rdb_recurseA( [keys %possible_primaries],2237 rdb_recurse( [keys %possible_primaries],
1847 sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }2238 sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
1848 );2239 );
1849 if ( -e "$root_filename.log" ) {2240 if ( -e $log_name ) {
1850 rdb_for_some( [keys %possible_primaries], \&rdb_set_latex_deps );2241 rdb_for_some( [keys %possible_primaries], \&rdb_set_latex_deps );
1851 }2242 }
1852 }2243 }
@@ -1861,7 +2252,7 @@
18612252
1862 if ($go_mode) {2253 if ($go_mode) {
1863 # Force everything to be remade.2254 # Force everything to be remade.
1864 rdb_recurseA( [keys %requested_filerules], sub{$$Pout_of_date=1;} );2255 rdb_recurse( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
1865 }2256 }
18662257
18672258
@@ -1873,7 +2264,7 @@
1873 #************************************************************2264 #************************************************************
18742265
1875 if ( $preview_continuous_mode ) { 2266 if ( $preview_continuous_mode ) {
1876 &make_preview_continuousB; 2267 &make_preview_continuous;
1877 # Will probably exit by ctrl/C and never arrive here.2268 # Will probably exit by ctrl/C and never arrive here.
1878 next FILE;2269 next FILE;
1879 }2270 }
@@ -1894,7 +2285,7 @@
1894 #Initialize failure flags now.2285 #Initialize failure flags now.
1895 $failure = 0;2286 $failure = 0;
1896 $failure_msg = '';2287 $failure_msg = '';
1897 $failure = rdb_makeB( keys %requested_filerules );2288 $failure = rdb_make( keys %requested_filerules );
1898 if ($failure > 0) { next FILE; }2289 if ($failure > 0) { next FILE; }
1899 rdb_for_some( [keys %one_time], \&rdb_run1 );2290 rdb_for_some( [keys %one_time], \&rdb_run1 );
1900} # end FILE2291} # end FILE
@@ -1907,7 +2298,8 @@
1907 if ( $failure_msg ) {2298 if ( $failure_msg ) {
1908 #Remove trailing space2299 #Remove trailing space
1909 $failure_msg =~ s/\s*$//;2300 $failure_msg =~ s/\s*$//;
1910 warn "$My_name: Did not finish processing file:\n $failure_msg\n";2301 warn "$My_name: Did not finish processing file '$filename':\n",
2302 " $failure_msg\n";
1911 $failure = 1;2303 $failure = 1;
1912 }2304 }
1913 }2305 }
@@ -1945,7 +2337,8 @@
1945 @failed_primaries);2337 @failed_primaries);
1946 }2338 }
1947 if ( !$force_mode ) {2339 if ( !$force_mode ) {
1948 warn "$My_name: Use the -f option to force complete processing.\n";2340 warn "$My_name: Use the -f option to force complete processing,\n",
2341 " unless error was exceeding maximum runs of latex/pdflatex.\n";
1949 }2342 }
1950 exit 12;2343 exit 12;
1951}2344}
@@ -1965,6 +2358,14 @@
1965 # Source only2358 # Source only
1966 if ( $_ && ! /%/ ) { $_ .= " %O %S"; }2359 if ( $_ && ! /%/ ) { $_ .= " %O %S"; }
1967 }2360 }
2361 foreach ($pdf_previewer, $ps_previewer, $ps_previewer_landscape,
2362 $dvi_previewer, $dvi_previewer_landscape,
2363 ) {
2364 # Run previewers detached
2365 if ( $_ && ! /^(nostart|NONE|internal) / ) {
2366 $_ = "start $_";
2367 }
2368 }
1968 foreach ($biber, $bibtex) {2369 foreach ($biber, $bibtex) {
1969 # Base only2370 # Base only
1970 if ( $_ && ! /%/ ) { $_ .= " %O %B"; }2371 if ( $_ && ! /%/ ) { $_ .= " %O %B"; }
@@ -1986,10 +2387,14 @@
1986#############################################################2387#############################################################
19872388
1988sub add_option {2389sub add_option {
1989 # Call add_option( \$cmd, $opt )2390 # Call add_option( $opt, \$cmd ... )
1990 # Add option to command2391 # Add option to one or more commands
1991 if ( ${$_[0]} !~ /%/ ) { &fix_cmds; }2392 my $option = shift;
1992 ${$_[0]} =~ s/%O/$_[1] %O/;2393 while (@_) {
2394 if ( ${$_[0]} !~ /%/ ) { &fix_cmds; }
2395 ${$_[0]} =~ s/%O/$option %O/;
2396 shift;
2397 }
1993} #END add_option2398} #END add_option
19942399
1995#############################################################2400#############################################################
@@ -1997,17 +2402,18 @@
1997sub rdb_make_rule_list {2402sub rdb_make_rule_list {
1998# Substitutions: %S = source, %D = dest, %B = this rule's base2403# Substitutions: %S = source, %D = dest, %B = this rule's base
1999# %T = texfile, %R = root = base for latex.2404# %T = texfile, %R = root = base for latex.
2405# %Y for $aux_dir1, %Z for $out_dir1
20002406
2001 # Defaults for dvi, ps, and pdf files2407 # Defaults for dvi, ps, and pdf files
2002 # Use local, not my, so these variables can be referenced2408 # Use local, not my, so these variables can be referenced
2003 local $dvi_final = "%R.dvi";2409 local $dvi_final = "%Z%R.dvi";
2004 local $ps_final = "%R.ps";2410 local $ps_final = "%Z%R.ps";
2005 local $pdf_final = "%R.pdf";2411 local $pdf_final = "%Z%R.pdf";
2006 if ( length($dvi_filter) > 0) {2412 if ( length($dvi_filter) > 0) {
2007 $dvi_final = "%R.dviF";2413 $dvi_final = "%Z%R.dviF";
2008 }2414 }
2009 if ( length($ps_filter) > 0) {2415 if ( length($ps_filter) > 0) {
2010 $ps_final = "%R.psF";2416 $ps_final = "%Z%R.psF";
2011 }2417 }
20122418
2013 my $print_file = '';2419 my $print_file = '';
@@ -2047,14 +2453,14 @@
2047# This is because, especially for dvi file, the contents of the file may contain2453# This is because, especially for dvi file, the contents of the file may contain
2048# a pointer to a file to be included, not the contents of the file! 2454# a pointer to a file to be included, not the contents of the file!
2049 %rule_list = (2455 %rule_list = (
2050 'latex' => [ 'primary', "$latex", '', "%T", "%B.dvi", "%R", 1, ["%R.log"] ],2456 'latex' => [ 'primary', "$latex", '', "%T", "%Z%B.dvi", "%R", 1, ["%Y%R.log"] ],
2051 'pdflatex' => [ 'primary', "$pdflatex", '', "%T", "%B.pdf", "%R", 1, ["%R.log"] ],2457 'pdflatex' => [ 'primary', "$pdflatex", '', "%T", "%Z%B.pdf", "%R", 1, ["%Y%R.log"] ],
2052 'dvipdf' => [ 'external', "$dvipdf", 'do_viewfile', $dvi_final, "%B.pdf", "%R", 2 ],2458 'dvipdf' => [ 'external', "$dvipdf", 'do_viewfile', $dvi_final, "%B.pdf", "%Z%R", 2 ],
2053 'dvips' => [ 'external', "$dvips", 'do_viewfile', $dvi_final, "%B.ps", "%R", 2 ],2459 'dvips' => [ 'external', "$dvips", 'do_viewfile', $dvi_final, "%B.ps", "%Z%R", 2 ],
2054 'dvifilter'=> [ 'external', $dvi_filter, 'do_viewfile', "%B.dvi", "%B.dviF", "%R", 2 ],2460 'dvifilter'=> [ 'external', $dvi_filter, 'do_viewfile', "%B.dvi", "%B.dviF", "%Z%R", 2 ],
2055 'ps2pdf' => [ 'external', "$ps2pdf", 'do_viewfile', $ps_final, "%B.pdf", "%R", 2 ],2461 'ps2pdf' => [ 'external', "$ps2pdf", 'do_viewfile', $ps_final, "%B.pdf", "%Z%R", 2 ],
2056 'psfilter' => [ 'external', $ps_filter, 'do_viewfile', "%B.ps", "%B.psF", "%R", 2 ],2462 'psfilter' => [ 'external', $ps_filter, 'do_viewfile', "%B.ps", "%B.psF", "%Z%R", 2 ],
2057 'print' => [ 'external', "$print_cmd", 'if_source', $print_file, "", "", 2 ],2463 'print' => [ 'external', "$print_cmd", 'if_source', $print_file, "", "", 2 ],
2058 'update_view' => [ 'external', $viewer_update_command, $PA_update,2464 'update_view' => [ 'external', $viewer_update_command, $PA_update,
2059 $view_file, "", "", 2 ],2465 $view_file, "", "", 2 ],
2060 'view' => [ 'external', "$viewer", 'if_source', $view_file, "", "", 2 ],2466 'view' => [ 'external', "$viewer", 'if_source', $view_file, "", "", 2 ],
@@ -2095,6 +2501,8 @@
2095 # until run time, in case of changes.2501 # until run time, in case of changes.
2096 foreach ($base, $source, $dest, @$PA_extra_gen ) {2502 foreach ($base, $source, $dest, @$PA_extra_gen ) {
2097 s/%R/$root_filename/;2503 s/%R/$root_filename/;
2504 s/%Y/$aux_dir1/;
2505 s/%Z/$out_dir1/;
2098 }2506 }
2099 foreach ($source, $dest ) { 2507 foreach ($source, $dest ) {
2100 s/%B/$base/;2508 s/%B/$base/;
@@ -2104,7 +2512,7 @@
2104 # " S='$source', D='$dest', B='$base' $needs_making\n";2512 # " S='$source', D='$dest', B='$base' $needs_making\n";
2105 rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind, 2513 rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind,
2106 $source, $dest, $base,2514 $source, $dest, $base,
2107 $needs_making, undef, 1, $PA_extra_gen );2515 $needs_making, undef, undef, 1, $PA_extra_gen );
2108# !! ?? Last line was2516# !! ?? Last line was
2109# $needs_making, undef, ($test_kind==1) );2517# $needs_making, undef, ($test_kind==1) );
2110 }2518 }
@@ -2156,20 +2564,20 @@
2156 # 2. Write a corresponding fdb file2564 # 2. Write a corresponding fdb file
2157 # 3. Provoke a run of (pdf)latex (actually of all primaries). 2565 # 3. Provoke a run of (pdf)latex (actually of all primaries).
21582566
2159 local $aux_file = "$root_filename.aux";2567 local *aux_file;
2160 open( aux_file, '>', $aux_file )2568 open( aux_file, '>', $aux_main )
2161 or die "Cannot write file '$aux_file'\n";2569 or die "Cannot write file '$aux_main'\n";
2162 print aux_file "\\relax \n";2570 print aux_file "\\relax \n";
2163 close(aux_file);2571 close(aux_file);
21642572
2165 foreach my $rule (keys %primaries ) { 2573 foreach my $rule (keys %primaries ) {
2166 rdb_ensure_file( $rule, $texfile_name );2574 rdb_ensure_file( $rule, $texfile_name );
2167 rdb_ensure_file( $rule, $aux_file );2575 rdb_ensure_file( $rule, $aux_main );
2168 rdb_one_rule( $rule, 2576 rdb_one_rule( $rule,
2169 sub{ $$Pout_of_date = 1; }2577 sub{ $$Pout_of_date = 1; }
2170 );2578 );
2171 }2579 }
2172 &rdb_write( $fdb_file );2580 &rdb_write( $fdb_name );
2173} #END set_trivial_aux_fdb2581} #END set_trivial_aux_fdb
21742582
2175#************************************************************2583#************************************************************
@@ -2238,12 +2646,21 @@
2238 my $return = 0;2646 my $return = 0;
2239 my ($base, $path, $ext) = fileparseA( $$Pdest );2647 my ($base, $path, $ext) = fileparseA( $$Pdest );
2240 if ( &view_file_via_temporary ) {2648 if ( &view_file_via_temporary ) {
2241 my $tmpfile = tempfile1( "${root_filename}_tmp", $ext );2649 if ( $$Pext_cmd =~ /%D/ ) {
2242 $return = &rdb_ext_cmd1( '', '', $tmpfile );2650 my $tmpfile = tempfile1( "${root_filename}_tmp", $ext );
2243 move( $tmpfile, $$Pdest );2651 warn "$My_name: Making '$$Pdest' via temporary '$tmpfile'...\n";
2652 $return = &Run_subst( undef, undef, undef, undef, $tmpfile );
2653 move( $tmpfile, $$Pdest );
2654 }
2655 else {
2656 warn "$My_name is configured to make '$$Pdest' via a temporary file\n",
2657 " but the command template '$$Pext_cmd' does not have a slot\n",
2658 " to set the destination file, so I won't use a temporary file\n";
2659 $return = &Run_subst();
2660 }
2244 }2661 }
2245 else {2662 else {
2246 $return = &rdb_ext_cmd;2663 $return = &Run_subst();
2247 }2664 }
2248 return $return;2665 return $return;
2249} #END do_viewfile2666} #END do_viewfile
@@ -2290,7 +2707,7 @@
2290 }2707 }
2291 elsif ($viewer_update_method == 4) {2708 elsif ($viewer_update_method == 4) {
2292 if (defined $$Pext_cmd) {2709 if (defined $$Pext_cmd) {
2293 $return = &rdb_ext_cmd;2710 $return = &Run_subst();
2294 }2711 }
2295 else {2712 else {
2296 warn "$My_name: viewer is supposed to be updated by running a command,\n",2713 warn "$My_name: viewer is supposed to be updated by running a command,\n",
@@ -2306,7 +2723,7 @@
2306 # Unconditionally apply rule if source file exists.2723 # Unconditionally apply rule if source file exists.
2307 # Assumes rule context2724 # Assumes rule context
2308 if ( -e $$Psource ) {2725 if ( -e $$Psource ) {
2309 return &rdb_ext_cmd;2726 return &Run_subst();
2310 }2727 }
2311 else {2728 else {
2312 return -1;2729 return -1;
@@ -2397,7 +2814,7 @@
23972814
2398#************************************************************2815#************************************************************
23992816
2400sub make_preview_continuousB {2817sub make_preview_continuous {
2401 local @changed = ();2818 local @changed = ();
2402 local @disappeared = ();2819 local @disappeared = ();
2403 local @no_dest = (); # Non-existent destination files2820 local @no_dest = (); # Non-existent destination files
@@ -2405,7 +2822,6 @@
2405 local @rules_to_apply = ();2822 local @rules_to_apply = ();
24062823
2407 local $failure = 0;2824 local $failure = 0;
2408 local $runs = 0;
2409 local %rules_applied = ();2825 local %rules_applied = ();
2410 local $updated = 0;2826 local $updated = 0;
24112827
@@ -2472,7 +2888,10 @@
2472 # $MSWin_fudge_break.2888 # $MSWin_fudge_break.
2473 $SIG{BREAK} = $SIG{INT} = 'IGNORE';2889 $SIG{BREAK} = $SIG{INT} = 'IGNORE';
2474 }2890 }
2475 $failure = rdb_makeB( @targets );2891 if ($compiling_cmd) {
2892 Run_subst( $compiling_cmd );
2893 }
2894 $failure = rdb_make( @targets );
24762895
2477## warn "=========Viewer PID = $$Pviewer_process; updated=$updated\n";2896## warn "=========Viewer PID = $$Pviewer_process; updated=$updated\n";
24782897
@@ -2539,13 +2958,25 @@
2539 $failure_msg =~ s/\s*$//; #Remove trailing space2958 $failure_msg =~ s/\s*$//; #Remove trailing space
2540 warn "$My_name: $failure_msg\n",2959 warn "$My_name: $failure_msg\n",
2541 " ==> You will need to change a source file before I do another run <==\n";2960 " ==> You will need to change a source file before I do another run <==\n";
2961 if ($failure_cmd) {
2962 Run_subst( $failure_cmd );
2963 }
2542 }2964 }
2965 else {
2966 if ($success_cmd) {
2967 Run_subst( $success_cmd );
2968 }
2969 }
2543 rdb_show_rule_errors();2970 rdb_show_rule_errors();
2544 if ($show_time && ! $first_time) { show_timing(); }2971 if ($show_time && ! $first_time) { show_timing(); }
2545 if ( $first_time || $updated || $failure ) {2972 if ( $first_time || $updated || $failure ) {
2546 print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";2973 print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
2547 }2974 }
2548 $waiting = 1; if ($diagnostics) { warn "WAITING\n"; }2975 $waiting = 1; if ($diagnostics) { warn "WAITING\n"; }
2976# During waiting for file changes, handle ctrl/C and ctrl/break here, rather than letting
2977# system handle them by terminating script (and any script that calls it). This allows,
2978# for example, the clean up code in the following command line to work:
2979# latexmk -pvc foo; cleanup;
2549 &catch_break;2980 &catch_break;
2550 $have_break = 0;2981 $have_break = 0;
2551 WAIT: while (1) {2982 WAIT: while (1) {
@@ -2562,7 +2993,7 @@
2562 $processing_time1 = processing_time();2993 $processing_time1 = processing_time();
2563 # Does this do this job????2994 # Does this do this job????
2564 local $new_files = 0;2995 local $new_files = 0;
2565 rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_filesB } );2996 rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_files } );
2566 if ($new_files > 0) {2997 if ($new_files > 0) {
2567 warn "$My_name: New file(s) found.\n";2998 warn "$My_name: New file(s) found.\n";
2568 last WAIT; 2999 last WAIT;
@@ -2576,7 +3007,7 @@
2576 }3007 }
2577 $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }3008 $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
2578 } #end infinite_loop CHANGE:3009 } #end infinite_loop CHANGE:
2579} #END sub make_preview_continuousB3010} #END sub make_preview_continuous
25803011
2581#************************************************************3012#************************************************************
25823013
@@ -2585,16 +3016,37 @@
2585 # NEW VERSION3016 # NEW VERSION
2586 # Run rc_file whose name is given in first argument3017 # Run rc_file whose name is given in first argument
2587 # Exit with code 0 on success3018 # Exit with code 0 on success
2588 # Exit with code 1 if file could not be read.3019 # Exit with code 1 if file cannot be read or does not exist.
2589 # Stop if there is a syntax error or other problem.3020 # Stop if there is a syntax error or other problem.
3021 # PREVIOUSLY:
3022 # Exit with code 2 if is a syntax error or other problem.
2590 my $rc_file = $_[0];3023 my $rc_file = $_[0];
2591 my $ret_code = 0;3024 my $ret_code = 0;
2592 warn "$My_name: Executing Perl code in file '$rc_file'...\n" 3025 warn "$My_name: Executing Perl code in file '$rc_file'...\n"
2593 if $diagnostics;3026 if $diagnostics;
2594 if ( ! -r $rc_file ) {3027 # I could use the do command of perl, but the preceeding -r test
2595 return 1;3028 # to get good diagnostics gets the wrong result under cygwin
2596 }3029 # (e.g., on /cygdrive/c/latexmk/LatexMk)
2597 do( $rc_file );3030 my $RCH = new FileHandle;
3031 if ( !-e $rc_file ) {
3032 warn "$My_name: The rc-file '$rc_file' does not exist\n";
3033 return 1;
3034 }
3035 elsif ( open $RCH, "<$rc_file" ) {
3036 { local $/; eval <$RCH>; }
3037 close $RCH;
3038 }
3039 else {
3040 warn "$My_name: I cannot read the rc-file '$rc_file'\n";
3041 return 1;
3042 }
3043 # PREVIOUS VERSION
3044# if ( ! -r $rc_file ) {
3045# warn "$My_name: I cannot read the rc-file '$rc_file'\n",
3046# " or at least that's what Perl (for $^O) reports\n";
3047# return 1;
3048# }
3049# do( $rc_file );
2598 if ( $@ ) {3050 if ( $@ ) {
2599 # Indent each line of possibly multiline message:3051 # Indent each line of possibly multiline message:
2600 my $message = prefix( $@, " " );3052 my $message = prefix( $@, " " );
@@ -2639,10 +3091,11 @@
2639#************************************************************3091#************************************************************
26403092
2641sub cleanup1 {3093sub cleanup1 {
2642 # Usage: cleanup1( exts_without_period, ... )3094 # Usage: cleanup1( directory, exts_without_period, ... )
3095 my $dir = shift;
2643 foreach (@_) { 3096 foreach (@_) {
2644 (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$root_filename/;3097 (my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_filename/;
2645 unlink("$name");3098 unlink_or_move("$name");
2646 }3099 }
2647} #END cleanup13100} #END cleanup1
26483101
@@ -2665,7 +3118,7 @@
2665 return;3118 return;
2666 }3119 }
2667 if ( (-e $$Pdest) && (-e $$Psource) ) {3120 if ( (-e $$Pdest) && (-e $$Psource) ) {
2668 unlink $$Pdest;3121 unlink_or_move( $$Pdest );
2669 }3122 }
2670 elsif ( (-e $$Pdest) && (!-e $$Psource) ) {3123 elsif ( (-e $$Pdest) && (!-e $$Psource) ) {
2671 warn "$My_name: For custom dependency '$rule',\n",3124 warn "$My_name: For custom dependency '$rule',\n",
@@ -2757,9 +3210,12 @@
2757 "$My_name $version_num: Automatic LaTeX document generation routine\n\n",3210 "$My_name $version_num: Automatic LaTeX document generation routine\n\n",
2758 "Usage: $my_name [latexmk_options] [filename ...]\n\n",3211 "Usage: $my_name [latexmk_options] [filename ...]\n\n",
2759 " Latexmk_options:\n",3212 " Latexmk_options:\n",
2760 " -bibtex - use bibtex when needed (default)\n",3213 " -aux-directory=dir or -auxdir=dir \n",
2761 " -bibtex- - never use bibtex\n",3214 " - set name of directory for auxiliary files (aux, log)\n",
2762 " -bibtex-cond - use bibtex when needed, but only if the bib files exist\n",3215 " - Currently this only works with MiKTeX\n",
3216 " -bibtex - use bibtex when needed (default)\n",
3217 " -bibtex- - never use bibtex\n",
3218 " -bibtex-cond - use bibtex when needed, but only if the bib files exist\n",
2763 " -bm <message> - Print message across the page when converting to postscript\n",3219 " -bm <message> - Print message across the page when converting to postscript\n",
2764 " -bi <intensity> - Set contrast or intensity of banner\n",3220 " -bi <intensity> - Set contrast or intensity of banner\n",
2765 " -bs <scale> - Set scale for banner\n",3221 " -bs <scale> - Set scale for banner\n",
@@ -2800,10 +3256,17 @@
2800 " -l- - turn off -l\n",3256 " -l- - turn off -l\n",
2801 " -latex=<program> - set program used for latex.\n",3257 " -latex=<program> - set program used for latex.\n",
2802 " (replace '<program>' by the program name)\n",3258 " (replace '<program>' by the program name)\n",
3259 " -latexoption=<option> - add the given option to the (pdf)latex command\n",
3260 " -M - Show list of dependent files after processing\n",
3261 " -MF file - Specifies name of file to receives list dependent files\n",
3262 " -MP - List of dependent files includes phony target for each source file.\n",
2803 " -new-viewer - in -pvc mode, always start a new viewer\n",3263 " -new-viewer - in -pvc mode, always start a new viewer\n",
2804 " -new-viewer- - in -pvc mode, start a new viewer only if needed\n",3264 " -new-viewer- - in -pvc mode, start a new viewer only if needed\n",
2805 " -nobibtex - never use bibtex\n",3265 " -nobibtex - never use bibtex\n",
2806 " -nodependents - Do not show list of dependent files after processing\n",3266 " -nodependents - Do not show list of dependent files after processing\n",
3267 " -norc - omit automatic reading of system, user and project rc files\n",
3268 " -output-directory=dir or -outdir=dir\n",
3269 " - set name of directory for output files\n",
2807 " -pdf - generate pdf by pdflatex\n",3270 " -pdf - generate pdf by pdflatex\n",
2808 " -pdfdvi - generate pdf by dvipdf\n",3271 " -pdfdvi - generate pdf by dvipdf\n",
2809 " -pdflatex=<program> - set program used for pdflatex.\n",3272 " -pdflatex=<program> - set program used for pdflatex.\n",
@@ -2824,12 +3287,17 @@
2824 " on force mode, so errors do not cause $my_name to stop.)\n",3287 " on force mode, so errors do not cause $my_name to stop.)\n",
2825 " (Side effect: turn off ordinary preview mode.)\n",3288 " (Side effect: turn off ordinary preview mode.)\n",
2826 " -pvc- - turn off -pvc\n",3289 " -pvc- - turn off -pvc\n",
3290 " -quiet - silence progress messages from called programs\n",
2827 " -r <file> - Read custom RC file\n",3291 " -r <file> - Read custom RC file\n",
3292 " (N.B. This file could override options specified earlier\n",
3293 " on the command line.)\n",
2828 " -recorder - Use -recorder option for (pdf)latex\n",3294 " -recorder - Use -recorder option for (pdf)latex\n",
2829 " (to give list of input and output files)\n",3295 " (to give list of input and output files)\n",
2830 " -recorder- - Do not use -recorder option for (pdf)latex\n",3296 " -recorder- - Do not use -recorder option for (pdf)latex\n",
2831 " -rules - Show list of rules after processing\n",3297 " -rules - Show list of rules after processing\n",
2832 " -rules- - Do not show list of rules after processing\n",3298 " -rules- - Do not show list of rules after processing\n",
3299 " -showextraoptions - Show other allowed options that are simply passed\n",
3300 " as is to latex and pdflatex\n",
2833 " -silent - silence progress messages from called programs\n",3301 " -silent - silence progress messages from called programs\n",
2834 " -time - show CPU time used\n",3302 " -time - show CPU time used\n",
2835 " -time- - don't show CPU time used\n",3303 " -time- - don't show CPU time used\n",
@@ -2843,14 +3311,18 @@
2843 " -view=none - no viewer is used\n",3311 " -view=none - no viewer is used\n",
2844 " -view=ps - viewer is for ps\n",3312 " -view=ps - viewer is for ps\n",
2845 " -view=pdf - viewer is for pdf\n",3313 " -view=pdf - viewer is for pdf\n",
3314 " -xelatex - use xelatex for processing files to pdf\n",
3315 "\n",
2846 " filename = the root filename of LaTeX document\n",3316 " filename = the root filename of LaTeX document\n",
2847 "\n",3317 "\n",
2848 "-p, -pv and -pvc are mutually exclusive\n",3318 "-p, -pv and -pvc are mutually exclusive\n",
2849 "-h, -c and -C override all other options.\n",3319 "-h, -c and -C override all other options.\n",
2850 "-pv and -pvc require one and only one filename specified\n",3320 "-pv and -pvc require one and only one filename specified\n",
2851 "All options can be introduced by '-' or '--'. (E.g., --help or -help.)\n",3321 "All options can be introduced by '-' or '--'. (E.g., --help or -help.)\n",
2852 "Contents of RC file specified by -r overrides options specified\n",3322 " \n",
2853 " before the -r option on the command line\n";3323 "In addition, latexmk recognizes many other options that are passed to\n",
3324 "latex and/or pdflatex without interpretation by latexmk. Run latexmk\n",
3325 "with the option -showextraoptions to see a list of these\n";
28543326
2855} #END print_help3327} #END print_help
28563328
@@ -2902,9 +3374,14 @@
29023374
2903sub check_biber_log {3375sub check_biber_log {
2904 # Check for biber warnings:3376 # Check for biber warnings:
2905 # Usage: check_biber_log( base_of_biber_run[, \@biber_source )3377 # Usage: check_biber_log( base_of_biber_run, \@biber_source )
2906 # return 0: OK, 1: biber warnings, 2: biber errors, 3378 # return 0: OK;
2907 # 3: could not open .blg file.3379 # 1: biber warnings;
3380 # 2: biber errors;
3381 # 3: could not open .blg file;
3382 # 4: failed to find one or more source files, except for bibfile;
3383 # 5: failed to find bib file;
3384 # 6: missing file, one of which is control file
2908 # 10: only error is missing \citation commands.3385 # 10: only error is missing \citation commands.
2909 # Side effect: add source files @biber_source3386 # Side effect: add source files @biber_source
2910 my $base = $_[0];3387 my $base = $_[0];
@@ -2917,52 +3394,82 @@
2917 my $have_error = 0;3394 my $have_error = 0;
2918 my $missing_citations = 0;3395 my $missing_citations = 0;
2919 my $no_citations = 0;3396 my $no_citations = 0;
2920 my $error_count = 0;3397 my $error_count = 0; # From my counting of error messages
2921 my $warning_count = 0;3398 my $warning_count = 0; # From my counting of warning messages
3399 # The next two occur only from biber
3400 my $bibers_error_count = 0; # From biber's counting of errors
3401 my $bibers_warning_count = 0; # From biber's counting of warnings
3402 my $not_found_count = 0;
3403 my $control_file_missing = 0;
2922 while (<$log_file>) {3404 while (<$log_file>) {
2923 if (/> WARN /) { 3405 if (/> WARN /) {
2924 print "Biber warning: $_"; 3406 print "Biber warning: $_";
2925 $have_warning = 1;3407 $have_warning = 1;
2926 $warning_count ++;3408 $warning_count ++;
2927 }3409 }
2928 elsif (/> FATAL /) {3410 elsif (/> (FATAL|ERROR) /) {
2929 print "Biber error: $_"; 3411 print "Biber error: $_";
2930 $have_error = 1;3412 if ( /> (FATAL|ERROR) - Cannot find file '([^']+)'/ #'
2931 $error_count ++;3413 || /> (FATAL|ERROR) - Cannot find '([^']+)'/ ) { #'
2932 if ( /> FATAL - The file '[^']+' does not contain any citations!/ ) {3414 $not_found_count++;
2933 $no_citations++;3415 push @$Pbiber_source, $2;
3416 }
3417 elsif ( /> (FATAL|ERROR) - Cannot find control file '([^']+)'/ ) { #'
3418 $not_found_count++;
3419 $control_file_missing = 1;
3420 push @$Pbiber_source, $2;
3421 }
3422 else {
3423 $have_error = 1;
3424 $error_count ++;
3425 if ( /> (FATAL|ERROR) - The file '[^']+' does not contain any citations!/ ) { #'
3426 $no_citations++;
3427 }
2934 }3428 }
2935 }3429 }
2936 elsif ( /> INFO - Found .* '([^']+)'\s*$/3430 elsif ( /> INFO - Found .* '([^']+)'\s*$/
2937 || /> INFO - Found '([^']+)'\s*$/3431 || /> INFO - Found '([^']+)'\s*$/
3432 || /> INFO - Reading '([^']+)'\s*$/
3433 || /> INFO - Reading (.*)$/
2938 || /> INFO - Processing .* file '([^']+)' .*$/3434 || /> INFO - Processing .* file '([^']+)' .*$/
2939 ) {3435 ) {
2940 if ( defined $Pbiber_source ) {3436 if ( defined $Pbiber_source ) {
2941 push @$Pbiber_source, $1;3437 push @$Pbiber_source, $1;
2942 }3438 }
2943 }3439 }
3440 elsif ( /> INFO - WARNINGS: ([\d]+)\s*$/ ) {
3441 $bibers_warning_count = $1;
3442 }
3443 elsif ( /> INFO - ERRORS: ([\d]+)\s*$/ ) {
3444 $bibers_error_count = $1;
3445 }
2944 }3446 }
2945 close $log_file;3447 close $log_file;
2946 my $bibret = &find_file_list1( $Pbiber_source, $Pbiber_source,3448
2947 '', \@BIBINPUTS );3449 my @not_found = &find_file_list1( $Pbiber_source, $Pbiber_source,
3450 '', \@BIBINPUTS );
2948 @$Pbiber_source = uniqs( @$Pbiber_source );3451 @$Pbiber_source = uniqs( @$Pbiber_source );
2949 if ($bibret == 0) {3452 if ( ($#not_found < 0) && ($#$Pbiber_source >= 0) ) {
2950 warn "$My_name: Found biber source file(s) [@$Pbiber_source]\n" 3453 warn "$My_name: Found biber source file(s) [@$Pbiber_source]\n"
2951 unless $silent;3454 unless $silent;
2952 }3455 }
3456 elsif ( ($#not_found == 0) && ($not_found[0] =~ /\.bib$/) ) {
3457 # Special treatment if sole missing file is bib file
3458 # I don't want to treat that as an error
3459 warn "$My_name: Biber did't find bib file [$not_found[0]]\n";
3460 return 5;
3461 }
2953 else {3462 else {
2954 warn "$My_name: Failed to find one or more biber source files ",3463 show_array( "$My_name: Failed to find one or more biber source files:",
2955 "in [@$Pbiber_source]\n";3464 @not_found );
2956 if ($force_mode) {3465 if ($force_mode) {
2957 warn "==== Force_mode is on, so I will continue. ",3466 warn "==== Force_mode is on, so I will continue. ",
2958 "But there may be problems ===\n";3467 "But there may be problems ===\n";
2959 }3468 }
2960 else {3469 if ($control_file_missing) {
2961 #$failure = -1;3470 return 6;
2962 #$failure_msg = 'Failed to find one or more biber source files';3471 }
2963 #warn "$My_name: Failed to find one or more biber source files\n";3472 return 4;
2964 }
2965 return 3;
2966 }3473 }
2967# print "$My_name: #Biber errors = $error_count, warning messages = $warning_count,\n ",3474# print "$My_name: #Biber errors = $error_count, warning messages = $warning_count,\n ",
2968# "missing citation messages = $missing_citations, no_citations = $no_citations\n";3475# "missing citation messages = $missing_citations, no_citations = $no_citations\n";
@@ -2979,12 +3486,49 @@
29793486
2980#**************************************************3487#**************************************************
29813488
3489sub run_bibtex {
3490 my $return = 999;
3491 if ( $aux_dir ) {
3492 if ( $$Psource =~ /^$aux_dir1/ ) {
3493 # Run bibtex in $aux_dir, fixing input search path
3494 # to allow for finding files in original directory
3495 my ( $base, $path, $ext ) = fileparseA( $$Psource );
3496 my $cwd = good_cwd();
3497 foreach ( 'BIBINPUTS', 'BSTINPUTS' ) {
3498 if ( exists $ENV{$_} ) {
3499 $ENV{$_} = $cwd.$search_path_separator.$ENV{$_};
3500 }
3501 else {
3502 $ENV{$_} = $cwd.$search_path_separator;
3503 }
3504 }
3505 pushd( $path );
3506 $return = &Run_subst( undef, undef, '', $base.$ext, '', $base );
3507 popd();
3508 }
3509 else {
3510 warn "$My_name: Directory in file name '$$Psource' for bibtex\n",
3511 " but it is not the output directory '$aux_dir'\n";
3512 $return = Run_subst();
3513 }
3514 }
3515 else {
3516 $return = Run_subst();
3517 }
3518 return $return;
3519}
3520
3521
3522#**************************************************
3523
2982sub check_bibtex_log {3524sub check_bibtex_log {
2983 # Check for bibtex warnings:3525 # Check for bibtex warnings:
2984 # Usage: check_bibtex_log( base_of_bibtex_run )3526 # Usage: check_bibtex_log( base_of_bibtex_run )
2985 # return 0: OK, 1: bibtex warnings, 2: bibtex errors, 3527 # return 0: OK, 1: bibtex warnings, 2: bibtex errors,
2986 # 3: could not open .blg file.3528 # 3: could not open .blg file.
2987 # 10: only error is missing \citation commands.3529 # 10: only error is missing \citation commands or a missing aux file
3530 # (which would normally be corrected after a later run of
3531 # (pdf)latex).
29883532
2989 my $base = $_[0];3533 my $base = $_[0];
2990 my $log_name = "$base.blg";3534 my $log_name = "$base.blg";
@@ -2994,27 +3538,41 @@
2994 my $have_warning = 0;3538 my $have_warning = 0;
2995 my $have_error = 0;3539 my $have_error = 0;
2996 my $missing_citations = 0;3540 my $missing_citations = 0;
3541 my @missing_aux = ();
2997 my $error_count = 0;3542 my $error_count = 0;
2998 while (<$log_file>) {3543 while (<$log_file>) {
2999 if (/^Warning--/) { 3544 if (/^Warning--/) {
3000 #print "Bibtex warning: $_"; 3545 #print "Bibtex warning: $_";
3001 $have_warning = 1;3546 $have_warning = 1;
3002 }3547 }
3548 elsif ( /^I couldn\'t open auxiliary file (.*\.aux)/ ) {
3549 push @missing_aux, $1;
3550 }
3003 elsif ( /^I found no \\citation commands---while reading file/ ) {3551 elsif ( /^I found no \\citation commands---while reading file/ ) {
3004 $missing_citations++; 3552 $missing_citations++;
3005 }3553 }
3006 elsif (/There (were|was) (\d+) error message/) { 3554 elsif (/There (were|was) (\d+) error message/) {
3007 $error_count = $2;3555 $error_count = $2;
3008 #print "Bibtex error: count=$error_count $_"; 3556 #print "Bibtex error: count=$error_count $_";
3009 $have_error = 1;3557 $have_error = 1;
3010 }3558 }
3011 }3559 }
3012 close $log_file;3560 close $log_file;
3013 #print "Bibtex errors = $error_count, missing citations = $missing_citations\n";3561 my $missing = $missing_citations + $#missing_aux + 1;
3014 if ($have_error && ($error_count <= $missing_citations ) 3562
3015 && ($missing_citations > 0) ) {3563 if ( $#missing_aux > -1 ) {
3016 # If the only error is a missing citation line, that should only 3564 # Need to make the missing files.
3565 warn "$My_name: One or more aux files is missing for bibtex. I'll try\n",
3566 " to get (pdf)latex to remake them.\n";
3567 rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
3568 }
3569 #print "Bibtex errors = $error_count, missing aux files and citations = $missing\n";
3570 if ($have_error && ($error_count <= $missing )
3571 && ($missing > 0) ) {
3572 # If the only error is a missing citation line, that should only
3017 # count as a warning.3573 # count as a warning.
3574 # Also a missing aux file should be innocuous; it will be created on
3575 # next run of (pdf)latex. ?? HAVE I HANDLED THAT CORRECTLY?
3018 # But have to deal with the problem that bibtex gives a non-zero 3576 # But have to deal with the problem that bibtex gives a non-zero
3019 # exit code. So leave things as they are so that the user gets3577 # exit code. So leave things as they are so that the user gets
3020 # a better diagnostic ??????????????????????????3578 # a better diagnostic ??????????????????????????
@@ -3029,26 +3587,25 @@
30293587
3030#**************************************************3588#**************************************************
30313589
3032sub clean_file_name {3590sub normalize_force_directory {
3033 # Convert quoted filename as found in log file to filename without quotes3591 # Usage, normalize_force_directory( dir, filename )
3034 # Allows arbitrarily embedded double-quoted substrings, includes the3592 # Perform the following operations:
3035 # cases3593 # Clean filename
3036 # 1. `"string".ext', which arises e.g., from \jobname.bbl:3594 # If filename contains no path component, insert dir in front
3037 # when the base filename contains spaces, \jobname has quotes.3595 # Normalize filename
3038 # and from \includegraphics with basename specified.3596 # Return result
3039 # Also deals with filenames written by asymptote.sty3597 my $default_dir = $_[0];
3040 # 2. Or "string.ext" from \includegraphcs with basename and ext specified.3598 my $filename = clean_filename( $_[1] );
3041 # and from MiKTeX logfile for input files with spaces. 3599 my ($base_name, $path ) = fileparse( $filename );
3042 # Doubled quotes (e.g., A""B) don't get converted.3600 if ( $base_name eq $filename ) {
3043 # Neither do unmatched quotes.3601 $filename = "$default_dir$filename";
3044 my $filename = $_[0];3602 }
3045 while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}3603 return normalize_filename( $filename );
3046 return $filename;3604} #END normalize force_directory
3047}
30483605
3049# ------------------------------3606# ------------------------------
30503607
3051sub parse_logB {3608sub parse_log {
3052# Scan log file for: dependent files3609# Scan log file for: dependent files
3053# reference_changed, bad_reference, bad_citation3610# reference_changed, bad_reference, bad_citation
3054# Return value: 1 if success, 0 if no log file.3611# Return value: 1 if success, 0 if no log file.
@@ -3109,7 +3666,6 @@
3109 $bad_reference = 0;3666 $bad_reference = 0;
3110 $bad_citation = 0;3667 $bad_citation = 0;
31113668
3112 my $log_name = "$root_filename.log";
3113 my $log_file = new FileHandle;3669 my $log_file = new FileHandle;
3114 if ( ! open( $log_file, "<$log_name" ) ) {3670 if ( ! open( $log_file, "<$log_name" ) ) {
3115 return 0;3671 return 0;
@@ -3188,8 +3744,9 @@
3188 # First line OK3744 # First line OK
3189 next LINE;3745 next LINE;
3190 } else {3746 } else {
3191 warn "$My_name: Error on first line of '$log_name'. ".3747 warn "$My_name: Error on first line of '$log_name'.\n".
3192 "This is apparently not a TeX log file.\n";3748 "This is apparently not a TeX log file. ",
3749 "The first line is:\n$_\n";
3193 $failure = 1;3750 $failure = 1;
3194 $failure_msg = "Log file '$log_name' appears to have wrong format.";3751 $failure_msg = "Log file '$log_name' appears to have wrong format.";
3195 return 0;3752 return 0;
@@ -3202,7 +3759,7 @@
3202 if ( ($block_type eq 'conversion') 3759 if ( ($block_type eq 'conversion')
3203 && /^\($current_pkg\)\s+Output file: <([^>]+)>/ ) 3760 && /^\($current_pkg\)\s+Output file: <([^>]+)>/ )
3204 {3761 {
3205 $delegated_output = $1;3762 $delegated_output = normalize_clean_filename($1);
3206 }3763 }
3207 next LINE;3764 next LINE;
3208 }3765 }
@@ -3216,20 +3773,20 @@
3216 }3773 }
3217 # Check for changed references, bad references and bad citations:3774 # Check for changed references, bad references and bad citations:
3218 if (/Rerun to get/) { 3775 if (/Rerun to get/) {
3219 warn "$My_name: References changed.\n";3776 warn "$My_name: References changed.\n" if ! $silent;
3220 $reference_changed = 1;3777 $reference_changed = 1;
3221 } 3778 }
3222 if (/LaTeX Warning: (Reference[^\001]*undefined)./) { 3779 if (/LaTeX Warning: (Reference[^\001]*undefined)./) {
3223 warn "$My_name: $1 \n";3780 warn "$My_name: $1 \n" unless $silent;
3224 $bad_reference = 1;3781 $bad_reference++;
3225 } 3782 }
3226 if (/LaTeX Warning: (Citation[^\001]*undefined)./) {3783 if (/LaTeX Warning: (Citation[^\001]*undefined)./) {
3227 warn "$My_name: $1 \n";3784 warn "$My_name: $1 \n" unless $silent;
3228 $bad_citation = 1;3785 $bad_citation++;
3229 }3786 }
3230 if (/Package natbib Warning: (Citation[^\001]*undefined)./) {3787 if (/Package natbib Warning: (Citation[^\001]*undefined)./) {
3231 warn "$My_name: $1 \n";3788 warn "$My_name: $1 \n" unless $silent;
3232 $bad_citation = 1;3789 $bad_citation++;
3233 }3790 }
3234 if ( /^Document Class: / ) {3791 if ( /^Document Class: / ) {
3235 # Class sign-on line3792 # Class sign-on line
@@ -3245,7 +3802,7 @@
3245 next LINE;3802 next LINE;
3246 }3803 }
3247 if ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {3804 if ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {
3248 $primary_out = clean_file_name($1);3805 $primary_out = normalize_clean_filename($1);
3249 warn "$My_name: Log file says output to '$primary_out'\n"3806 warn "$My_name: Log file says output to '$primary_out'\n"
3250 unless $silent;3807 unless $silent;
3251 next LINE;3808 next LINE;
@@ -3259,15 +3816,18 @@
3259 next LINE;3816 next LINE;
3260 }3817 }
3261 if ( /^\\openout\d+\s*=\s*\`([^\']+)\'\.$/ ) {3818 if ( /^\\openout\d+\s*=\s*\`([^\']+)\'\.$/ ) {
3262 $generated_log{clean_file_name($1)} = 1;3819 # When (pdf)latex is run with an -output-directory
3820 # or an -aux_directory, the file name does not contain
3821 # the output path; fix this, after removing quotes:
3822 $generated_log{normalize_force_directory( $aux_dir1, $1 )} = 1;
3263 next LINE;3823 next LINE;
3264 }3824 }
3265 # Test for conversion produced by package:3825 # Test for conversion produced by package:
3266 if ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {3826 if ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {
3267 # Info. produced by epstopdf (and possibly others) 3827 # Info. produced by epstopdf (and possibly others)
3268 # about file conversion3828 # about file conversion
3269 $current_pkg = clean_file_name($1);3829 $current_pkg = normalize_clean_filename($1);
3270 $delegated_source = clean_file_name($2);3830 $delegated_source = normalize_clean_filename($2);
3271 $block_type = 'conversion';3831 $block_type = 'conversion';
3272 next LINE;3832 next LINE;
3273 }3833 }
@@ -3294,9 +3854,12 @@
3294 " '$_'\n";3854 " '$_'\n";
3295 next LINE;3855 next LINE;
3296 }3856 }
3297 # Typically, there is trailing space, not part of filename:3857 # Typically, there is trailing space, not part of filename:
3298 $idx_file =~ s/\s*$//;3858 $idx_file =~ s/\s*$//;
3299 $idx_file = clean_file_name($idx_file);3859 # When (pdf)latex is run with an -output-directory
3860 # or an -aux_directory, the file name does not contain
3861 # the output path; fix this, after removing quotes:
3862 $idx_file = normalize_force_directory( $aux_dir1, $idx_file );
3300 my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );3863 my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );
3301 $idx_base = $idx_path.$idx_base;3864 $idx_base = $idx_path.$idx_base;
3302 $idx_file = $idx_base.$idx_ext;3865 $idx_file = $idx_base.$idx_ext;
@@ -3320,8 +3883,10 @@
3320 next LINE;3883 next LINE;
3321 }3884 }
3322 if ( /^No file (.*?\.bbl)./ ) {3885 if ( /^No file (.*?\.bbl)./ ) {
3323 # Notice that the3886 # When (pdf)latex is run with an -output-directory
3324 my $bbl_file = clean_file_name($1);3887 # or an -aux_directory, the file name does not contain
3888 # the output path; fix this, after removing quotes:
3889 my $bbl_file = normalize_force_directory( $aux_dir1, $1 );
3325 warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";3890 warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
3326 $dependents{$bbl_file} = 0;3891 $dependents{$bbl_file} = 0;
3327 push @bbl_files, $bbl_file;3892 push @bbl_files, $bbl_file;
@@ -3329,16 +3894,28 @@
3329 }3894 }
3330 foreach my $pattern (@file_not_found) {3895 foreach my $pattern (@file_not_found) {
3331 if ( /$pattern/ ) {3896 if ( /$pattern/ ) {
3332 my $file = clean_file_name($1);3897 my $file = clean_filename($1);
3333 warn "$My_name: Missing input file: '$file' from line\n '$_'\n"3898 warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
3334 unless $silent;3899 unless $silent;
3335 $dependents{$file} = 0;3900 $dependents{normalize_filename($file)} = 0;
3901 my $file1 = $file;
3902 if ( $aux_dir ) {
3903 # Allow for the possibility that latex generated
3904 # a file in $aux_dir, from which the missing file can
3905 # be created by a cusdep (or other) rule that puts
3906 # the result in $out_dir. If the announced missing file
3907 # has no path, then it would be effectively a missing
3908 # file in $aux_dir, with a path. So give this alternate
3909 # location.
3910 my $file1 = normalize_force_directory( $aux_dir1, $file );
3911 $dependents{$file1} = 0;
3912 }
3336 next LINE;3913 next LINE;
3337 }3914 }
3338 }3915 }
3339 if ( /^File: (.+) Graphic file \(type / ) {3916 if ( /^File: (.+) Graphic file \(type / ) {
3340 # First line of message from includegraphics/x3917 # First line of message from includegraphics/x
3341 $dependents{clean_file_name($1)} = 1;3918 $dependents{normalize_clean_filename($1)} = 1;
3342 next LINE;3919 next LINE;
3343 }3920 }
3344 # Now test for generic lines to ignore, only after special cases!3921 # Now test for generic lines to ignore, only after special cases!
@@ -3467,6 +4044,7 @@
3467 }4044 }
3468 INCLUDE_NAME:4045 INCLUDE_NAME:
3469 foreach my $include_name (@new_includes) {4046 foreach my $include_name (@new_includes) {
4047 $include_name = normalize_filename( $include_name );
3470 my ($base, $path, $ext) = fileparseB( $include_name );4048 my ($base, $path, $ext) = fileparseB( $include_name );
3471 if ( ($path eq './') || ($path eq '.\\') ) {4049 if ( ($path eq './') || ($path eq '.\\') ) {
3472 $include_name = $base.$ext;4050 $include_name = $base.$ext;
@@ -3654,23 +4232,45 @@
3654 }4232 }
3655 }4233 }
3656 return 1;4234 return 1;
3657} #END parse_logB4235} #END parse_log
36584236
3659#************************************************************4237#************************************************************
36604238
3661sub parse_fls {4239sub parse_fls {
3662 my ($fls_name, $Pinputs, $Poutputs ) = @_;4240 my ($fls_name, $Pinputs, $Poutputs, $Pfirst_read_after_write ) = @_;
3663 %$Pinputs = %$Poutputs = ();4241 %$Pinputs = %$Poutputs = %$Pfirst_read_after_write = ();
3664 my $fls_file = new FileHandle;4242 my $fls_file = new FileHandle;
4243 # Make a note of current working directory
4244 # I'll update it from the fls file later
4245 # Currently I don't use this, but it would be useful to use
4246 # this when testing prefix for cwd in a filename, by
4247 # giving (pdf)latex's best view of the cwd. Note that the
4248 # value given by the cwd() function may be mangled, e.g., by cygwin
4249 # compared with native MSWin32.
4250 my $cwd = good_cwd();
3665 if ( ! open ($fls_file, "<$fls_name") ) {4251 if ( ! open ($fls_file, "<$fls_name") ) {
3666 return 1;4252 return 1;
3667 }4253 }
3668 foreach $_ ( <$fls_file> ) {4254 foreach $_ ( <$fls_file> ) {
3669 if (/^\s*INPUT\s+(.*)\s+$/) {4255 # Remove trailing CR and LF. Thus we get correct behavior when an fls file
3670 $$Pinputs{$1} = 1;4256 # is produced by MS-Windows program (e.g., in MiKTeX) with CRLF line ends,
4257 # but is read by Unix Perl (which treats LF as line end, and preserves CRLF
4258 # in read-in lines):
4259 $_ =~ s/[\n\r]*$//;
4260 if (/^\s*PWD\s+(.*)$/) {
4261 $cwd = $1;
4262 }
4263 elsif (/^\s*INPUT\s+(.*)$/) {
4264 # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
4265 my $file = normalize_filename( $1 );
4266 if ( (exists $$Poutputs{$file}) && (! exists $$Pinputs{$file}) ) {
4267 $$Pfirst_read_after_write{$file} = 1;
4268 }
4269 $$Pinputs{$file} = 1;
3671 }4270 }
3672 elsif (/^\s*OUTPUT\s+(.*)\s+$/) {4271 elsif (/^\s*OUTPUT\s+(.*)$/) {
3673 $$Poutputs{$1} = 1;4272 # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
4273 $$Poutputs{ normalize_filename( $1 )} = 1;
3674 }4274 }
3675 }4275 }
3676 close( $fls_file );4276 close( $fls_file );
@@ -3679,6 +4279,68 @@
36794279
3680#************************************************************4280#************************************************************
36814281
4282sub clean_filename {
4283 # Convert quoted filename as found in log file to filename without quotes
4284 # Allows arbitrarily embedded double-quoted substrings, includes the
4285 # cases
4286 # 1. `"string".ext', which arises e.g., from \jobname.bbl:
4287 # when the base filename contains spaces, \jobname has quotes.
4288 # and from \includegraphics with basename specified.
4289 # Also deals with filenames written by asymptote.sty
4290 # 2. Or "string.ext" from \includegraphcs with basename and ext specified.
4291 # and from MiKTeX logfile for input files with spaces.
4292 # Doubled quotes (e.g., A""B) don't get converted.
4293 # Neither do unmatched quotes.
4294 my $filename = $_[0];
4295 while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}
4296 return $filename;
4297}
4298
4299# ------------------------------
4300
4301sub normalize_filename {
4302 # Remove various forms for cwd at start of filename.
4303 # Convert to have directory separator = '/' only
4304 my $file = $_[0];
4305 my $file1 = $file; # Saved original value
4306 my $cwd = good_cwd();
4307 # Normalize files to use / to separate directory components:
4308 # (Note both / and \ are allowed under MSWin.)
4309 $cwd =~ s(\\)(/)g;
4310 $file =~ s(\\)(/)g;
4311
4312 # Remove current directory string:
4313 $file =~ s(^\./)();
4314 $file =~ s(^$cwd/)();
4315
4316 return $file;
4317}
4318
4319# ------------------------------
4320
4321sub normalize_clean_filename {
4322 # Remove quotes around filename --- see clean_filename --- as from log file.
4323 # Then remove any string for cwd, and convert to use '/' for directory separator,
4324 # (and any other standardization) done by normalize_filename.
4325 return normalize_filename( clean_filename( $_[0] ));
4326}
4327
4328#************************************************************
4329
4330sub OS_preferred_filename {
4331 # Usage: OS_preferred_filename(name)
4332 # Returns filename with directory separator '/' converted
4333 # to preferred conventions for current OS.
4334 # Currently implemented: only '\' for MSWin32
4335 my $file = $_[0];
4336 if ( $^O eq 'MSWin32' ) {
4337 $file =~ s(/)(\\)g;
4338 }
4339 return $file;
4340}
4341
4342#************************************************************
4343
3682sub parse_aux {4344sub parse_aux {
3683 #Usage: parse_aux( $aux_file, \@new_bib_files, \@new_aux_files, \@new_bst_files )4345 #Usage: parse_aux( $aux_file, \@new_bib_files, \@new_aux_files, \@new_bst_files )
3684 # Parse aux_file (recursively) for bib files, and bst files. 4346 # Parse aux_file (recursively) for bib files, and bst files.
@@ -3712,18 +4374,18 @@
3712 warn "$My_name: No .bib files listed in .aux file '$aux_file' \n",4374 warn "$My_name: No .bib files listed in .aux file '$aux_file' \n",
3713 return 2;4375 return 2;
3714 }4376 }
3715 my $bibret = &find_file_list1( $Pbib_files, $Pbib_files,4377 my @not_found = &find_file_list1( $Pbib_files, $Pbib_files,
3716 '.bib', \@BIBINPUTS );4378 '.bib', \@BIBINPUTS );
3717 @$Pbib_files = uniqs( @$Pbib_files );4379 @$Pbib_files = uniqs( @$Pbib_files );
3718 &find_file_list1( $Pbst_files, $Pbst_files, '.bst' );4380 &find_file_list1( $Pbst_files, $Pbst_files, '.bst' );
3719 @$Pbst_files = uniqs( @$Pbst_files );4381 @$Pbst_files = uniqs( @$Pbst_files );
3720 if ($bibret == 0) {4382 if ( $#not_found < 0) {
3721 warn "$My_name: Found bibliography file(s) [@$Pbib_files]\n" 4383 warn "$My_name: Found bibliography file(s) [@$Pbib_files]\n"
3722 unless $silent;4384 unless $silent;
3723 }4385 }
3724 else {4386 else {
3725 warn "$My_name: Failed to find one or more bibliography files ",4387 show_array( "$My_name: Failed to find one or more bibliography files ",
3726 "in [@$Pbib_files]\n";4388 @not_found );
3727 if ($force_mode) {4389 if ($force_mode) {
3728 warn "==== Force_mode is on, so I will continue. ",4390 warn "==== Force_mode is on, so I will continue. ",
3729 "But there may be problems ===\n";4391 "But there may be problems ===\n";
@@ -3771,7 +4433,7 @@
3771 }4433 }
3772 elsif ( /^\\\@input\{(.*)\}/ ) { 4434 elsif ( /^\\\@input\{(.*)\}/ ) {
3773 # \\@input{next_aux_file_name}4435 # \\@input{next_aux_file_name}
3774 &parse_aux1( $1 );4436 &parse_aux1( $aux_dir1.$1 );
3775 }4437 }
3776 }4438 }
3777 close($aux_fh);4439 close($aux_fh);
@@ -3789,11 +4451,12 @@
3789#************************************************************4451#************************************************************
37904452
3791sub fdb_get {4453sub fdb_get {
3792 # Call: fdb_get(filename [, run_time])4454 # Call: fdb_get(filename [, check_time])
3793 # Returns an array (time, size, md5) for the current state of the4455 # Returns an array (time, size, md5) for the current state of the
3794 # named file.4456 # named file.
3795 # The optional argument run_time is the runtime of some command4457 # The optional argument check_time is either the run_time of some command
3796 # associated with the use of the file --- see below.4458 # that may have changed the file or the last time the file was checked
4459 # for changes --- see below.
3797 # For non-existent file, deletes its entry in fdb_current, 4460 # For non-existent file, deletes its entry in fdb_current,
3798 # and returns (0,-1,0) 4461 # and returns (0,-1,0)
3799 # As an optimization, the md5 value is taken from the cache in 4462 # As an optimization, the md5 value is taken from the cache in
@@ -3811,11 +4474,11 @@
3811 # at some runtime t, the file is rewritten later by the same or another4474 # at some runtime t, the file is rewritten later by the same or another
3812 # program, with timestamp t, and when the initial file also has 4475 # program, with timestamp t, and when the initial file also has
3813 # timestamp t.4476 # timestamp t.
3814 # A test is applied for this situation if the run_time argument is 4477 # A test is applied for this situation if the check_time argument is
3815 # supplied and is nonzero.4478 # supplied and is nonzero.
38164479
3817 my ($file, $run_time) = @_;4480 my ($file, $check_time) = @_;
3818 if ( ! defined $run_time ) { $run_time = 0;}4481 if ( ! defined $check_time ) { $check_time = 0;}
3819 my ($new_time, $new_size) = get_time_size($file);4482 my ($new_time, $new_size) = get_time_size($file);
3820 my @nofile = (0,-1,0); # What we use for initializing4483 my @nofile = (0,-1,0); # What we use for initializing
3821 # a new entry in fdb or flagging4484 # a new entry in fdb or flagging
@@ -3833,23 +4496,27 @@
3833 my $file_data = $fdb_current{$file};4496 my $file_data = $fdb_current{$file};
3834 my ( $time, $size, $md5 ) = @$file_data;4497 my ( $time, $size, $md5 ) = @$file_data;
38354498
3836#warn "--------- Getting MD5: $file: (N,O,R) = $new_time, $time, $run_time\n";
3837#warn "--------- $file: (OT,OS,OM) = @$file_data\n";
3838 if ( ($new_time != $time) || ($new_size != $size) 4499 if ( ($new_time != $time) || ($new_size != $size)
3839 || ( $run_time && ($run_time == $time ) )4500 || ( $check_time && ($check_time == $time ) )
3840 ) {4501 ) {
3841 # Only force recalculation of md5 if time or size changed4502 # Only force recalculation of md5 if time or size changed.
3842 # Or if the time equals run_time, so that the file may4503 # However, the physical file time may have changed without
3843 # have changed within the 1-second granularity of the time4504 # affecting the value of the time coded in $time, because
4505 # times are computed with a 1-second granularity.
4506 # The only case to treat specially is where the file was created,
4507 # then used by the current rule, and then rewritten, all within
4508 # the granularity size, otherwise the value of the reported file
4509 # time changed, and we've handled it. But we may have already
4510 # checked this at an earlier time than the current check. So the
4511 # only dangerous case is where the file time equals a check_time,
4512 # which is either the run_time of the command or the time of a
4513 # previous check.
3844 # Else we assume file is really unchanged.4514 # Else we assume file is really unchanged.
3845 $recalculate_md5 = 1;4515 $recalculate_md5 = 1;
3846 }4516 }
3847 if ($recalculate_md5) {4517 if ($recalculate_md5) {
3848#warn "--------- RECALC MD5: $rule $file: (N,O,R) = $new_time, $time, $run_time\n";4518#warn "--------- RECALC MD5: $rule $file: (N,O,R,C) \n = $new_time, $time, $$Prun_time, $check_time\n";
3849#warn " ------- $file: (OT,OS,OM) = @$file_data\n";
3850#&traceback;
3851 @$file_data = ( $new_time, $new_size, get_checksum_md5( $file ) );4519 @$file_data = ( $new_time, $new_size, get_checksum_md5( $file ) );
3852#warn " ------- $file: (NT,NS,NM) = @$file_data\n";
3853 }4520 }
3854 return @$file_data;;4521 return @$file_data;;
3855} #END fdb_get4522} #END fdb_get
@@ -3926,7 +4593,7 @@
3926 $rule = $1;4593 $rule = $1;
3927 my $tail = $'; #' Single quote in comment tricks the parser in4594 my $tail = $'; #' Single quote in comment tricks the parser in
3928 # emacs from misparsing an isolated single quote4595 # emacs from misparsing an isolated single quote
3929 $run_time = 0;4596 $run_time = $check_time = 0;
3930 $source = $dest = $base = '';4597 $source = $dest = $base = '';
3931 if ( $tail =~ /^\s*(\S+)\s*$/ ) {4598 if ( $tail =~ /^\s*(\S+)\s*$/ ) {
3932 $run_time = $1;4599 $run_time = $1;
@@ -3937,13 +4604,19 @@
3937 $dest = $3;4604 $dest = $3;
3938 $base = $4;4605 $base = $4;
3939 }4606 }
4607 elsif ( $tail =~ /^\s*(\S+)\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s+\"([^\"]*)\"\s+(\S+)\s*$/ ) {
4608 $run_time = $1;
4609 $source = $2;
4610 $dest = $3;
4611 $base = $4;
4612 $check_time = $5;
4613 }
3940 if ( rdb_rule_exists( $rule ) ) {4614 if ( rdb_rule_exists( $rule ) ) {
3941 rdb_one_rule( $rule, 4615 rdb_one_rule( $rule,
3942 sub{ $$Ptest_kind = 1; 4616 sub{
4617 if ($$Ptest_kind == 3) { $$Ptest_kind = 1; }
3943 $$Prun_time = $run_time;4618 $$Prun_time = $run_time;
3944 #??if ($source) { $$Psource = $source; }4619 $$Pcheck_time = $check_time;
3945 #??if ($dest) { $$Pdest = $dest; }
3946 #??if ($base) { $$Pbase = $base; }
3947 } 4620 }
3948 );4621 );
3949 }4622 }
@@ -3965,11 +4638,12 @@
3965 # If it existed on last run, it will be in later 4638 # If it existed on last run, it will be in later
3966 # lines of the fdb file4639 # lines of the fdb file
3967 rdb_create_rule( $rule, 'cusdep', '', $PAnew_cmd, 1, 4640 rdb_create_rule( $rule, 'cusdep', '', $PAnew_cmd, 1,
3968 $source, $dest, $base, 0, $run_time, 1 );4641 $source, $dest, $base, 0, $run_time, $check_time, 1 );
3969 }4642 }
3970 elsif ( $rule =~ /^(makeindex|bibtex|biber)\s*(.*)$/ ) {4643 elsif ( $rule =~ /^(makeindex|bibtex|biber)\s*(.*)$/ ) {
3971 my $PA_extra_gen = [];4644 my $PA_extra_gen = [];
3972 my $rule_generic = $1;4645 my $rule_generic = $1;
4646 my $int_cmd = '';
3973 if ( ! $source ) {4647 if ( ! $source ) {
3974 # If fdb_file was old-style (v. 1)4648 # If fdb_file was old-style (v. 1)
3975 $source = $2;4649 $source = $2;
@@ -3991,18 +4665,20 @@
3991 }4665 }
3992 if ($rule =~ /^makeindex/) { $PA_extra_gen = [ "$base.ilg" ]; }4666 if ($rule =~ /^makeindex/) { $PA_extra_gen = [ "$base.ilg" ]; }
3993 if ($rule =~ /^(bibtex|biber)/) { $PA_extra_gen = [ "$base.blg" ]; }4667 if ($rule =~ /^(bibtex|biber)/) { $PA_extra_gen = [ "$base.blg" ]; }
4668 if ($rule =~ /^bibtex/) { $int_cmd = "run_bibtex"; }
3994 warn "$My_name: File-database '$in_name': setting rule '$rule'\n"4669 warn "$My_name: File-database '$in_name': setting rule '$rule'\n"
3995 if $diagnostics;4670 if $diagnostics;
3996 my $cmd_type = 'external';4671 my $cmd_type = 'external';
3997 my $ext_cmd = ${$rule_generic};4672 my $ext_cmd = ${$rule_generic};
3998 warn " Rule kind = '$rule_generic'; ext_cmd = '$ext_cmd';\n",4673 warn " Rule kind = '$rule_generic'; ext_cmd = '$ext_cmd';\n",
4674 " int_cmd = '$int_cmd';\n",
3999 " source = '$source'; dest = '$dest'; base = '$base';\n"4675 " source = '$source'; dest = '$dest'; base = '$base';\n"
4000 if $diagnostics;4676 if $diagnostics;
4001 # Set source file as non-existent. 4677 # Set source file as non-existent.
4002 # If it existed on last run, it will be in later 4678 # If it existed on last run, it will be in later
4003 # lines of the fdb file4679 # lines of the fdb file
4004 rdb_create_rule( $rule, $cmd_type, $ext_cmd, '', 1, 4680 rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, 1,
4005 $source, $dest, $base, 0, $run_time, 1, $PA_extra_gen );4681 $source, $dest, $base, 0, $run_time, $check_time, 1, $PA_extra_gen );
4006 }4682 }
4007 else {4683 else {
4008 warn "$My_name: In file-database '$in_name' rule '$rule'\n",4684 warn "$My_name: In file-database '$in_name' rule '$rule'\n",
@@ -4059,7 +4735,7 @@
4059 }4735 }
4060 undef $in_handle;4736 undef $in_handle;
4061 # Set cus dependencies.4737 # Set cus dependencies.
4062 &rdb_set_dependentsA( keys %rule_db );4738 &rdb_set_dependents( keys %rule_db );
40634739
4064#?? Check from_rules exist.4740#?? Check from_rules exist.
40654741
@@ -4112,7 +4788,7 @@
4112 { 4788 {
4113 return; 4789 return;
4114 }4790 }
4115 print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" \n"; 4791 print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" $$Pcheck_time\n";
4116 rdb_do_files(4792 rdb_do_files(
4117 sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; }4793 sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; }
4118 );4794 );
@@ -4155,6 +4831,9 @@
4155 local %generated_log = (); # Lists generated files found in log file4831 local %generated_log = (); # Lists generated files found in log file
4156 local %generated_fls = (); # Lists generated files found in fls file4832 local %generated_fls = (); # Lists generated files found in fls file
4157 local %source_fls = (); # Lists source files found in fls file4833 local %source_fls = (); # Lists source files found in fls file
4834 local %first_read_after_write = (); # Lists source files that are only read
4835 # after being written (so are not true
4836 # source files.
4158 local $primary_out = $$Pdest; # output file (dvi or pdf)4837 local $primary_out = $$Pdest; # output file (dvi or pdf)
4159 local %conversions = (); # (pdf)latex-performed conversions.4838 local %conversions = (); # (pdf)latex-performed conversions.
4160 # Maps output file created and read by (pdf)latex4839 # Maps output file created and read by (pdf)latex
@@ -4162,14 +4841,15 @@
4162 # The following are also returned, but are global, to be used by caller4841 # The following are also returned, but are global, to be used by caller
4163 # $reference_changed, $bad_reference $bad_citation4842 # $reference_changed, $bad_reference $bad_citation
41644843
4165 &parse_logB;4844 &parse_log;
4166 my $fls_file = "$root_filename.fls";4845 my $fls_file = "$aux_dir1$root_filename.fls";
4167 if ($recorder && test_gen_file($fls_file) ) {4846 if ($recorder && test_gen_file($fls_file) ) {
4168 parse_fls( $fls_file, \%source_fls, \%generated_fls );4847 parse_fls( $fls_file, \%source_fls, \%generated_fls, \%first_read_after_write );
4169 foreach (keys %source_fls) {4848 foreach (keys %source_fls) {
4170 $dependents{$_} = 4;4849 $dependents{$_} = 4;
4171 }4850 }
4172 foreach (keys %generated_fls) {4851 foreach (keys %generated_fls) {
4852 $_ = normalize_filename($_);
4173 rdb_add_generated( $_ );4853 rdb_add_generated( $_ );
4174 if ( exists($dependents{$_}) ) {4854 if ( exists($dependents{$_}) ) {
4175 $dependents{$_} = 6;4855 $dependents{$_} = 6;
@@ -4185,7 +4865,7 @@
4185 # missing input file might be correctable by a run of some4865 # missing input file might be correctable by a run of some
4186 # other program whose running is provoked AFTER a run of4866 # other program whose running is provoked AFTER a run of
4187 # (pdf)latex, we'll set a diagnostic and leave it to the4867 # (pdf)latex, we'll set a diagnostic and leave it to the
4188 # rdb_makeB to handle after all circular dependencies are4868 # rdb_make to handle after all circular dependencies are
4189 # resolved. 4869 # resolved.
4190 # 2. The output file might be of a different kind than expected4870 # 2. The output file might be of a different kind than expected
4191 # (i.e., dvi instead of pdf, or vv). This could4871 # (i.e., dvi instead of pdf, or vv). This could
@@ -4209,9 +4889,9 @@
4209 print "!!!===Creating rule '$from_rule': '$ind_file' from '$idx_file'\n"4889 print "!!!===Creating rule '$from_rule': '$ind_file' from '$idx_file'\n"
4210 if ($diagnostics);4890 if ($diagnostics);
4211 rdb_create_rule( $from_rule, 'external', $makeindex, '', 1, 4891 rdb_create_rule( $from_rule, 'external', $makeindex, '', 1,
4212 $idx_file, $ind_file, $ind_base, 1, 0);4892 $idx_file, $ind_file, $ind_base, 1, 0, 0 );
4213 print " ===Source file '$ind_file' for '$rule'\n"4893 print " ===Source file '$ind_file' for '$rule'\n"
4214 if ($diagnostics > -1);4894 if ($diagnostics);
4215 rdb_ensure_file( $rule, $ind_file, $from_rule );4895 rdb_ensure_file( $rule, $ind_file, $from_rule );
4216 }4896 }
4217 # Make sure the .ind file is treated as a detected source file;4897 # Make sure the .ind file is treated as a detected source file;
@@ -4255,11 +4935,11 @@
4255 print " ===Creating rule '$from_rule'\n" if ($diagnostics);4935 print " ===Creating rule '$from_rule'\n" if ($diagnostics);
4256 if ( $bib_program eq 'biber' ) {4936 if ( $bib_program eq 'biber' ) {
4257 rdb_create_rule( $from_rule, 'external', $biber, '', 1,4937 rdb_create_rule( $from_rule, 'external', $biber, '', 1,
4258 "$bbl_base.bcf", $bbl_file, $bbl_base, 1, 0);4938 "$bbl_base.bcf", $bbl_file, $bbl_base, 1, 0, 0 );
4259 }4939 }
4260 else {4940 else {
4261 rdb_create_rule( $from_rule, 'external', $bibtex, '', 1,4941 rdb_create_rule( $from_rule, 'external', $bibtex, 'run_bibtex', 1,
4262 "$bbl_base.aux", $bbl_file, $bbl_base, 1, 0);4942 "$bbl_base.aux", $bbl_file, $bbl_base, 1, 0, 0 );
4263 }4943 }
4264 }4944 }
4265 local %old_sources = ();4945 local %old_sources = ();
@@ -4331,7 +5011,7 @@
4331 }5011 }
4332 }5012 }
43335013
4334 my @more_sources = &rdb_set_dependentsA( $rule );5014 my @more_sources = &rdb_set_dependents( $rule );
4335 my $num_new = $#more_sources + 1;5015 my $num_new = $#more_sources + 1;
4336 foreach (@more_sources) { 5016 foreach (@more_sources) {
4337 $dependents{$_} = 4;5017 $dependents{$_} = 4;
@@ -4342,6 +5022,9 @@
4342 $$Pchanged = 1; # New files can be made. Ignore error.5022 $$Pchanged = 1; # New files can be made. Ignore error.
4343 }5023 }
4344 }5024 }
5025 foreach (keys %first_read_after_write) {
5026 delete $dependents{$_};
5027 }
4345 if ($diagnostics) {5028 if ($diagnostics) {
4346 if ($num_new > 0 ) {5029 if ($num_new > 0 ) {
4347 print "$num_new new source files for rule '$rule':\n";5030 print "$num_new new source files for rule '$rule':\n";
@@ -4350,6 +5033,13 @@
4350 else {5033 else {
4351 print "No new source files for rule '$rule':\n";5034 print "No new source files for rule '$rule':\n";
4352 }5035 }
5036 my @first_read_after_write = sort keys %first_read_after_write;
5037 if ($#first_read_after_write >= 0) {
5038 print "The following files were only read after being written:\n";
5039 foreach (@first_read_after_write) {
5040 print " '$_'\n";
5041 }
5042 }
4353 }5043 }
4354 my @files_not_needed = ();5044 my @files_not_needed = ();
4355 foreach (keys %$PHsource) { 5045 foreach (keys %$PHsource) {
@@ -4383,8 +5073,8 @@
43835073
4384#************************************************************5074#************************************************************
43855075
4386sub rdb_find_new_filesB {5076sub rdb_find_new_files {
4387 # Call: rdb_find_new_filesB5077 # Call: rdb_find_new_files
4388 # Assumes rule context for primary rule.5078 # Assumes rule context for primary rule.
4389 # Deal with files which were missing and for which a method5079 # Deal with files which were missing and for which a method
4390 # of finding them has become available:5080 # of finding them has become available:
@@ -4476,30 +5166,30 @@
4476 }5166 }
4477 }5167 }
4478 return $found;5168 return $found;
4479} # END rdb_find_new_filesB5169} # END rdb_find_new_files
44805170
4481#************************************************************5171#************************************************************
44825172
4483sub rdb_set_dependentsA {5173sub rdb_set_dependents {
4484 # Call rdb_set_dependentsA( rules ...)5174 # Call rdb_set_dependents( rules ...)
4485 # Returns array (sorted), of new source files.5175 # Returns array (sorted), of new source files.
4486 local @new_sources = ();5176 local @new_sources = ();
4487 local @deletions = ();5177 local @deletions = ();
44885178
4489# Shouldn't recurse. The definite rules to be examined are given.5179# Shouldn't recurse. The definite rules to be examined are given.
4490 rdb_for_some( [@_], 0, \&rdb_one_depA );5180 rdb_for_some( [@_], 0, \&rdb_one_dep );
4491# OLD rdb_recurseA( [@_], 0, \&rdb_one_depA );5181# OLD rdb_recurse( [@_], 0, \&rdb_one_dep );
4492 foreach (@deletions) {5182 foreach (@deletions) {
4493 my ($rule, $file) = @$_;5183 my ($rule, $file) = @$_;
4494 rdb_remove_files( $rule, $file );5184 rdb_remove_files( $rule, $file );
4495 }5185 }
4496 &rdb_make_links;5186 &rdb_make_links;
4497 return uniqs( @new_sources );5187 return uniqs( @new_sources );
4498} #END rdb_set_dependentsA5188} #END rdb_set_dependents
44995189
4500#************************************************************5190#************************************************************
45015191
4502sub rdb_one_depA {5192sub rdb_one_dep {
4503 # Helper for finding dependencies. One case, $rule and $file given5193 # Helper for finding dependencies. One case, $rule and $file given
4504 # Assume file (and rule) context for DESTINATION file.5194 # Assume file (and rule) context for DESTINATION file.
45055195
@@ -4508,7 +5198,7 @@
4508 if ( (! exists $possible_primaries{$rule}) && ($rule !~ /^cusdep/) ) {5198 if ( (! exists $possible_primaries{$rule}) && ($rule !~ /^cusdep/) ) {
4509 return;5199 return;
4510 }5200 }
4511#print "=============ONE_DEPA: '$rule' '$file'\n";5201#print "=============ONE_DEP: '$rule' '$file'\n";
4512 local $new_dest = $file;5202 local $new_dest = $file;
4513 my ($base_name, $path, $toext) = fileparseA( $new_dest );5203 my ($base_name, $path, $toext) = fileparseA( $new_dest );
4514 $base_name = $path.$base_name;5204 $base_name = $path.$base_name;
@@ -4580,7 +5270,7 @@
4580 local @PAnew_cmd = ( 'do_cusdep', $func_name );5270 local @PAnew_cmd = ( 'do_cusdep', $func_name );
4581 if (! rdb_rule_exists( $from_rule ) ) {5271 if (! rdb_rule_exists( $from_rule ) ) {
4582 rdb_create_rule( $from_rule, 'cusdep', '', \@PAnew_cmd, 3, 5272 rdb_create_rule( $from_rule, 'cusdep', '', \@PAnew_cmd, 3,
4583 $source, $new_dest, $base_name, 0);5273 $source, $new_dest, $base_name, 0 );
4584 }5274 }
4585 else {5275 else {
4586 rdb_one_rule( 5276 rdb_one_rule(
@@ -4600,10 +5290,9 @@
4600 # Try to make the missing file5290 # Try to make the missing file
4601 #Set character to surround filenames in commands:5291 #Set character to surround filenames in commands:
4602 my $q = $quote_filenames ? '"' : '';5292 my $q = $quote_filenames ? '"' : '';
4603 if ($rule =~ /^cusdep/ ) { traceback(); }
4604 if ( $toext ne '' ) {5293 if ( $toext ne '' ) {
4605 print "$My_name: '$rule': source file '$file' doesn't exist. I'll try making it...\n";5294 print "$My_name: '$rule': source file '$file' doesn't exist. I'll try making it...\n";
4606 &Run_msg( "$make $q$file$q" );5295 &Run_subst( "$make $q$file$q" );
4607 if ( -e $file ) {5296 if ( -e $file ) {
4608 return;5297 return;
4609 }5298 }
@@ -4613,7 +5302,7 @@
4613 " I'll try making it with allowed extensions \n";5302 " I'll try making it with allowed extensions \n";
4614 foreach my $try_ext ( keys %$Pinput_extensions ) {5303 foreach my $try_ext ( keys %$Pinput_extensions ) {
4615 my $new_dest = "$file.$try_ext";5304 my $new_dest = "$file.$try_ext";
4616 &Run_msg( "$make $q$new_dest$q" );5305 &Run_subst( "$make $q$new_dest$q" );
4617 if ( -e $new_dest ) {5306 if ( -e $new_dest ) {
4618 print "SUCCESS in making '$new_dest'\n";5307 print "SUCCESS in making '$new_dest'\n";
4619 # Put file in rule, without a from_rule, but5308 # Put file in rule, without a from_rule, but
@@ -4631,7 +5320,7 @@
4631 }5320 }
4632 }5321 }
4633 }5322 }
4634} #END rdb_one_depA5323} #END rdb_one_dep
46355324
4636#************************************************************5325#************************************************************
46375326
@@ -4688,13 +5377,24 @@
4688 delete $source{$_};5377 delete $source{$_};
4689 }5378 }
4690 foreach my $dest (@dest) {5379 foreach my $dest (@dest) {
4691 print $fh "$root_filename$dest :";5380 if ($deps_file eq '-' ) {
5381 print $fh "$root_filename$dest :";
5382 } else {
5383 print $fh "$root_filename$dest $deps_file :";
5384 }
4692 foreach (sort keys %source) {5385 foreach (sort keys %source) {
4693 print $fh "\\\n $_";5386 print $fh "\\\n $_";
4694 }5387 }
4695 print $fh "\n";5388 print $fh "\n";
4696 }5389 }
4697 print $fh "#===End dependents for $filename:\n";5390 print $fh "#===End dependents for $filename:\n";
5391 if ($dependents_phony) {
5392 print $fh "\n#===Phony rules for $filename:\n\n";
5393 foreach (sort keys %source) {
5394 print $fh "$_ :\n\n";
5395 }
5396 print $fh "#===End phony rules for $filename:\n";
5397 }
4698} #END deps_list5398} #END deps_list
46995399
4700#************************************************************5400#************************************************************
@@ -4726,7 +5426,7 @@
4726 # Call: rdb_accessible( rule, ...)5426 # Call: rdb_accessible( rule, ...)
4727 # Returns array of rules accessible from the given rules5427 # Returns array of rules accessible from the given rules
4728 local @accessible = ();5428 local @accessible = ();
4729 rdb_recurseA( [@_], sub{ push @accessible, $rule; } );5429 rdb_recurse( [@_], sub{ push @accessible, $rule; } );
4730 return @accessible;5430 return @accessible;
4731} #END rdb_accessible5431} #END rdb_accessible
47325432
@@ -4734,8 +5434,8 @@
4734#************************************************************5434#************************************************************
4735#************************************************************5435#************************************************************
47365436
4737sub rdb_makeB {5437sub rdb_make {
4738 # Call: rdb_makeB( target, ... )5438 # Call: rdb_make( target, ... )
4739 # Makes the targets and prerequisites. 5439 # Makes the targets and prerequisites.
4740 # Leaves one-time rules to last.5440 # Leaves one-time rules to last.
4741 # Does appropriate repeated makes to resolve dependency loops5441 # Does appropriate repeated makes to resolve dependency loops
@@ -4895,7 +5595,7 @@
4895 local $failure = 0; # General accumulated error flag5595 local $failure = 0; # General accumulated error flag
4896 local $missing_dvi_pdf = ''; # Did primary run fail to make its output file? 5596 local $missing_dvi_pdf = ''; # Did primary run fail to make its output file?
4897 local $runs = 0;5597 local $runs = 0;
4898 local $too_many_runs = 0;5598 local $too_many_passes = 0;
4899 local %rules_applied = ();5599 local %rules_applied = ();
4900 my $retry_msg = 0; # Did I earlier say I was going to attempt 5600 my $retry_msg = 0; # Did I earlier say I was going to attempt
4901 # another pass after a failure?5601 # another pass after a failure?
@@ -4906,6 +5606,7 @@
4906 }5606 }
4907 PASS:5607 PASS:
4908 while (1==1) {5608 while (1==1) {
5609 # Exit condition at end of body of loop.
4909 $runs = 0;5610 $runs = 0;
4910 my $previous_failure = $failure;5611 my $previous_failure = $failure;
4911 $failure = 0;5612 $failure = 0;
@@ -4916,25 +5617,20 @@
4916 if ($diagnostics) {5617 if ($diagnostics) {
4917 print "MakeB: doing pre_primary and primary...\n";5618 print "MakeB: doing pre_primary and primary...\n";
4918 }5619 }
4919 rdb_for_some( [@pre_primary, $primary], \&rdb_makeB1 );5620 # Do the primary run if it is needed. On return $runs == 0
4920 if ( ($runs > 0) && ! $too_many_runs ) {5621 # signals that nothing was run (and hence no output
4921 $retry_msg = 0;5622 # files changed), either because no input files
4922 if ( $failure && $newrule_nofile ) { 5623 # changed and no run was needed, or because the
4923 $retry_msg = 1;5624 # number of passes through the rule exceeded the
4924 print "$My_name: Error on run, but found possibility to ",5625 # limit. In the second case $too_many_runs is set.
4925 "make new source files\n";5626 rdb_for_some( [@pre_primary, $primary], \&rdb_make1 );
4926 next PASS;5627 if ( ($runs > 0) && ! $too_many_passes ) {
4927 }5628 next PASS;
4928 elsif ( $force_mode || (! $failure) ) {
4929 next PASS;
4930 }
4931 }5629 }
4932 elsif ($runs == 0) {5630 if ($runs == 0) {
4933 # $failure not set on this pass, so use value from previous pass:5631 # $failure not set on this pass, so use value from previous pass:
4934 $failure = $previous_failure;5632 $failure = $previous_failure;
4935 if ($retry_msg) {5633 if ($failure && !$force_mode ) { last PASS; }
4936 print "But in fact no new files made\n";
4937 }
4938 }5634 }
4939 if ( $missing_dvi_pdf ) { 5635 if ( $missing_dvi_pdf ) {
4940 # No output from primary, after completing circular dependence5636 # No output from primary, after completing circular dependence
@@ -4942,15 +5638,16 @@
4942 $failure = 1; 5638 $failure = 1;
4943 last PASS;5639 last PASS;
4944 } 5640 }
4945 if ($failure && !$force_mode ) { last PASS; }
4946 if ($diagnostics) {5641 if ($diagnostics) {
4947 print "MakeB: doing post_primary...\n";5642 print "MakeB: doing post_primary...\n";
4948 }5643 }
4949 rdb_for_some( [@post_primary], \&rdb_makeB1 );5644 rdb_for_some( [@post_primary], \&rdb_make1 );
4950 if ($failure) { last PASS; }5645 if ( ($runs == 0) || $too_many_passes ) {
4951 if ($runs > 0) { next PASS; }5646 # If $too_many_passes is set, it should also be that
4952 # Get here if nothing was run.5647 # $runs == 0; but for safety, I also checked
4953 last PASS;5648 # $too_many_passes.
5649 last PASS;
5650 }
4954 }5651 }
4955 continue {5652 continue {
4956 # Re-evaluate rule classification and accessibility,5653 # Re-evaluate rule classification and accessibility,
@@ -4962,18 +5659,11 @@
4962 &rdb_make_links;5659 &rdb_make_links;
4963 }5660 }
4964 }5661 }
4965 rdb_for_some( [@one_time], \&rdb_makeB1 );5662 rdb_for_some( [@one_time], \&rdb_make1 );
4966 rdb_write( $fdb_file );5663 rdb_write( $fdb_name );
49675664
4968 if (! $silent) { 5665 if (! $silent) {
4969 # Diagnose of the runs5666 if ($failure && $force_mode) {
4970 if ( $#{keys %rules_applied } > -1 ) {
4971 print "$My_name: $runs runs. Rules applied:\n";
4972 foreach (sort keys %rules_applied) {
4973 print " '$_'\n";
4974 }
4975 }
4976 elsif ($failure && $force_mode) {
4977 print "$My_name: Errors, in force_mode: so I tried finishing targets\n";5667 print "$My_name: Errors, in force_mode: so I tried finishing targets\n";
4978 }5668 }
4979 elsif ($failure) {5669 elsif ($failure) {
@@ -4986,43 +5676,54 @@
4986 }5676 }
4987 }5677 }
4988 return $failure;5678 return $failure;
4989} #END rdb_makeB5679} #END rdb_make
49905680
4991#-------------------5681#-------------------
49925682
4993sub rdb_show_rule_errors {5683sub rdb_show_rule_errors {
4994 local @messages = ();5684 local @errors = ();
5685 local @warnings = ();
4995 rdb_for_all( 5686 rdb_for_all(
4996 sub{5687 sub{
4997 if ($$Plast_message ne '') {5688 if ($$Plast_message ne '') {
4998 push @messages, "$rule: $$Plast_message";5689 if ($$Plast_result == 200) {
5690 push @warnings, "$rule: $$Plast_message";
5691 }
5692 else {
5693 push @errors, "$rule: $$Plast_message";
5694 }
4999 }5695 }
5000 elsif ($$Plast_result == 1) {5696 elsif ($$Plast_result == 1) {
5001 push @messages, "$rule: failed to create output file";5697 push @errors, "$rule: failed to create output file";
5002 }5698 }
5003 elsif ($$Plast_result == 2) {5699 elsif ($$Plast_result == 2) {
5004 push @messages, "$rule: gave an error";5700 push @errors, "$rule: gave an error";
5005 }5701 }
5006 elsif ($$Prun_time == 0) {5702 elsif ($$Prun_time == 0) {
5007# This can have innocuous causes. So don't report5703 # This can have innocuous causes. So don't report
5008# push @messages, "$rule: never run";
5009 }5704 }
5010 }5705 }
5011 );5706 );
5012 if ($#messages > -1) { 5707 if ($#warnings > -1) {
5708 warn "Collected warning summary (may duplicate other messages):\n";
5709 foreach (@warnings){
5710 warn " $_\n";
5711 }
5712 }
5713 if ($#errors > -1) {
5013 warn "Collected error summary (may duplicate other messages):\n";5714 warn "Collected error summary (may duplicate other messages):\n";
5014 foreach (@messages){5715 foreach (@errors){
5015 warn " $_\n";5716 warn " $_\n";
5016 }5717 }
5017 }5718 }
5018 return $#messages+1;5719 return $#errors+1;
5019}5720}
50205721
5021#-------------------5722#-------------------
50225723
5023sub rdb_makeB1 {5724sub rdb_make1 {
5024 # Call: rdb_makeB15725 # Call: rdb_make1
5025 # Helper routine for rdb_makeB.5726 # Helper routine for rdb_make.
5026 # Carries out make at level of given rule (all data available).5727 # Carries out make at level of given rule (all data available).
5027 # Assumes contexts for recursion, make, and rule, and5728 # Assumes contexts for recursion, make, and rule, and
5028 # assumes that source files for the rule are to be considered5729 # assumes that source files for the rule are to be considered
@@ -5081,8 +5782,15 @@
5081 # not run the rule, but not set an error condition.5782 # not run the rule, but not set an error condition.
5082 # Any error will arise at the (pdf)latex level due to a 5783 # Any error will arise at the (pdf)latex level due to a
5083 # missing source file at that level.5784 # missing source file at that level.
5084 if ( ( $$Pcmd_type eq 'cusdep') && $$Psource && (! -e $$Psource) ) {5785 if ( $$Psource && (! -e $$Psource)
5085 # No action5786# OLD && ( ( $$Pcmd_type eq 'cusdep') )
5787# NEW
5788 && ( ( $$Pcmd_type ne 'primary') )
5789 ) {
5790 # Main source file doesn't exist, and rule is NOT primary.
5791 # No action, since a run is pointless. Primary is different:
5792 # file might be found elsewhere (by kpsearch from (pdf)latex),
5793 # while non-existence of main source file is a clear error.
5086 }5794 }
5087 elsif ( $$Pcmd_type eq 'delegated' ) {5795 elsif ( $$Pcmd_type eq 'delegated' ) {
5088 # Delegate to destination rule5796 # Delegate to destination rule
@@ -5111,9 +5819,6 @@
5111 &rdb_diagnose_changes( "Rule '$rule': " );5819 &rdb_diagnose_changes( "Rule '$rule': " );
5112 }5820 }
51135821
5114 $rules_applied{$rule} = 1;
5115 $runs++;
5116
5117 # We are applying the rule, so its source file state for when it5822 # We are applying the rule, so its source file state for when it
5118 # was last made is as of now:5823 # was last made is as of now:
5119 # ??IS IT CORRECT TO DO NOTHING IN CURRENT VERSION?5824 # ??IS IT CORRECT TO DO NOTHING IN CURRENT VERSION?
@@ -5127,15 +5832,17 @@
5127 # Getting here represents some kind of weird error.5832 # Getting here represents some kind of weird error.
5128 warn "$My_name: Maximum runs of $rule reached ",5833 warn "$My_name: Maximum runs of $rule reached ",
5129 "without getting stable files\n";5834 "without getting stable files\n";
5130 warn " Use the -f option to force complete processing.\n"5835 $too_many_passes = 1;
5131 if (! $force_mode);
5132 $too_many_runs = 1;
5133 # Treat rule as completed, else in -pvc mode get infinite reruns:5836 # Treat rule as completed, else in -pvc mode get infinite reruns:
5134 $$Pout_of_date = 0;5837 $$Pout_of_date = 0;
5135 $failure = 1;5838 $failure = 1;
5136 $failure_msg = "'$rule' needed too many passes";5839 $failure_msg = "'$rule' needed too many passes";
5137 return;5840 return;
5138 }5841 }
5842
5843 $rules_applied{$rule} = 1;
5844 $runs++;
5845
5139 $pass{$rule}++; 5846 $pass{$rule}++;
5140 if ($bibtex_not_run > 0) {5847 if ($bibtex_not_run > 0) {
5141 if ($bibtex_not_run == 1 ) {5848 if ($bibtex_not_run == 1 ) {
@@ -5150,7 +5857,7 @@
5150 else {5857 else {
5151 warn_running( "Run number $pass{$rule} of rule '$rule'" );5858 warn_running( "Run number $pass{$rule} of rule '$rule'" );
5152 if ($$Pcmd_type eq 'primary' ) { 5859 if ($$Pcmd_type eq 'primary' ) {
5153 $return = &rdb_primary_run; 5860 $return = &rdb_primary_run;
5154 }5861 }
5155 else { $return = &rdb_run1; }5862 else { $return = &rdb_run1; }
5156 }5863 }
@@ -5180,14 +5887,18 @@
5180 # For a primary rule, i.e., (pdf)latex, not to produce the 5887 # For a primary rule, i.e., (pdf)latex, not to produce the
5181 # expected output file may not be an error condition. 5888 # expected output file may not be an error condition.
5182 # Diagnostics were handled in parsing the log file.5889 # Diagnostics were handled in parsing the log file.
5183 # Special action in main loop inrdb_makeB15890 # Special action in main loop in rdb_make
5184 $missing_dvi_pdf = $$Pdest;5891 $missing_dvi_pdf = $$Pdest;
5185 }5892 }
5893 elsif ($return == -2) {
5894 # Missing output file was reported to be NOT an error
5895 $$Pout_of_date = 0;
5896 }
5186 else {5897 else {
5187 $failure = 1;5898 $failure = 1;
5188 }5899 }
5189 }5900 }
5190 if ($return != 0) {5901 if ( ($return != 0) && ($return != -2) ) {
5191 $failure = 1; 5902 $failure = 1;
5192 $$Plast_result = 2;5903 $$Plast_result = 2;
5193 if ( !$$Plast_message ) {5904 if ( !$$Plast_message ) {
@@ -5196,24 +5907,22 @@
5196# !!?? $failure_msg = $$Plast_message;5907# !!?? $failure_msg = $$Plast_message;
5197 5908
5198 }5909 }
5199} #END rdb_makeB15910} #END rdb_make1
52005911
5201#************************************************************5912#************************************************************
52025913
5203sub rdb_submakeB {5914#??sub rdb_submake {
5204 # Call: rdb_submakeB5915#?? # Call: rdb_submake
5205 # Makes all the source files for a given rule.5916#?? # Makes all the source files for a given rule.
5206 # Assumes contexts for recursion, for make, and rule.5917#?? # Assumes contexts for recursion, for make, and rule.
5207 %visited = %visited_at_rule_start;5918#?? %visited = %visited_at_rule_start;
5208 local $failure = 0; # Error flag5919#?? local $failure = 0; # Error flag
5209 my @v = keys %visited;5920#?? my @v = keys %visited;
5210#?? print "---submakeB $rule. @v \n";5921#?? rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_make1 ) } );
5211 rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_makeB1 ) } );5922#?? return $failure;
5212 return $failure;5923#??} #END rdb_submake
5213} #END rdb_submakeB5924
52145925#************************************************************
5215#************************************************************
5216
52175926
5218sub rdb_classify_rules {5927sub rdb_classify_rules {
5219 # Usage: rdb_classify_rules( \%allowed_primaries, requested targets )5928 # Usage: rdb_classify_rules( \%allowed_primaries, requested targets )
@@ -5238,7 +5947,7 @@
5238 @post_primary = ();5947 @post_primary = ();
5239 @one_time = ();5948 @one_time = ();
52405949
5241 rdb_recurseA( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );5950 rdb_recurse( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );
52425951
5243 # Reverse, as tendency is to find last rules first.5952 # Reverse, as tendency is to find last rules first.
5244 @pre_primary = reverse @pre_primary;5953 @pre_primary = reverse @pre_primary;
@@ -5327,11 +6036,13 @@
5327 # Assumes contexts for: rule.6036 # Assumes contexts for: rule.
5328 # Unconditionally apply the rule6037 # Unconditionally apply the rule
5329 # Returns return code from applying the rule.6038 # Returns return code from applying the rule.
5330 # Otherwise: 0 on other kind of success, -1 on error.6039 # Otherwise: 0 on other kind of success,
6040 # -1 on error,
6041 # -2 when missing dest_file is to be ignored
53316042
5332 # Source file data, by definition, correspond to the file state just before 6043 # Source file data, by definition, correspond to the file state just
5333 # the latest run, and the run_time to the time just before the run:6044 # before the latest run, and the run_time to the time just before the run:
5334 &rdb_update_filesA;6045 &rdb_update_files;
5335 $$Prun_time = time;6046 $$Prun_time = time;
5336 $$Pchanged = 0; # No special changes in files6047 $$Pchanged = 0; # No special changes in files
5337 $$Plast_result = 0;6048 $$Plast_result = 0;
@@ -5352,7 +6063,7 @@
5352 $return = &$int_cmd( @int_args ); 6063 $return = &$int_cmd( @int_args );
5353 }6064 }
5354 elsif ($$Pext_cmd) {6065 elsif ($$Pext_cmd) {
5355 $return = &rdb_ext_cmd;6066 $return = &Run_subst();
5356 }6067 }
5357 else {6068 else {
5358 warn "$My_name: Either a bug OR a configuration error:\n",6069 warn "$My_name: Either a bug OR a configuration error:\n",
@@ -5363,8 +6074,35 @@
5363 $$Plast_message = "Bug or configuration error; incorrect command type";6074 $$Plast_message = "Bug or configuration error; incorrect command type";
5364 }6075 }
5365 if ( $rule =~ /^biber/ ) {6076 if ( $rule =~ /^biber/ ) {
5366 my $retcode = check_biber_log($$Pbase);6077 my @biber_source = ( );
5367 if ($retcode == 3) {6078 my $retcode = check_biber_log( $$Pbase, \@biber_source );
6079 foreach my $source ( @biber_source ) {
6080 print " === Source file '$source' for '$rule'\n"
6081 if ($diagnostics);
6082 rdb_ensure_file( $rule, $source );
6083 }
6084 if ($retcode == 5) {
6085 # Special treatment if sole missing file is bib file
6086 # I don't want to treat that as an error
6087 $return = 0;
6088 $$Plast_result = 200;
6089 $$Plast_message = "Could not find bib file for '$$Pbase'";
6090 push @warnings, "Bib file not found for '$$Pbase'";
6091 }
6092 elsif ($retcode == 6) {
6093 # Missing control file. Need to remake it (if possible)
6094 # Don't treat missing bbl file as error.
6095 warn "$My_name: bibtex control file missing. Since that can\n",
6096 " be recreated, I'll try to do so.\n";
6097 $return = -2;
6098 rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
6099 }
6100 elsif ($retcode == 4) {
6101 $$Plast_result = 2;
6102 $$Plast_message = "Could not find all biber source files for '$$Pbase'";
6103 push @warnings, "Not all biber source files found for '$$Pbase'";
6104 }
6105 elsif ($retcode == 3) {
5368 $$Plast_result = 2;6106 $$Plast_result = 2;
5369 $$Plast_message = "Could not open biber log file for '$$Pbase'";6107 $$Plast_message = "Could not open biber log file for '$$Pbase'";
5370 push @warnings, $$Plast_message;6108 push @warnings, $$Plast_message;
@@ -5378,13 +6116,16 @@
5378 }6116 }
5379 elsif ($retcode == 10) {6117 elsif ($retcode == 10) {
5380 push @warnings, "Biber found no citations for '$$Pbase'";6118 push @warnings, "Biber found no citations for '$$Pbase'";
5381 # Biber doesn't generate a bbl file in this situation. So I cannot6119 # Biber doesn't generate a bbl file in this situation.
5382 # ignore the error the way I do with bibtex.6120 $return = -2;
5383 #$return = 0;
5384 }6121 }
5385 }6122 }
5386 if ( $rule =~ /^bibtex/ ) {6123 if ( $rule =~ /^bibtex/ ) {
5387 my $retcode = check_bibtex_log($$Pbase);6124 my $retcode = check_bibtex_log($$Pbase);
6125 if ( ! -e $$Psource ) {
6126 $retcode = 10;
6127 rdb_for_some( [keys %current_primaries], sub{ $$Pout_of_date = 1; } );
6128 }
5388 if ($retcode == 3) {6129 if ($retcode == 3) {
5389 $$Plast_result = 2;6130 $$Plast_result = 2;
5390 $$Plast_message = "Could not open bibtex log file for '$$Pbase'";6131 $$Plast_message = "Could not open bibtex log file for '$$Pbase'";
@@ -5392,15 +6133,23 @@
5392 }6133 }
5393 elsif ($retcode == 2) {6134 elsif ($retcode == 2) {
5394 $$Plast_message = "Bibtex errors: See file '$$Pbase.blg'";6135 $$Plast_message = "Bibtex errors: See file '$$Pbase.blg'";
6136 $failure = 1;
5395 push @warnings, $$Plast_message;6137 push @warnings, $$Plast_message;
5396 }6138 }
5397 elsif ($retcode == 1) {6139 elsif ($retcode == 1) {
5398 push @warnings, "Bibtex warnings for '$$Pbase'";6140 push @warnings, "Bibtex warnings for '$$Pbase'";
5399 }6141 }
5400 elsif ($retcode == 10) {6142 elsif ($retcode == 10) {
5401 push @warnings, "Bibtex found no citations for '$$Pbase'";6143 push @warnings, "Bibtex found no citations for '$$Pbase',\n",
5402 # But this is an innocuous error, so fix return code6144 " or bibtex found a missing aux file\n";
5403 $return = 0;6145 if (! -e $$Pdest ) {
6146 warn "$My_name: Bibtex did not produce '$$Pdest'. But that\n",
6147 " was because of missing files, so I will continue.\n";
6148 $return = -2;
6149 }
6150 else {
6151 $return = 0;
6152 }
5404 }6153 }
5405 }6154 }
54066155
@@ -5412,16 +6161,15 @@
5412 }6161 }
5413 $$Pout_of_date = $$Pout_of_date_user = 0;6162 $$Pout_of_date = $$Pout_of_date_user = 0;
54146163
5415 if ( ($$Plast_result == 0) && ($return != 0) ) {6164 if ( ($$Plast_result == 0) && ($return != 0) && ($return != -2) ) {
5416 $$Plast_result = 2;6165 $$Plast_result = 2;
5417 if ($$Plast_message eq '') {6166 if ($$Plast_message eq '') {
5418 $$Plast_message = "Command for '$rule' gave return code $return";6167 $$Plast_message = "Command for '$rule' gave return code $return";
5419 }6168 }
5420 }6169 }
5421 elsif ( $$Pdest && (! -e $$Pdest) ) {6170 elsif ( $$Pdest && (! -e $$Pdest) && ($return != -2) ) {
5422 $$Plast_result = 1;6171 $$Plast_result = 1;
5423 }6172 }
5424
5425 return $return;6173 return $return;
5426} # END rdb_run16174} # END rdb_run1
54276175
@@ -5435,7 +6183,7 @@
54356183
5436 # Source file data, by definition, correspond to the file state just before 6184 # Source file data, by definition, correspond to the file state just before
5437 # the latest run, and the run_time to the time just before the run:6185 # the latest run, and the run_time to the time just before the run:
5438 &rdb_update_filesA;6186 &rdb_update_files;
5439 $$Prun_time = time;6187 $$Prun_time = time;
5440 $$Pchanged = 0; # No special changes in files6188 $$Pchanged = 0; # No special changes in files
5441 $$Plast_result = 0;6189 $$Plast_result = 0;
@@ -5453,41 +6201,59 @@
54536201
5454#-----------------6202#-----------------
54556203
5456sub rdb_ext_cmd {
5457 # Call: rdb_ext_cmd
5458 # Assumes rule context. Runs external command with substitutions.
5459 # Uses defaults for the substitutions. See rdb_ext_cmd1.
5460 return rdb_ext_cmd1();
5461} #END rdb_ext_cmd
5462
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches