在子目录中的 bibtex 上使用 arara

在子目录中的 bibtex 上使用 arara

我想使用 arara 自动创建 bibfile。但是,我遇到了一些麻烦。

我的文件夹结构如下:

dissertation.tex
chapter1/chapter1.tex
chapter1/chapter1.bib
chapter2/chapter2.tex
chapter2/chapter2.bib
etc.

文件 dissertation.tex 导入了所有章节。当我在命令行上运行以下命令时:

xelatex dissertation.tex
bibtex chapter1/chapter1
bibtex chapter2/chapter2
xelatex dissertation.tex
xelatex dissertation.tex

我得到了正确的输出。我想我会用 arara 自动化这个过程。在 dissertation.tex 的标题中我输入了:

% arara: xelatex: {synctex: yes}
% arara: bibtex: { files: [ chapter1/chapter1, chapter2/chapter2] }
% arara: xelatex: {synctex: yes}
% arara: xelatex: {synctex: yes}

但是遗憾的是,当我以详细方式运行 arara 时,我看到 Bibtex 报告:

I couldn't open file name `chapter1.aux'

尽管我看到文件在那里。否则,arara 工作正常,但所有引用都被跳过了。我仔细检查了一下,如果我手动执行所有命令,我会得到正确的结果。

所以 Bibtex 可能在错误的目录中启动了?还是我使用“文件”的方式不对?我在 arara 文档中找不到如何使用“文件”。如能得到任何帮助我将不胜感激。

相关的 arara 日志文件行如下:

23 okt 2020 10:17:34.287 INFO  - Welcome to arara 5.1.3!
23 okt 2020 10:17:34.295 INFO  - -----------------------------------------------------------------
23 okt 2020 10:17:34.296 DEBUG - ::: arara @ C:\Users\Tommi\AppData\Local\Programs\MiKTeX 2.9\scripts\arara
23 okt 2020 10:17:34.296 DEBUG - ::: Java 1.8.0_251, Oracle Corporation
23 okt 2020 10:17:34.296 DEBUG - ::: C:\Program Files\Java\jre1.8.0_251
23 okt 2020 10:17:34.296 DEBUG - ::: Windows 10, amd64, 10.0
23 okt 2020 10:17:34.296 DEBUG - ::: user.home @ C:\Users\Tommi
23 okt 2020 10:17:34.297 DEBUG - ::: CF @ [none]
23 okt 2020 10:17:34.297 DEBUG - -----------------------------------------------------------------
23 okt 2020 10:17:34.297 INFO  - Processing 'dissertation.tex' (size: 3.1 kB, last modified: 10/22/2020 20:55:54), please wait.
23 okt 2020 10:17:34.331 INFO  - I found a potential pattern in line 1: xelatex: {synctex: yes}
23 okt 2020 10:17:34.331 INFO  - I found a potential pattern in line 3: bibtex: { files: [ chapter-open-problem\paper, chapter-PNAS\PNAS2arXiv, chapter-NEURIPS\arXiv ] }
23 okt 2020 10:17:34.332 INFO  - I found a potential pattern in line 4: xelatex: {synctex: yes}
23 okt 2020 10:17:34.332 INFO  - I found a potential pattern in line 5: xelatex: {synctex: yes}
23 okt 2020 10:17:34.476 INFO  - I found a potential directive: Directive(identifier=xelatex, parameters={synctex=true}, conditional={ NONE }, lineNumbers=[1])
23 okt 2020 10:17:34.481 INFO  - I found a potential directive: Directive(identifier=bibtex, parameters={files=[chapter-open-problem\paper, chapter-PNAS\PNAS2arXiv, chapter-NEURIPS\arXiv]}, conditional={ NONE }, lineNumbers=[3])
23 okt 2020 10:17:34.483 INFO  - I found a potential directive: Directive(identifier=xelatex, parameters={synctex=true}, conditional={ NONE }, lineNumbers=[4])
23 okt 2020 10:17:34.484 INFO  - I found a potential directive: Directive(identifier=xelatex, parameters={synctex=true}, conditional={ NONE }, lineNumbers=[5])
23 okt 2020 10:17:34.489 INFO  - All directives were validated. We are good to go.
23 okt 2020 10:17:34.490 INFO  - -------------------------- DIRECTIVES ---------------------------
23 okt 2020 10:17:34.490 INFO  - Directive(identifier=xelatex, parameters={synctex=true, reference=C:\Users\Tommi\Projects\dissertation\dissertation.tex}, conditional={ NONE }, lineNumbers=[1])
23 okt 2020 10:17:34.491 INFO  - Directive(identifier=bibtex, parameters={reference=C:\Users\Tommi\Projects\dissertation\chapter-open-problem\paper}, conditional={ NONE }, lineNumbers=[3])
23 okt 2020 10:17:34.491 INFO  - Directive(identifier=bibtex, parameters={reference=C:\Users\Tommi\Projects\dissertation\chapter-PNAS\PNAS2arXiv}, conditional={ NONE }, lineNumbers=[3])
23 okt 2020 10:17:34.491 INFO  - Directive(identifier=bibtex, parameters={reference=C:\Users\Tommi\Projects\dissertation\chapter-NEURIPS\arXiv}, conditional={ NONE }, lineNumbers=[3])
23 okt 2020 10:17:34.491 INFO  - Directive(identifier=xelatex, parameters={synctex=true, reference=C:\Users\Tommi\Projects\dissertation\dissertation.tex}, conditional={ NONE }, lineNumbers=[4])
23 okt 2020 10:17:34.491 INFO  - Directive(identifier=xelatex, parameters={synctex=true, reference=C:\Users\Tommi\Projects\dissertation\dissertation.tex}, conditional={ NONE }, lineNumbers=[5])
23 okt 2020 10:17:34.491 INFO  - -----------------------------------------------------------------
23 okt 2020 10:17:34.494 INFO  - I am ready to interpret rule 'xelatex'.
23 okt 2020 10:17:34.497 INFO  - Rule location: 'C:\Users\Tommi\AppData\Local\Programs\MiKTeX 2.9\scripts\arara\rules'
23 okt 2020 10:17:35.198 INFO  - I am ready to interpret task 'XeLaTeX engine' from rule 'XeLaTeX'.
23 okt 2020 10:17:35.199 INFO  - System command: [ xelatex, --synctex=1, dissertation.tex ] @ 
23 okt 2020 10:17:51.425 INFO  - ---------------------- BEGIN OUTPUT BUFFER ----------------------
23 okt 2020 10:17:51.427 INFO  - This is XeTeX, Version 3.14159265-2.6-0.999991 (MiKTeX 2.9.7250 64-bit)
... some XeTEX output ...

23 okt 2020 10:17:51.428 INFO  - ----------------------- END OUTPUT BUFFER -----------------------
23 okt 2020 10:17:51.432 INFO  - Task result: SUCCESS
23 okt 2020 10:17:51.435 INFO  - I am ready to interpret rule 'bibtex'.
23 okt 2020 10:17:51.437 INFO  - Rule location: 'C:\Users\Tommi\AppData\Local\Programs\MiKTeX 2.9\scripts\arara\rules'
23 okt 2020 10:17:51.454 INFO  - I am ready to interpret task 'The BibTeX reference management software' from rule 'BibTeX'.
23 okt 2020 10:17:51.462 INFO  - System command: [ bibtex, paper ] @ 
23 okt 2020 10:17:52.276 INFO  - ---------------------- BEGIN OUTPUT BUFFER ----------------------
23 okt 2020 10:17:52.276 INFO  - I couldn't open file name `paper.aux'

答案1

您使用的方法是正确的。我们可以检查您文件中的files一条指令,并确认绝对的规范路径(查看与正在检查的文件关联的密钥):bibtexarara.logreference

Directive(
   identifier=bibtex,
   parameters={
       reference=C:\Users\Tommi\Projects\dissertation\chapter-open-problem\paper
   },
   conditional={
       NONE
   },
   lineNumbers=[3]
)

失败的原因bibtex是,在该特定规则(以及其他与 TeX 相关的规则)中,bibtex不鼓励对当前目录以外的文件上的二进制文件进行调用(在我们的例子中,我们实际上强制执行此策略)。我们可以看到发生了什么:

return getCommand('bibtex', options, getBasename(reference.getName()))

reference.getName()意味着仅获取文件名并忽略任何路径部分。然后getBasename(…)删除任何关联的扩展名。因此,在我们的示例中:

reference 

相关内容