我使用哈佛系统在文章中写参考文献。所以我有一个文件“test.bib”,它被视为一个数据库,包含我所有的参考文献。我将给你一个非常简单的例子来帮助你。
首先,考虑我的 tex 文件:我的_文件.tex
\documentclass[a4paper,twoside]{article}
\usepackage{apalike}
\usepackage{harvard}
\begin{document}
\section{INTRODUCTION}
author1 et al. (2005) proposed a new algorithm ....
A new algorithm has been proposed (authors et al., 2005)
author5 and author6 (2003) proposed a sophisticated algorithm...
A sophisticated algorithm has been proposed (author5 and author6, 2003)
\bibliographystyle{apalike}
{\small
\bibliography{test}}
\end{document}
考虑我的文件:测试文件
@INPROCEEDINGS{ x1,
AUTHOR = " author1, C. and author2, F. and author3, N. and author4, M.",
TITLE = "title1",
BOOKTITLE = "IEEE....",
YEAR = "2005",
file = F
}
@INPROCEEDINGS{ x2,
AUTHOR = " author5, C. and author6, F.",
TITLE = "title2",
BOOKTITLE = "IEEE....",
YEAR = "2003",
file = F
}
考虑下面四个短语,并将其添加到文章中:
1) author1 et al. (2005) proposed a new algorithm ....
2) A new algorithm has been proposed (authors et al., 2005)
3) author5 and author6 (2003) proposed a sophisticated algorithm...
4) A sophisticated algorithm has been proposed (author5 and author6, 2003)
我知道如何手动将参考文献添加到文本中(例如 author1 et al. (2005) 等),但如何自动添加它们?我可以使用 for\cite{}
示例吗?如果可以,那么如何使用。请问我想要 latex 中的代码,它可以生成 for 示例(四个短语)。
如能得到任何帮助,我们将非常感激!
答案1
我不会加载harvard
或apalike
引文管理包。相反,我会加载natbib
引文管理包并使用其宏\citet
和\citep
生成文本样式和括号引文标注。使用的一个重要优势natbib
是它与hyperref
包完全兼容。
请继续加载apalike
参考书目样式。
\documentclass[a4paper,twoside]{article}
\bibliographystyle{apalike}
\usepackage{natbib}
\usepackage{filecontents}
\begin{filecontents}{test.bib}
@INPROCEEDINGS{ x1,
AUTHOR = "Author1, C. and Author2, F. and Author3, N. and Author4, M.",
TITLE = "Title1",
BOOKTITLE = "IEEE....",
YEAR = "2005",
file = F,
}
@INPROCEEDINGS{ x2,
AUTHOR = "Author5, C. and Author6, F.",
TITLE = "Title2",
BOOKTITLE = "IEEE....",
YEAR = "2003",
file = F,
}
\end{filecontents}
\begin{document}
\setlength\parindent{0pt} %% just for this example
\section{Introduction}
\citet{x1} proposed a new algorithm.
A new algorithm has been proposed \citep{x1}.
\citet{x2} proposed a sophisticated algorithm.
A sophisticated algorithm has been proposed \citep{x2}.
\bibliography{test}
\end{document}