3

I downloaded the Overleaf file latexmkrc to automate the creation of glossaries and maintain the standardization of the functioning of my projects. This latexmkrc works perfectly on my local machine with subdirectory hierarchy when running command:

latexmk -pdf  main.tex

However, this command pollutes the root directory and all subdirectories with intermediate files. And when I use the command

latexmk -pdf -output-directory=out main.tex

I get a compilation error

Rc files read:
  /etc/LatexMk
  latexmkrc
Latexmk: This is Latexmk, John Collins, 4 Apr. 2023. Version 4.80.
No existing .aux file, so I'll make a simple one, and require run of *latex.
------------
Running 'internal overleaf_pre_process "main.tex" "main.pdf"'
------------
Latexmk: calling overleaf_pre_process( "main.tex" "main.pdf" )
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex':  Reasons for rerun
Category 'other':
  Rerun of 'pdflatex' forced or previously required

------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -recorder  "main.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-01-16>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/base/glossaries.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/share/texlive/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
(/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/share/texlive/texmf-dist/tex/latex/xfor/xfor.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/substr/substr.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-fp.sty
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/share/texlive/texmf-dist/tex/latex/fp/defpattern.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-basic.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-addons.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-snap.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-exp.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-trigo.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-pas.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-random.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eqn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eval.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.st
y) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty
) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty
(/usr/share/texlive/texmf-dist/tex/latex/supertabular/supertabular.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./main.aux) (./Sections/section1.tex) [1{/var/lib/texmf/fonts/map/pdftex/updma
p/pdftex.map}]
No file main.acr.
[2] (./main.aux) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm
/cmbx12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10
.pfb>
Output written on main.pdf (2 pages, 27285 bytes).
Transcript written on main.log.
Latexmk: Getting log file 'main.log'
Latexmk: Examining 'main.fls'
Latexmk: Examining 'main.log'
Latexmk: Missing input file 'main.acr' (or dependence on it) from following:
  No file main.acr.
Latexmk: Log file says output to 'main.pdf'
Latexmk: applying rule 'cusdep acn acr main'...
Rule 'cusdep acn acr main':  Reasons for rerun
Changed files or newly in use/created:
  main.acn
Category 'no_dest':
  cusdep acn acr main

------------
Run number 1 of rule 'cusdep acn acr main'
------------
makeglossaries version 4.51 (2022-11-02)
added glossary type 'main' (glg,gls,glo)
added glossary type 'acronym' (alg,acr,acn)
makeindex  -s "main.ist" -t "main.alg" -o "main.acr" "main.acn"
This is makeindex, version 2.16 [TeX Live 2022] (kpathsea + Thai support).
Scanning style file ./main.ist...........................done (27 attributes redefined, 0 ignored).
Scanning input file main.acn....done (3 entries accepted, 0 rejected).
Sorting entries....done (4 comparisons).
Generating output file main.acr....done (9 lines written, 0 warnings).
Output written in main.acr.
Transcript written in main.alg.
Warning: File 'main.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if you
don't want to use the main glossary.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex':  Reasons for rerun
Changed files or newly in use/created:
  main.acr
  main.aux

------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -recorder  "main.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-01-16>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/base/glossaries.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/share/texlive/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
(/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/share/texlive/texmf-dist/tex/latex/xfor/xfor.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/substr/substr.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-fp.sty
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/share/texlive/texmf-dist/tex/latex/fp/defpattern.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-basic.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-addons.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-snap.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-exp.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-trigo.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-pas.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-random.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eqn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eval.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.st
y) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty
) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty
(/usr/share/texlive/texmf-dist/tex/latex/supertabular/supertabular.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./main.aux) (./Sections/section1.tex) [1{/var/lib/texmf/fonts/map/pdftex/updma
p/pdftex.map}] (./main.acr) [2] (./main.aux) )</usr/share/texlive/texmf-dist/fo
nts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/texmf-dist/fonts/ty
pe1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/texmf-dist/fonts/type1/pu
blic/amsfonts/cm/cmr10.pfb>
Output written on main.pdf (2 pages, 38653 bytes).
Transcript written on main.log.
Latexmk: Getting log file 'main.log'
Latexmk: Examining 'main.fls'
Latexmk: Examining 'main.log'
Latexmk: Log file says output to 'main.pdf'
Latexmk: All targets () are up-to-date
------------
Running 'internal overleaf_post_process "main.tex" "main.pdf"'
------------
Latexmk: calling overleaf_post_process( "main.tex" "main.pdf" )

(base) ➜  Another Glossary example latexmk -pdf -output-directory=out main.tex
Rc files read:
  /etc/LatexMk
  latexmkrc
Latexmk: This is Latexmk, John Collins, 4 Apr. 2023. Version 4.80.
Latexmk: making output directory 'out'
No existing .aux file, so I'll make a simple one, and require run of *latex.
------------
Running 'internal overleaf_pre_process "main.tex" "out/main.pdf"'
------------
Latexmk: calling overleaf_pre_process( "main.tex" "out/main.pdf" )
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex':  Reasons for rerun
Category 'other':
  Rerun of 'pdflatex' forced or previously required

------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -recorder -output-directory="out"  "main.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-01-16>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/base/glossaries.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/share/texlive/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
(/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/share/texlive/texmf-dist/tex/latex/xfor/xfor.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/substr/substr.sty)
(/usr/share/texlive/texmf-dist/tex/latex/datatool/datatool-fp.sty
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/share/texlive/texmf-dist/tex/latex/fp/defpattern.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-basic.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-addons.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-snap.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-exp.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-trigo.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-pas.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-random.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eqn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fp/fp-eval.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.st
y) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty
) (/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty
(/usr/share/texlive/texmf-dist/tex/latex/supertabular/supertabular.sty))
(/usr/share/texlive/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(out/main.aux) (./Sections/section1.tex) [1{/var/lib/texmf/fonts/map/pdftex/upd
map/pdftex.map}]
No file main.acr.
[2] (out/main.aux) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/
cm/cmbx12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr
10.pfb>
Output written on out/main.pdf (2 pages, 27285 bytes).
Transcript written on out/main.log.
Latexmk: Getting log file 'out/main.log'
Latexmk: Examining 'out/main.fls'
Latexmk: Examining 'out/main.log'
Latexmk: Missing input file 'main.acr' (or dependence on it) from following:
  No file main.acr.
Latexmk: Log file says output to 'out/main.pdf'
Latexmk: applying rule 'cusdep acn acr out/main'...
Rule 'cusdep acn acr out/main':  Reasons for rerun
Changed files or newly in use/created:
  out/main.acn
Category 'no_dest':
  cusdep acn acr out/main

------------
Run number 1 of rule 'cusdep acn acr out/main'
------------
makeglossaries version 4.51 (2022-11-02)
added glossary type 'main' (glg,gls,glo)
added glossary type 'acronym' (alg,acr,acn)
makeindex  -s "main.ist" -t "out/main.alg" -o "out/main.acr" "out/main.acn"
Index style file main.ist not found.
Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]

***Call to makeindex failed***

Possible cause of problem:

Style file not found. (Have you used \noist by mistake?)

Exit status: 3. Check 'out/main.alg' for details
Rule 'cusdep acn acr out/main', function 'glo2gls'
   failed with return code = 6400
Latexmk: Errors, so I did not complete making targets
------------
Running 'internal overleaf_post_process "main.tex" "out/main.pdf"'
------------
Latexmk: calling overleaf_post_process( "main.tex" "out/main.pdf" )
Collected error summary (may duplicate other messages):
  cusdep acn acr out/main: Command for 'cusdep acn acr out/main' gave return code 6400

Latexmk: If appropriate, the -f option can be used to get latexmk
  to try to force complete processing.

which flags in latexmk should I use to make this latexmkrc file work? the minimal example to reproduce this error is here

2
  • Do yourself a favour and don't use an output directory. This causes problems with many other tools besides glossaries. Commented Jul 1, 2023 at 19:08
  • @samcarter: Latexmk overcomes the complications in using an output directory. Many of us very much prefer to have the main document directory not polluted by lots of generated files. Commented Jul 1, 2023 at 19:46

1 Answer 1

5

The problem is that the code in Overleaf's latexmkrc for dealing with glossaries is an old version that doesn't work when an output directory is used. Code that does work is to be found in the glossaries_latexmkrc file in the example_rcfiles in the current latexmk distribution.

The specific correction to be made is to change the following code in latexmkrc:

add_cus_dep( 'glo', 'gls', 0, 'glo2gls' );
add_cus_dep( 'acn', 'acr', 0, 'glo2gls');  # from Overleaf v1
sub glo2gls {
    system("makeglossaries $_[0]");
}

to

add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
$clean_ext .= " acr acn alg glo gls glg";

sub makeglossaries {
    my ($base_name, $path) = fileparse( $_[0] );
    my @args = ( "-q", "-d", $path, $base_name );
    if ($silent) { unshift @args, "-q"; }
    return system "makeglossaries", "-d", $path, $base_name; 
}

This also includes a line to add to the configuration variable $clean_ext items that will add glossaries-generated files to the list of files to be deleted when latexmk does a clean up operation of generated files.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .