带有词汇表和输出目录的 Overleaf latexmk

带有词汇表和输出目录的 Overleaf latexmk

我下载了 Overleaf 文件latexmkrc自动创建词汇表并保持项目功能的标准化。在运行命令时,此 latexmkrc 在我的本地计算机上具有子目录层次结构,可完美运行:

latexmk -pdf  main.tex

但是,此命令会用中间文件污染根目录和所有子目录。当我使用命令

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.
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.

我应该使用 latexmk 中的哪些标志来使这个 latexmkrc 文件工作?重现此错误的最小示例是这里

答案1

问题在于,Overleaf 中用于处理词汇表的代码latexmkrc是旧版本,在使用输出目录时无法工作。可以在当前 latexmk 发行版中glossaries_latexmkrc的文件中找到可以工作的代码。example_rcfiles

需要进行的具体更正是在中更改以下代码latexmkrc

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

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; 
}

这还包括一行添加到配置变量$clean_ext项中,当 latexmk 对生成的文件进行清理操作时,该行会将词汇表生成的文件添加到要删除的文件列表中。

相关内容