Biometrika 日誌樣式檔與 TeXLive-2020 不相容

Biometrika 日誌樣式檔與 TeXLive-2020 不相容

我無法在 biometrika.zip 中編譯 styleguide.tex (請參閱https://academic.oup.com/biomet/pages/General_Instructions)。

這是一個 MWE,它會導致相同的錯誤訊息,儘管還不確定我是否沒有將嬰兒與洗澡水一起倒掉。

\documentclass{article}
\RequirePackage[thmmarks]{ntheorem}

\makeatletter
\def\arabic#1{{\rm\expandafter\@arabic\csname c@#1\endcsname}}
\theoremnumbering{arabic}
\newtheorem{definition}{Definition}
\makeatother

\begin{document}

\begin{definition}
This is a definition.
\end{definition}

\end{document}

這是輸出pdflatex

% pdflatex styleguide
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./styleguide.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo)) (./ntheorem.sty

Style `ntheorem', Version 1.24 <2004/09/20>
) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
) (./styleguide.aux)
! Use of \@item doesn't match its definition.
\update@series@target@value #1->\def \reserved@a {
                                                  #1}\ifx \target@meta@famil...
l.13 T
      his is a definition.
? q
OK, entering \batchmode     

答案1

類別biometrika文件(至少)犯了三個嚴重錯誤:

  1. \rm儘管該命令已經被棄用了 25 年(嗯,根據發布日期是 14 年,但無論如何已經很長時間了),但它到處都可以使用;

  2. 它重新定義了\document,這更糟;

  3. 它確實\def\arabic#1{{\rm\expandafter\@arabic\csname c@#1\endcsname}}無法在公共網站上發表評論。

事實上,任何 LaTeX 程式設計師都應該知道要遠離錯誤 3。關於第二點,該類別的目的似乎只是刪除

  \ifx\normalsfcodes\@empty
    \ifnum\sfcode`\.=\@m
      \let\normalsfcodes\frenchspacing
    \else
      \let\normalsfcodes\nonfrenchspacing
    \fi
  \fi
  \ifx\document@default@language\m@ne
    \chardef\document@default@language\language
  \fi

(從 TeX Live 2007 檢查latex.ltx),所以沒有任何理由這樣做。

如何修復它?

這是一個適合無操作的序言\rm,因此文件中所有明確出現的內容都必須替換為正確的命令(\mathrm在數學模式下)。

%%% fix the plain theorem style to have numbers upright
\RequirePackage[thmmarks]{ntheorem}
\makeatletter
\renewtheoremstyle{plain} 
  {\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\theorem@separator]} 
  {\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\ (##3)\theorem@separator]}
\makeatother

%%% save \document and \arabic to be reinstated after loading the class
\let\latexdocument\document
\let\latexarabic\arabic

%%% load the class (use the option you need)
\documentclass[manuscript]{biometrika}
%\documentclass[lineno]{biometrika}

%%% reinstate the original \document and \arabic
\let\document\latexdocument
\let\arabic\latexarabic

%%% make \rm into a no-op
\def\rm{}

然後,可以繼續處理該文件和文件正文所需的其他套件。

請注意該類別的作者知道關於\renewtheoremstyle

答案2

注意

\documentclass{article}
\RequirePackage[thmmarks]{ntheorem}
\newtheorem{definition}{Definition}
\begin{document}
\begin{definition}
This is a definition.
\end{definition}
\end{document}

不會引起任何問題。似乎他們試圖以非標準的方式使用 ntheorem。

相關內容