如果附錄中的方程式所在部分未編號,則應如何編號?

如果附錄中的方程式所在部分未編號,則應如何編號?

我正在使用elsarticle文檔類。由於我只有一個附錄,所以我想刪除“Appendix”後面的字母“A”。不幸的是,如果我寫\section*{Appendix title},方程式的編號就會消失。

這是一個 MWE:

\documentclass[authoryear,preprint,review,12pt]{elsarticle}
\usepackage[english]{babel}
\begin{document}

bla bla bla

\appendix 
\section*{Appendix title}

\begin{equation}
 3+3 = 6
\end{equation}

\end{document}

答案1

我假設您希望附錄中的方程式編號為A.1A.2等。\appendix

\setcounter{equation}{0}
\renewcommand\theequation{A.\arabic{equation}}

其次是\section*{Appendix Title}


附錄:文檔類別以錯誤的方式elsarticle修改了 LaTeX 的巨集。\appendix具體來說,其對巨集的修改\appendix包含以下指令:

\gdef\thesection{\appendixname\@Alph\c@section}%

這在單字「附錄」和節計數器(「A」、「B」等)之間不留任何空格。正確的指令是

\gdef\thesection{\appendixname\ \@Alph\c@section}%

更糟的是,如果希望使用(從包中)或(從包中)創建對附錄中編號部分的交叉引用,則所採用的方法內部elsarticle文檔類(即包括\appendixname\thesection\autorefhyperref\crefcleveref使用“附錄 A”而不是“附錄 A”。將這些想法應用到elsarticle文件類別中,將以下程式碼添加到序言中似乎是個好主意:

\usepackage{etoolbox}
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname.\hskip0.5em}    % default
   {\csname #1@cntformat\endcsname}% enable individual control
}
\patchcmd{\appendix}{\appendixname}{}{}{}
\appto{\appendix}{%
    \newcommand{\section@cntformat}{\appendixname\ \thesection.\hskip0.5em}}
\makeatother

相關內容