
我正在latexmk
使用pdflatex
來編譯我的論文,以biblatex
作為參考並biber
作為後端。它編譯良好並創建正確的 PDF 輸出。如果對原始檔案的變更引入錯誤,則第一次執行會pdflatex
失敗,但會建立 bcf 檔案。然後 biber 的執行會抱怨 bcf 檔案格式錯誤,表示上次biblatex
執行失敗並且編譯停止。但是,修復錯誤後latexmk
認為pdflatex
運行正常並調用biber
,但 bcf 文件仍然格式錯誤。
latexmk
不知怎的,似乎沒有註意到文件發生了變化。
刪除 bcf 檔案或使用latexmk -C
make latexmk
call清理它pdflatex
清理它,然後重新建立正確的 bcf 檔案。手動調用pdflatex
也可以,但違背了 的目的latexmk
。我嘗試使用-halt-on-error
作為選項,pdflatex
但這不起作用。我似乎記得它與 TexLive 2014 一起工作,在嘗試運行失敗後將在下一次嘗試中首先biber
latexmk
運行。pdflatex
我使用的是TexLive 2015,版本latexmk
是4.43a,biber
版本是2.3。產生的輸出是
Latexmk: This is Latexmk, John Collins, 5 February 2015, version: 4.43a.
Rule 'biber thesis': File changes, etc:
Non-existent destination files:
'thesis.bbl'
------------
Run number 1 of rule 'biber thesis'
------------
------------
Running 'biber "thesis"'
------------
Latexmk: applying rule 'biber thesis'...
INFO - This is Biber 2.3
INFO - Logfile is 'thesis.blg'
ERROR - thesis.bcf is malformed, last biblatex run probably failed. Deleted thesis.bbl
INFO - ERRORS: 1
Latexmk: Failed to find one or more biber source files:
NONE
Collected error summary (may duplicate other messages):
biber thesis: Could not find all biber source files for 'thesis'
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
Biber error: [33] Utils.pm:163> ERROR - thesis.bcf is malformed, last biblatex run probably failed. Deleted thesis.bbl
Latexmk: Errors, so I did not complete making targets
強制 mwe.tex:
\documentclass[paper=a4]{scrartcl}
\usepackage[backend=biber]{biblatex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\addbibresource{Bibliography.bib}
\begin{document}
\autocite{smith_pixel_1995}
\end{document}
參考書目.bib
@article{smith_pixel_1995,
title = {A Pixel Is Not A Little Square, A Pixel Is Not A Little Square, A Pixel Is Not A Little Square!},
volume = {6},
url = {http://ftp.alvyray.com/Memos/CG/Microsoft/6_pixel.pdf},
journaltitle = {Microsoft Computer Graphics, Technical Memo},
author = {Smith, Alvy Ray},
urldate = {2016-02-04},
date = {1995}
}
重現步驟:
- 跑步
latexmk -pdf mwe
- 引入錯誤,
mwe.tex
例如未定義的控制序列 - 跑步
latexmk -pdf mwe
- 當提示中止編譯時,按
x
- 解決錯誤
- 跑步
latexmk -pdf mwe
-> biber 錯誤 - 運行
latexmk -pdf mwe
-> 相同的 biber 錯誤,不會消失
所以問題是,如何latexmk
重新建立 bcf 文件,以便 biber 可以使用它,而無需手動清理或刪除文件?
答案1
正如評論中已經提到的,解決方案是使用新版本latexmk
(我寫這個答案時為 4.44),現在可以在http://www.ctan.org/pkg/latexmk/
答案2
更新2019年5月2020 年 3 月:
這仍然是 Ubuntu (bionic) 18.04 LTS 的問題,因為它們提供了版本4.41。
正如所述約翰這個問題從 4.44 版本開始就被修復了。 Latexmk 的新版本適用於 cosmic、disco、eoan、focal、..
至少有三種升級方式,選擇其中一種:
a) 下載並安裝.deb
,例如從https://packages.ubuntu.com/focal/all/latexmk/download希望它不需要升級任何進一步的依賴項。
b) 我透過暫時使用 cosmic 儲存庫在我的機器上解決了這個問題:
- 在 Universe 儲存庫行中編輯 /etc/apt/sources.list 從 bionic 到 cosmic,儲存
- 易於更新
- apt安裝latexmk
- 恢復 /etc/apt/sources.list 中的更改
- 易於更新
通常不建議兩者,但 Latexmk 是一個非常簡單的應用程式/腳本,幾乎沒有依賴項。不需要固定,因為希望維護者不會選擇 4.41 和 4.44 之間的版本,cosmic 中的目前版本是 4.59。
c) 另一種方法是從以下位置載入最新的包CTAN並像文件中那樣安裝它,基本上是替換和調整權限。看如何升級 Latexmk / 為什麼 Ubuntu 儲存庫包含非常舊的版本?。