diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-20 22:01:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-20 22:01:59 +0000 |
commit | 16db2735dd5c2cd2aa72643ed707730eb62e5bb1 (patch) | |
tree | 009a21f673192e806c3b4143d9ab932e371b5620 /Master/texmf-dist/doc/support/latexmk/example_rcfiles | |
parent | 21337afd777f807a4932c5b0a106798dcfd9d626 (diff) |
latexmk (20nov17)
git-svn-id: svn://tug.org/texlive/trunk@45867 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/latexmk/example_rcfiles')
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc | 35 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc | 32 |
2 files changed, 64 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc new file mode 100644 index 00000000000..53f13ff30a7 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc @@ -0,0 +1,35 @@ +# Implementing glossary with bib2gls and glossaries-extra, with the +# log file (.glg) analyzed to get dependence on a .bib file. + +# !!! ONLY WORKS WITH VERSION 4.54 or higher of latexmk + +push @generated_exts, 'glstex', 'glg'; + +add_cus_dep('aux', 'glstex', 0, 'run_bib2gls'); + +sub run_bib2gls { + if ( $silent ) { + my $ret = system "bib2gls --silent --group '$_[0]'"; + } else { + my $ret = system "bib2gls --group '$_[0]'"; + }; + + my ($base, $path) = fileparse( $_[0] ); + if ($path && -e "$base.glstex") { + rename "$base.glstex", "$path$base.glstex"; + } + + # Analyze log file. + local *LOG; + $LOG = "$_[0].glg"; + if (!$ret && -e $LOG) { + open LOG, "<$LOG"; + while (<LOG>) { + if (/^Reading (.*\.bib)\s$/) { + rdb_ensure_file( $rule, $1 ); + } + } + close LOG; + } + return $ret; +} diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc index 937df6f9e71..203a0a3fe72 100644 --- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc +++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc @@ -31,6 +31,32 @@ sub makeacr2acn { add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); sub makeglossaries { - system( "makeglossaries \"$_[0]\"" ); - } - + my ($base_name, $path) = fileparse( $_[0] ); + pushd $path; + my $return = system "makeglossaries $base_name"; + popd; + return $return; + } + +# This code works around a problem with makeglossaries when the +# -output-directory option of latexmk is used. When makeglossaries is +# called with a filename that has a directory in it, e.g., +# +# makeglossaries output/document +# +# the makeindex or xindy commmands look for a document.ist or +# document.xdy file that is created by the glossaries package. The +# file is correctly created in the output/ directory, but the +# makeindex or xindy commands are called in way that they look for +# that file in the document directory, not in the output directory. +# So the above definition of a subroutine makeglossaries works around +# that. +# +# Note that the 3rd definition of a custom dependency, the one that +# invokes the makeglossaries script, has the advantage that it can +# change automatically to use the xindy program instead of makeindex, +# according to the setting by which the glossaries package is invoked +# in the document. The first two solutions I gave for the custom +# dependency have the choice of makeindex hard-coded (which can be +# changed, of course). Automatic switching would need a more +# complicated solution. |