summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexmk/example_rcfiles/minted_latexmkrc
blob: 076c7fc15bd9aeb83fa56e6c7a541528cddcbc34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# For the minted package (which does nice formatting of source code):
#
# 1. Need to use -shell-escape on *latex command.
# 2. Need to arrange passing of the output dir (actually aux dir if it
#    differs from out dir) to minted.  Then this directory information does
#    not have to be specified  in the .tex file itself.
# 3. In some cases, latexmk does an extra run of *latex than is
#    needed.  This is solved by getting latexmk to ignore certain lines in
#    the aux file when latexmk looks for changes.  These lines are written
#    by minted and are irrelevant to the output file from *latex.
#
#    The reason for the extra run of *latex that may happen is because
#    after minted runs pygmentize to make the nicely formatted source code,
#    minted saves cached information about the run(s) of pygmentize. This
#    information is  put in the aux file. So latexmk sees the changed aux
#    file, and knows that may affect the output of *latex, which it
#    therefore reruns. However the minted-written lines do not affect the
#    output of *latex.
#
# The method works if the aux dir's name contains a string of MORE than one 
# space That's a problem in minted's calls to pygmentize.
# Single spaces in the name are OK.
# Generally it helps to  use only aux_dir and out_dir names  without spaces,
# to avoid trouble. 

&set_tex_cmds( '-shell-escape %O '
        . '\'\PassOptionsToPackage{outputdir={%Y}}{minted}\input{%S}\''
        );
# (Here the outer level of single quotes is for Perl.  The dot is for
# Perl's string concatenation. The \' tell Perl to put actual single
# quotes in the string (given to the shell).  In Unix, the shell is sh (or
# equivalent), so the string inside the single quotes is a single argument
# to the command is not changed at all.) 
#
$hash_calc_ignore_pattern{aux} = '^\\\\gdef\\\\minted@oldcachelist\{,'.
                                 '|^\s*default\.pygstyle,'.
                                 '|^\s*[[:xdigit:]]+\.pygtex';