使用「預編譯」aux 檔案來避免 arxiv 的限制

使用「預編譯」aux 檔案來避免 arxiv 的限制

似乎 arXiv 沒有編譯我的文檔足夠多次(在某些時候它會停止,說它達到了最大嘗試次數)。因此,我的文件的某些部分看起來不太好(而如果我在我這邊使用 Latexmk 進行編譯,它會按預期工作)。

我嘗試添加main.aux文件,但 arXiv 會自動刪除我的文件。我還嘗試創建一個main_backup.aux包含以下副本的文件main.aux(此副本未刪除),而是在之前添加了\begin{document}

\IfFileExists{main_backup.aux}{
  \message{We saw a default backup.aux file, let's use it instead of the main aux file.}
  \nofiles % Disable default aux file
  \makeatletter
  \input{main_backup.aux}
  \makeatother
}{}

然而這有兩個問題:

  1. 在本地,它編譯沒有錯誤,我的文檔看起來更好......除了現在為空的目錄!
  2. 在 arxiv 上,載入 aux 檔案後立即失敗並出現錯誤:
We saw a default backup.aux file, let's use it instead of the main aux file.
No auxiliary output files.

(./main_backup.aux

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.23 \abx@aux@cite{0}{K
il88_FoundingCrytpographyOblivious}
?
! Emergency stop.
...

l.23 \abx@aux@cite{0}{K
il88_FoundingCrytpographyOblivious}
No pages of output.
Transcript written on main.log.

[verbose]: latex 'main.tex' failed.
[verbose]: TEXMFCNF is unset.

請注意,此錯誤似乎出現在我的 aux 檔案的這一行:

\@writefile{toc}{\authcount {1}}
\abx@aux@cite{0}{Kil88_FoundingCrytpographyOblivious}

其中再次提到了目錄……所以我的兩個問題可能是相關的。

編輯 我也嘗試過:

\IfFileExists{main_backup.aux}{
  \message{We saw a default backup.aux file, let's use it instead of the main aux file.}
  \makeatletter
  \usepackage{etoolbox}
  %% Try to patch the command given in
  %% https://tex.stackexchange.com/questions/285798/how-and-when-is-the-aux-file-read-and-processed
  % \regexpatchcmd{\enddocument}{\@@input\jobname.aux}{\@@input{main_backup.aux}}
  \patchcmd{\enddocument}{\@@input\jobname.aux}{\@@input{main_backup.aux}}{}{}
  %\input{main_backup.aux}
  \makeatother
}{}

但似乎補丁不起作用。

編輯

我也嘗試過:

%%%% Really dirty trick because arxiv does not compile enough the document, so we need our own aux file:
\IfFileExists{main_backup.aux}{
  \IfFileExists{main.aux}{}{
    \message{We saw a default backup.aux file, let's use it instead of the main aux file.}
    \makeatletter
    \input{main_backup.aux}
    \makeatother
  }
}{}


\begin{document}
...

這確實可以在本地工作,但不能在 arxiv 伺服器上工作,它再次失敗,並出現這個惱人的相同錯誤...

答案1

您可以重現

\documentclass{article}
\usepackage{biblatex}
\makeatletter
\@writefile{toc}{\authcount {1}}
\abx@aux@cite{0}{Kil88_FoundingCrytpographyOblivious}


\begin{document}
x
\end{document}

在 texlive 2022 和 2023 中運行沒有錯誤,但在 2020 年給出

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.5 \abx@aux@cite{0}{K
                      il88_FoundingCrytpographyOblivious}
?

請注意,這不是您顯示的格式,因為il88縮排超過了,K但我懷疑這是您遇到的錯誤。 (我想不出任何方法來得到你所顯示的錯誤。)

舊版本\abx@aux@cite只有一個參數,因此看起來您可以簡單地編輯已儲存的檔案來刪除第一個數字參數,它應該足夠接近第一次運行,第二次運行將拾取真正的 2020 aux。

\documentclass{article}
\usepackage{biblatex}
\makeatletter
\@writefile{toc}{\authcount {1}}
\abx@aux@cite{Kil88_FoundingCrytpographyOblivious}


\begin{document}
x
\end{document}

2020年運行無錯誤;到 2023 年,它會給出

Runaway argument?
! Paragraph ended before \abx@aux@cite was complete.
<to be read again> 
                   \par 
l.6 
    
? 

答案2

好的,之後挖掘更多,問題是arXiv 使用了一個名為autotex 的工具,在使用DVI 輸出時無法處理某些類型的動態圖片(即使在我的測試中,DVI 在本地工作正常,問題似乎是autotex),所以tikz 的圖片可以出錯。透過放置:

\pdfoutput=1

在第一行,你強制 arXiv 編譯為 pdf。放入a4paper類別中也可能會阻止 arXiv 嘗試處理幾何圖形。

如果你因為某些原因無法使用上面的文本,更簡單的方法可能是直接提交 PDF,並使用以下內容來隱藏 pdf 是由 LaTeX 產生的事實(否則 arXiv 不會讓你提交pdf):

\usepackage{hyperref}
% Hide to arXiv that this pdf is produced by LaTeX:
\pdfsuppressptexinfo=-1 
\hypersetup{
  pdfproducer={},
  pdfcreator={},
}

相關內容