使用 \ead 的选项

使用 \ead 的选项

我正在尝试在脚注中写电子邮件地址并使用以下代码:

\documentclass[3p,onecolumn]{elsarticle}

\usepackage{lipsum}

\begin{document}
\begin{frontmatter}
%% Title
\title{Title}
%% Group authors per affiliation:
\author{Richard Robson}
\ead{[email protected]}
\author[1]{Mat Harisson\corref{correspondingauthor}}
\cortext[correspondingauthor]{Corresponding author. Tel.: 000000000000;  Fax: 0000000000000.}
\ead{[email protected]}
\address[1]{Faculty of Mechanical Engineering}
\begin{abstract}
\lipsum[1]
\end{abstract}

\begin{keyword}
B
\end{keyword}

\end{frontmatter}
\lipsum[1]
\end{document}

在此处输入图片描述 但是,如果不使用括号中的全名,我怎样才能获得:

电子邮件地址:[电子邮件保护](R.罗布森)[电子邮件保护](M.哈里森)

答案1

您的序言中的以下附加内容添加了使用输入指定“简短作者”的选项\author[<num>]{<full author>}{<short author>}。此外,可以使用条件在电子邮件通信中写入简短作者(\emailshortauthortrue)或常规完整作者(\emailshortauthorfalse-默认)之间切换

\makeatletter
\newtoks\@eadauthorshort
\def\@author#1#2{\g@addto@macro\elsauthors{\normalsize%
    \def\baselinestretch{1}%
    \upshape\authorsep#1\unskip\textsuperscript{%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi
      \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi
      }%
    \def\authorsep{\unskip,\space}%
    \global\let\@fnmark\@empty
    \global\let\sep\@empty}%
    \@eadauthor={#1}
    \@eadauthorshort={#2}
}
\def\@@author[#1]#2#3{\g@addto@macro\elsauthors{%
    \def\baselinestretch{1}%
    \authorsep#2\unskip\textsuperscript{%#1%
      \@for\@@affmark:=#1\do{%
       \edef\affnum{\@ifundefined{X@\@@affmark}{1}{\elsRef{\@@affmark}}}%
     \unskip\sep\affnum\let\sep=,}%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi
      \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi
      }%
    \def\authorsep{\unskip,\space}%
    \global\let\sep\@empty\global\let\@corref\@empty
    \global\let\@fnmark\@empty}%
    \@eadauthor={#2}%
    \@eadauthorshort={#3}%
}
\gdef\@ead#1{\bgroup\def\_{\string\underscorechar\space}%
  \def\{{\string\lbracechar\space}%
   \def~{\hashchar\space}%
   \def\}{\string\rbracechar\space}%
   \edef\tmpA{\the\@eadauthor}
   \edef\tmpB{\the\@eadauthorshort}
   \immediate\write\@auxout{\string\emailauthor
     {#1}{\expandafter\strip@prefix\meaning\tmpA}{\expandafter\strip@prefix\meaning\tmpB}}%
  \egroup
}
\gdef\emailauthor#1#2#3{\stepcounter{ead}%
     \g@addto@macro\@elseads{\raggedright%
      \let\corref\@gobble
      \eadsep\texttt{#1} (\ifemailshortauthor #3\else#2\fi)\def\eadsep{\unskip,\space}}%
}
\newif\ifemailshortauthor
\makeatother

以下是突出显示输出的完整示例:

在此处输入图片描述

\documentclass[3p,onecolumn]{elsarticle}

\usepackage{lipsum}

\makeatletter
\newtoks\@eadauthorshort
\def\@author#1#2{\g@addto@macro\elsauthors{\normalsize%
    \def\baselinestretch{1}%
    \upshape\authorsep#1\unskip\textsuperscript{%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi
      \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi
      }%
    \def\authorsep{\unskip,\space}%
    \global\let\@fnmark\@empty
    \global\let\sep\@empty}%
    \@eadauthor={#1}
    \@eadauthorshort={#2}
}
\def\@@author[#1]#2#3{\g@addto@macro\elsauthors{%
    \def\baselinestretch{1}%
    \authorsep#2\unskip\textsuperscript{%#1%
      \@for\@@affmark:=#1\do{%
       \edef\affnum{\@ifundefined{X@\@@affmark}{1}{\elsRef{\@@affmark}}}%
     \unskip\sep\affnum\let\sep=,}%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi
      \ifx\@corref\@empty\else\unskip\sep\@corref\let\sep=,\fi
      }%
    \def\authorsep{\unskip,\space}%
    \global\let\sep\@empty\global\let\@corref\@empty
    \global\let\@fnmark\@empty}%
    \@eadauthor={#2}%
    \@eadauthorshort={#3}%
}
\gdef\@ead#1{\bgroup\def\_{\string\underscorechar\space}%
  \def\{{\string\lbracechar\space}%
   \def~{\hashchar\space}%
   \def\}{\string\rbracechar\space}%
   \edef\tmpA{\the\@eadauthor}
   \edef\tmpB{\the\@eadauthorshort}
   \immediate\write\@auxout{\string\emailauthor
     {#1}{\expandafter\strip@prefix\meaning\tmpA}{\expandafter\strip@prefix\meaning\tmpB}}%
  \egroup
}
\gdef\emailauthor#1#2#3{\stepcounter{ead}%
     \g@addto@macro\@elseads{\raggedright%
      \let\corref\@gobble
      \eadsep\texttt{#1} (\ifemailshortauthor #3\else#2\fi)\def\eadsep{\unskip,\space}}%
}
\newif\ifemailshortauthor
\makeatother

\emailshortauthortrue
\begin{document}
\begin{frontmatter}
%% Title
\title{Title}
%% Group authors per affiliation:
\author{Richard Robson}{R Robson}
\ead{[email protected]}
\author[1]{Mat Harisson\corref{correspondingauthor}}{M Harisson}
\cortext[correspondingauthor]{Corresponding author. Tel.: 000000000000;  Fax: 0000000000000.}
\ead{[email protected]}
\address[1]{Faculty of Mechanical Engineering}
\begin{abstract}
\lipsum[1]
\end{abstract}

\begin{keyword}
B
\end{keyword}

\end{frontmatter}
\lipsum[1]
\end{document}

相关内容