我确信这个问题的各种变体已被问过几十次,但我找不到任何针对我的情况的具体内容。
我想要一种能够实现以下四个目标的书目格式:
- 获取 (作者,年份) 格式的引用
- 获取编号书目
- 按字母顺序获取参考书目。
- 如果可能的话,使用 natbib 包
我还没有看到任何可以将这三件事同时完成的解决方案。
答案1
以下解决方案采用biblatex
:
\documentclass{article}
\usepackage[
natbib=true,
style=authoryear,
labelnumber,
]{biblatex}
\addbibresource{references.bib}
\DeclareFieldFormat{labelnumberwidth}{[#1]}
\defbibenvironment{bibliography} % from numeric.bbx
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
\begin{filecontents}{references.bib}
@article{Smith:01,
author = {Smith, John},
year = {2001},
title = {Article title},
journal = {Journal title},
volume = {13},
pages = {1--2}
}
@book{Mueller:02,
author = {M{\"u}ller, Hans},
year = {2002},
title = {Book title},
publisher = {Publisher},
address = {Address}
}
\end{filecontents}
\begin{document}
\cite{Smith:01}, \cite{Mueller:02}
\printbibliography
\end{document}
编辑:当然,如果您对标准数字样式感到满意,那么还有一个更简单的解决方案biblatex
,即,因为可以区分citestyle
和bibstyle
。
\documentclass{article}
\usepackage[
natbib=true,
citestyle=authoryear,
bibstyle=numeric,
]{biblatex}
\addbibresource{references.bib}
\begin{filecontents}{references.bib}
@article{Smith:01,
author = {Smith, John},
year = {2001},
title = {Article title},
journal = {Journal title},
volume = {13},
pages = {1--2}
}
@book{Mueller:02,
author = {M{\"u}ller, Hans},
year = {2002},
title = {Book title},
publisher = {Publisher},
address = {Address}
}
\end{filecontents}
\begin{document}
\cite{Smith:01}, \cite{Mueller:02}
\printbibliography
\end{document}