自动引用第 n 位作者

自动引用第 n 位作者

我正在和很多人一起写一篇论文,说实话,目前我甚至不确定最终版本中会将谁列为作者。在正文中,我想写“推测的第四十二位作者”之类的内容,但事先不知道“42”(好吧,我必须承认,实际上我们没有那么多人)。

有没有办法给作者贴上标签来实现这一点?

答案1

这不是一个纯 LaTeX 解决方案,但如果您使用 R,则knitr有一个简单的方法:

\documentclass{article}
\usepackage{parskip}
<<theverylonglistofauthors,echo=F>>=
authors <- c(
"Davy Jones ",
"Hannibal Lecter",
"Norman Bates",
"Freddy Krueger",
"Jack Torrance", 
"Darth Vader",
"James Moriarty"
)
@
\title{We are legion}
\author{\Sexpr{combine_words(authors[1:3], sep=" \\and ", and="")}}
\date{\today}

\begin{document}
\maketitle
\section{Introduction}

Forensic analysis of \Sexpr{authors[2]} about legacy of commercial transcantions
of \Sexpr{authors[1]} showed  that he is as guiltless as the mam of 
\Sexpr{authors[3]}. 
All work and no play makes Jack a dull boy. 
All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.

\section{Acknowledgements}

We would like to thank to \Sexpr{combine_words(authors[5])} the  help 
to write the present document with the guidance of 
\Sexpr{combine_words(authors[c(4,6)])}.

Back luck, \Sexpr{combine_words(authors[7])}, you are out! 

\end{document}

姆韦

相关内容