
自上次 LaTeX2e 版本以來,以下 Latex 文件的輸出已變更:
\documentclass{article}
\begin{document}
\IfFileExists
{}
{ yes }
{ no }
\end{document}
發佈時間 2020-02-02:不
2020年10月1日發布:是的
為什麼?這是故意的嗎?
—更新—
假設我們test.tex.erb
首先使用了一個由 Ruby 處理的檔案。
\documentclass{article}
\begin{document}
\newcommand{\mypath}{<%= @image.path %>}
\IfFileExists
{\mypath}
{\includegraphics{\mypath}}
{ no image }
\end{document}
@image.path
有時會nil
出現\mypath
空白。\includegraphics{\mypath}
自最新的 LaTeX2e 版本(2020 年 10 月)以來,這會導致失敗。在任何先前的 LaTeX2e 版本中,文字「無圖像」都會毫無錯誤地呈現。
解決方案
我們使用的簡單解決方案是:
\newcommand{\mypath}{<%= @image.path || './inexistant.txt' %>}
問題解決了。謝謝。