编辑

编辑

我使用 splitbib 包生成一个出版物列表,该列表分为不同种类出版物的部分。我希望每个部分从 1 开始编号。为此,splitbib 提供了 SBresetdepth 计数器;将其设置为 >0 会使每个类别的编号重置。

我现在想进入 21 世纪,并在每个条目中提供一个实时 doi 链接。我在这里阅读了几个相关的问题和答案,并按照建议使用 natbib 和 hyperref 成功获得了正确的链接。

但是,有一个问题。为了与 natbib 正常工作,splitbib 要求我使用其 [export] 选项。这可行,但当我使用 [export] 时,我发现编号不会按预期在每个类别中重新开始;它在整个列表中连续运行。此问题与 natbib 无关,正如我下面的 MWE 所示;它发生在我能构建的最普通的 splitbib 使用中。

\begin{filecontents}{sbrefs.bib}
@STRING{jcp = {J. Chem.\ Phys.}}  
@Article{wei16,
  author =   {Wei~Wei  and Colin~J. Wallace and George~C. McBane   and Simon~W. North  },
  title =    {Photodissociation Dynamics of {OCS} Near 214 nm Using Ion Imaging},
  journal =      jcp,
  year =     2016,
  volume =   145,
  number =   2,
  pages =    024310}

@Article{mcba13,
  author =   {G.~C. McBane and J.~A. Schmidt and M.~S. Johnson and
                  R. Schinke},
  title =    {Ultraviolet photodissociation of {OCS}: Product
                  energy and angular distributions},
  journal =  jcp,
  year =     2013,
  volume =   138,
  number =   9,
  pages =    094314
}

@BOOK{halp06,
  title = {Experimental Physical Chemistry: A Laboratory Textbook},
  publisher = {W. H. Freeman},
  year = {2006},
  author = {Arthur M. Halpern and George C. McBane},
  address = {New York},
  edition = {3rd}
}

\end{filecontents}

% .tex file begins here
\documentclass{article}
%\usepackage{splitbib}  % works correctly, resetting counters for each category if SBresetdepth>0
\usepackage[export]{splitbib}  % numbers entries continuously throughout 

\setcounter{SBresetdepth}{1}

% define categories and their citations
\begin{category}{Books}
\SBentries{halp06}
\end{category}
\begin{category}{Journal Articles}
\SBentries{wei16,mcba13}
\end{category}

\begin{document}
\bibliographystyle{unsrt}

%  This \nocite command gives citation keys for all the pubs
\nocite{
wei16,
mcba13,
halp06}

\bibliography{sbrefs}
\end{document}

这是 splitbib 中的错误吗?有方便的修复方法吗?

答案1

当您使用该export选项时,splitbib不会覆盖文档的默认定义\bibitem等。这意味着无论您想要什么样的风格,您都应该拥有。

在您发布的 MWE 中,这意味着\bibitem根据 提供的配置进行格式化unsrt.bst。其定义是\bibitem将在每个新条目时增加计数器。splitbib不会改变这一点。

为了看到这一点,请注意,如果我们使用一个简单的环境,那么即使作为参数给出,thebibliography计数器也会被重置。export

\documentclass{article}
\usepackage[export]{splitbib}  % numbers entries continuously throughout

\setcounter{SBresetdepth}{1}

% define categories and their citations
\begin{category}{Books}
\SBentries{halp06}
\end{category}
\begin{category}{Journal Articles}
\SBentries{wei16,mcba13}
\end{category}

\begin{document}

%  This \nocite command gives citation keys for all the pubs
\nocite{%
  wei16,
  mcba13,
  halp06}

\begin{thebibliography}{1}
  \bibitem{weil6} Wei

  \bibitem{mcha13} Michael Chard

  \bibitem{halp06} Hillary Allen Little-Pinker

\end{thebibliography}

\end{document}

生产

重置计数器

因为.sbb文件看起来像这样

\begin{thebibliography}{1}
\par\addpenalty{-5000}\relax
\item[]\SBtitle
{Books}
\relax
\par\addpenalty{5000}\relax
\bibitem
{halp06}
 Hillary Allen Little-Pinker 


\par\addpenalty{-5000}\relax
\item[]\SBtitle
{\SBmisctitle }
\relax
\par\addpenalty{5000}\relax
\bibitem
[\SBmiscprefix 1]
{weil6}
 Wei 


\bibitem
[\SBmiscprefix 2]
{mcha13}
 Michael Chard 


\end{thebibliography}

显然,这里没有,.bbl因为我们没有使用 BibTeX。

相比之下

\begin{filecontents}{\jobname.bib}
@STRING{jcp = {J. Chem.\ Phys.}}
@Article{wei16,
  author =   {Wei~Wei  and Colin~J. Wallace and George~C. McBane   and Simon~W. North  },
  title =    {Photodissociation Dynamics of {OCS} Near 214 nm Using Ion Imaging},
  journal =      jcp,
  year =     2016,
  volume =   145,
  number =   2,
  pages =    024310}

@Article{mcba13,
  author =   {G.~C. McBane and J.~A. Schmidt and M.~S. Johnson and
                  R. Schinke},
  title =    {Ultraviolet photodissociation of {OCS}: Product
                  energy and angular distributions},
  journal =  jcp,
  year =     2013,
  volume =   138,
  number =   9,
  pages =    094314
}

@BOOK{halp06,
  title = {Experimental Physical Chemistry: A Laboratory Textbook},
  publisher = {W. H. Freeman},
  year = {2006},
  author = {Arthur M. Halpern and George C. McBane},
  address = {New York},
  edition = {3rd}
}

\end{filecontents}

% .tex file begins here
\documentclass{article}
%\usepackage{splitbib}  % works correctly, resetting counters for each category if SBresetdepth>0
\usepackage[export]{splitbib}  % numbers entries continuously throughout

\setcounter{SBresetdepth}{1}

% define categories and their citations
\begin{category}{Books}
\SBentries{halp06}
\end{category}
\begin{category}{Journal Articles}
\SBentries{wei16,mcba13}
\end{category}

\begin{document}
\bibliographystyle{unsrt}

%  This \nocite command gives citation keys for all the pubs
\nocite{%
  wei16,
  mcba13,
  halp06}

\bibliography{\jobname}

\end{document}

生产

unsrt 书目

.sbb在这种情况下,我们在文件中有以下内容

\begin{thebibliography}{1}
\par\addpenalty{-5000}\relax
\item[]\SBtitle
{Books}
\relax
\par\addpenalty{5000}\relax
\bibitem
{halp06}
 Arthur~M. Halpern and George~C. McBane. \newblock {\em Experimental Physical Chemistry: A Laboratory Textbook}. \newblock W. H. Freeman, New York, 3rd edition, 2006. 


\par\addpenalty{-5000}\relax
\item[]\SBtitle
{Journal Articles}
\relax
\par\addpenalty{5000}\relax
\bibitem
{wei16}
 Wei Wei, Colin~J. Wallace, George~C. McBane, and Simon~W. North. \newblock Photodissociation dynamics of {OCS} near 214 nm using ion imaging. \newblock {\em J. Chem.\ Phys.}, 145(2):024310, 2016. 


\bibitem
{mcba13}
 G.~C. McBane, J.~A. Schmidt, M.~S. Johnson, and R.~Schinke. \newblock Ultraviolet photodissociation of {OCS}: Product energy and angular distributions. \newblock {\em J. Chem.\ Phys.}, 138(9):094314, 2013. 


\end{thebibliography}

以及.bbl包含

\begin{thebibliography}{1}

\bibitem{wei16}
Wei Wei, Colin~J. Wallace, George~C. McBane, and Simon~W. North.
\newblock Photodissociation dynamics of {OCS} near 214 nm using ion imaging.
\newblock {\em J. Chem.\ Phys.}, 145(2):024310, 2016.

\bibitem{mcba13}
G.~C. McBane, J.~A. Schmidt, M.~S. Johnson, and R.~Schinke.
\newblock Ultraviolet photodissociation of {OCS}: Product energy and angular
  distributions.
\newblock {\em J. Chem.\ Phys.}, 138(9):094314, 2013.

\bibitem{halp06}
Arthur~M. Halpern and George~C. McBane.
\newblock {\em Experimental Physical Chemistry: A Laboratory Textbook}.
\newblock W. H. Freeman, New York, 3rd edition, 2006.

\end{thebibliography}

可以看出,这.bbl只是标准内容 -splitbib不考虑这个。但现在我们使用 BibTeX,因此参考书目由纯正的内容组成.bbl不是因此.sbb,在这种情况下,书目条目使用的标签不受决定splitbib

编辑

为了获得期望的结果,最简单的方法是切换到 Biblatex/Biber。

例如,

\begin{filecontents}{\jobname.bib}
@STRING{jcp = {J. Chem.\ Phys.}}
@Article{wei16,
  author =   {Wei~Wei  and Colin~J. Wallace and George~C. McBane   and Simon~W. North  },
  title =    {Photodissociation Dynamics of {OCS} Near 214 nm Using Ion Imaging},
  journal =      jcp,
  year =     2016,
  volume =   145,
  number =   2,
  pages =    024310}

@Article{mcba13,
  author =   {G.~C. McBane and J.~A. Schmidt and M.~S. Johnson and
                  R. Schinke},
  title =    {Ultraviolet photodissociation of {OCS}: Product
                  energy and angular distributions},
  journal =  jcp,
  year =     2013,
  volume =   138,
  number =   9,
  pages =    094314
}

@BOOK{halp06,
  title = {Experimental Physical Chemistry: A Laboratory Textbook},
  publisher = {W. H. Freeman},
  year = {2006},
  author = {Arthur M. Halpern and George C. McBane},
  address = {New York},
  edition = {3rd}
}

\end{filecontents}

% .tex file begins here
\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\bibliography{\jobname}

\begin{document}
%  This \nocite command gives citation keys for all the pubs
\nocite{%
  wei16,
  mcba13,
  halp06}

\printbibliography[type=book,title=Books]
\printbibliography[type=article,title=Journal Articles,resetnumbers=true]

\end{document}

生产

Biblatex/Biber 分割书目

如果您需要与条目类型或已存在的条目的任何其他特征不对应的类别.bib,您可以将信息添加到.bib各种表单之一中或在文档中自定义类别。

例如,使用.bib与之前相同的方法,我们可以在文档序言中创建两个任意类别。

\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\bibliography{\jobname}
\DeclareBibliographyCategory{favourites}
\DeclareBibliographyCategory{necessary}
\addtocategory{favourites}{halp06,mcba13}
\addtocategory{necessary}{wei16}

\begin{document}
%  This \nocite command gives citation keys for all the pubs
\nocite{%
  wei16,
  mcba13,
  halp06}

\printbibliography[category=favourites,title=My Favourite Sources,resetnumbers=true]
\printbibliography[category=necessary,title=Necessary Evils,resetnumbers=true]

\end{document}

生产

自定义类别

相关内容