在撰写论文时,通常将论文主体和支持信息写在一个文件中会很有帮助,这样可以利用 LaTeX 的参考功能。
然而,这确实需要在附录/支持信息开头的中间添加第二个前言。
如何为 elsarcticle 类实现这一点?
答案1
我通过浏览 .cls 文件,以某种有点古怪的方式弄清楚了这一点。它对我的目的有用。只需像平常一样写论文,当你看到附录时,你需要包含一堆命令来重新打印稍微修改过的标题。
\documentclass{elsarticle}
\usepackage{titletoc}
\usepackage{lipsum} % just to demonstration
% your paper goes here
% ...
\bibliographystyle{elsarticle-num}
\bibliography{library}
%%%%%%%%%%%%%%%%%%%%
%%%%% APPENDIX %%%%%
%%%%%%%%%%%%%%%%%%%%
\appendix
%\nolinenumbers % if you are using lineo package
\newpage
\setcounter{section}{0}
\setcounter{page}{1}
\setcounter{figure}{0}
\setcounter{equation}{0}
\renewcommand{\thesection}{S\arabic{section}}
\renewcommand{\thepage}{s\arabic{page}}
\renewcommand{\thetable}{S\arabic{table}}
\renewcommand{\thefigure}{S\arabic{figure}}
% most counters defined by elsarticle (just in case), important here is affn
% \setcounter{ead}{0}
% \setcounter{tnote}{0}
% \setcounter{fnote}{0}
% \setcounter{cnote}{0}
% \setcounter{author}{0}
\setcounter{affn}{0}
\resetTitleCounters
% Remove the title so we can fill a new one in
\makeatletter
\let\@title\@empty
\makeatother
\title{Supplementary Data for: The Paper title again}
% I'm using the abstract environment to put a table of contents
\makeatletter
\renewenvironment{abstract}{\global\setbox\absbox=\vbox\bgroup
\hsize=\textwidth\def\baselinestretch{1}%
\noindent\unskip\textbf{Contents}
\par\medskip\noindent\unskip}
{\egroup}
% here we modify the footnote on the title page to reflect that these are supporting info
\def\ps@pprintTitle{%
\let\@oddhead\@empty
\let\@evenhead\@empty
\def\@oddfoot{\footnotesize\itshape
Supplementary Data for \ifx\@journal\@empty Elsevier
\else\@journal\fi\hfill\today}%
\let\@evenfoot\@oddfoot}
\makeatother
% making the new TOC for the SI
\startlist{toc}
\begin{abstract}
\vspace{-48pt}
\printlist{toc}{}{\section*{}}
\end{abstract}
\maketitle
\section*{}
\parindent0pt
% your content starts here
\section{Demonstration of something in more detail}
\lipsum[1-5]
\section{Another thing I would like to show}
\lipsum[4-8]
\section{More stuff}
\lipsum[9-10]
\end{document}
然后,在文档中间,您会得到一个漂亮的标题页,其中包含您的支持信息,您可以继续添加内容并使用您想要的所有交叉引用。它看起来是这样的: