elsarticle 文档类中的 \ead 指令存在问题

elsarticle 文档类中的 \ead 指令存在问题

我有两个在模板下编写的完全相同的 TeX 文件elsarticle,只是作者的名字不同。这个小小的差异导致下面第二个代码出错,而第一个代码没有出现错误。在第一个代码中,我在模板中的相应位置写了\author{someone}和,而在第二个代码中,我使用了另一个名称,比如,和另一个电子邮件地址,比如。\ead{[email protected]}\author{Abbas Karamali Ravandi}\ead{[email protected]}

请至少运行每个代码两次才能查看错误。

第一个代码:

\documentclass[preprint,12pt]{elsarticle}
\usepackage{epsfig}
\usepackage{subcaption}
\captionsetup{compatibility=false}
%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
\usepackage{mathptmx} 
\usepackage{amsmath}
\newtheorem{thm}{Theorem}
\newproof{pf}{Proof}
\journal{X}

\begin{document}
\begin{frontmatter}
\title{Something as a title}
\author{Someone}
\ead{[email protected]}
\address{}

\begin{abstract}
%% Text of abstract
\end{abstract}

\begin{keyword}
%% keywords here, in the form: keyword \sep keyword
Keyword1 \sep Keyword2 \sep Keyword3 \sep Keyword4
%% PACS codes here, in the form: \PACS code \sep code

%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)

\end{keyword}

\end{frontmatter}

%% main text
\section{Introduction}
\label{}
Here goes introduction of the paper

\bibliographystyle{elsarticle-num} 
\bibliography{Bibiliography}

\end{document}
\endinput
%% End of file `elsarticle-template-num.tex'.

和第二

\documentclass[preprint,12pt]{elsarticle}
\usepackage{epsfig}
\usepackage{subcaption}
\captionsetup{compatibility=false}
%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
\usepackage{mathptmx} 
\usepackage{amsmath}
\newtheorem{thm}{Theorem}
\newproof{pf}{Proof}
\journal{X}

\begin{document}
\begin{frontmatter}
\title{Something as a title}
\author{Abbas Karamali Ravandi}
\ead{[email protected]}
\address{}

\begin{abstract}
%% Text of abstract
\end{abstract}

\begin{keyword}
%% keywords here, in the form: keyword \sep keyword
Keyword1 \sep Keyword2 \sep Keyword3 \sep Keyword4
%% PACS codes here, in the form: \PACS code \sep code

%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)

\end{keyword}

\end{frontmatter}

%% \linenumbers

%% main text
\section{Introduction}
\label{}
 Here goes introduction of the paper

\bibliographystyle{elsarticle-num} 
\bibliography{Bibiliography}

\end{document}

答案1

检查\ead由文档类定义的宏是有益的elsarticle

\def\ead{\@ifnextchar[{\@uad}{\@ead}}
\gdef\@ead#1{\bgroup%
   \def\_{\string\underscorechar\space}%  % <--- crucial
   \def\{{\string\lbracechar\space}%
   \def~{\hashchar\space}%
   \def\}{\string\rbracechar\space}%
   \edef\tmp{\the\@eadauthor}
   \immediate\write\@auxout{\string\emailauthor
     {#1}{\expandafter\strip@prefix\meaning\tmp}}%
  \egroup
}
\newcounter{ead}
\gdef\emailauthor#1#2{\stepcounter{ead}%
      \g@addto@macro\@elseads{\raggedright%
      \let\corref\@gobble
      \eadsep\texttt{#1} (#2)%
      \def\eadsep{\unskip,\space}}%
}

部分代码用于处理文档包含多\ead条指令的可能性。对于您的文档,需要认识到的关键是,\ead宏要求下划线、左花括号和右花括号分别输入为\_\{\},即在 (La)TeX 术语中“转义”。(字符~,即 LaTeX 术语中的“活动字符”,也会被重新定义。)

因此,您需要输入如下指令

\ead{abbas\[email protected]}

以避免收到(几乎难以理解的)错误消息。

相关内容