使用该multibib
包,我有两个书目部分。我不想重置参考计数器,我原以为这应该是默认情况。至少这是包文档所说的,阅读包代码,默认情况resetlabels
下该选项是关闭的。但每个书目都从一开始计数。下面是一个 MWE(文件 mwe.tex):
\documentclass[12pt]{article}
\usepackage[numbers]{natbib}
\usepackage{multibib}
\newcites{wwwbib}{Links to Webpages}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section*{Test multibib}
Reference to Buzz Lightyear \cite{ref01}.
The reference to Pixar I would expect to be number 2, but it is not \citewwwbib{ref02}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{plainnat}
\bibliography{mwe}{}
\bibliographystylewwwbib{plainnat}
\bibliographywwwbib{mwe}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
为了编译,我使用
pdflatex mwe
bibtex mwe
bibtex wwwbib
pdflatex mwe
pdflatex mwe
文件内容mwe.bib
如下:
@article{ref01,
author = {Lightyear, Buzz},
title = {To Infinity and Beyound Part 1},
journal = {Unknown},
volume = {54},
number = {4},
pages = {331-390},
year = {2001}
}
@misc{ref02,
author = {Pixar},
title = {Pixar Website},
howpublished = {\url{www.pixar.com}},
year = {2001}
}
pdf 输出为
我怎样才能获得连续的编号?
答案1
使用我当前的 MiKTeX 2.9 和multibib
版本 multibib 2008/12/10 v1.4 我得到以下(错误)文件wwwbib.aux
:
\citation{ref02}
\bibstyle{plainnat}
\bibdata{wwwbib}
\bibcite{ref02}{{2}{2001}{{Pixar}}{{}}},
因为不存在文件wwwbib.bib
(第 3 行)引用ref02
无效。更改wwwbib
为test
(bib
文件名为test.bib
)后,它就可以正常工作了。
这原因因为这样,我通常更喜欢写filecontents
这样的部分来保留创建的文件bib
或与我的 MWE 文件同名的其他文件:
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib} % <==========
...
\end{filecontents*}
...
\bibliographystyle{plainnat}
\bibliography{\jobname} % print here % <==========
\bibliographystylewwwbib{plainnat}
\bibliographywwwbib{\jobname} % print here Online bib % <==========
如果您使用包multibib
,该包将使用其自身的宏来创建所需的\jobname
文件。wwwbib.aux
\jobname.aux
\bibdata{\jobname}
\bibdata{test}
看来这里multibib
(或系统或filecontents
使用)有一个错误\jobname
,导致出现错误的行\bibdata{wwwbib}
(而不是正确的\bibdata{test}
)。
解决方案:
如果您需要在 MWE 中使用, 请不要使用\jobname
!filecontents
multibib
结果:
以下 MWE 在我的系统上运行时没有错误:
\RequirePackage{filecontents}
\begin{filecontents*}{test.bib} % <==========
@article{ref01,
author = {Lightyear, Buzz},
title = {To Infinity and Beyound Part 1},
journal = {Unknown},
volume = {54},
number = {4},
pages = {331--390},
year = {2001},
}
@misc{ref02,
author = {Pixar},
title = {Pixar Website},
howpublished = {\url{www.pixar.com}},
year = {2001},
}
\end{filecontents*}
\documentclass[12pt]{article}
\usepackage[numbers]{natbib}
\usepackage{multibib}
\newcites{wwwbib}{Links to Webpages}
\begin{document}
\section*{Test multibib}
Reference to Buzz Lightyear \cite{ref01}.
The reference to Pixar I would expect to be number 2,
but it is not \citewwwbib{ref02}.
\bibliographystyle{plainnat}
\bibliography{test} % <========== no \jobname here!
\bibliographystylewwwbib{plainnat}
\bibliographywww{test} % <========== no \jobname here!
\end{document}
我得到了想要的结果:
答案2
查看我的multibib.sty
,我发现我使用了版本2003/03/24 v1.2
。升级到版本2008/12/10 v1.4
就可以了。v1.4 似乎已经升级了对natbib
包的支持