如何按字母顺序划分参考书目?

如何按字母顺序划分参考书目?

我正在使用biblatex(与biber),目前正在编写book课程文档。文档末尾会有一个很长的参考书目。

在这个书目中,我希望有按字母顺序排列的部分(A、B、C……)。目的是帮助那些正在寻找参考资料的人;他可以想象自己在 G 部分内(例如)。这是字典的布局类型。

以下是我试图通过视觉展示我想要实现的目标:

**A** (Big "A" with a size of a section)

Author1 , ...
  --, ...
  --, ...
Author2, ...
.
.
.

**B** (Big "B")

Bauthor1, ...
  --, ...
Bauthor2, ...
  --, ...
.
. 
.

当然,我可以向.bib文件中添加关键字,然后告诉 BibLaTeX 打印“A”部分内所有包含关键字“A”的参考文献。但只是为了按字母顺序排序而添加关键字听起来很愚蠢。

以下是 MWE:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx} 
\usepackage{lmodern}
\usepackage{xspace}
\usepackage[style=authoryear-comp,hyperref,backend=biber,isbn=false,doi=false,url=false]{biblatex}
\bibliography{bib}
\title{}
\usepackage[francais]{babel}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}

\begin{document}

\nocite* 
\printbibliography
\end{document}

.bib文件:

@InBook{arwez_title_2000,
  author =   {Paul Arwez},
  title =    {Title},
  chapter =      {Chapter},
  publisher =    {Publisher},
  year =     2000}

@Book{arwez_book_2013,
  author =   {Paul Arwez},
  title =    {Book},
  publisher =    {Publisher},
  year =     2013}

@Book{barwez_book_2013,
  author =   {Paul Barwez},
  title =    {Book},
  publisher =    {Publisher},
  year =     2013}

@Book{carwez_book_2013,
  author =   {Paul Carwez},
  title =    {Book},
  publisher =    {Publisher},
  year =     2013}

@Article{carwez_artic_1873,
  author =   {Paul Carwez},
  title =    {Article},
  journal =      {Journal},
  year =     1876}

.bbl文件:

% $ biblatex auxiliary file $
% $ biblatex bbl format version 2.2 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{[email protected]}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup


\refsection{0}
  \sortlist{entry}{nyt}
    \entry{arwez_title_2000}{inbook}{}
      \name{labelname}{1}{}{%
        {{uniquename=0,hash=378583d49d9a8ada29208d6cb5267d5f}{Arwez}{A\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \name{author}{1}{}{%
        {{uniquename=0,hash=378583d49d9a8ada29208d6cb5267d5f}{Arwez}{A\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \list{publisher}{1}{%
        {Publisher}%
      }
      \strng{namehash}{378583d49d9a8ada29208d6cb5267d5f}
      \strng{fullhash}{378583d49d9a8ada29208d6cb5267d5f}
      \field{sortinit}{A}
      \field{labelyear}{2000}
      \field{labeltitle}{Title}
      \field{chapter}{Chapter}
      \field{title}{Title}
      \field{year}{2000}
    \endentry
    \entry{arwez_book_2013}{book}{}
      \name{labelname}{1}{}{%
        {{uniquename=0,hash=378583d49d9a8ada29208d6cb5267d5f}{Arwez}{A\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \name{author}{1}{}{%
        {{uniquename=0,hash=378583d49d9a8ada29208d6cb5267d5f}{Arwez}{A\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \list{publisher}{1}{%
        {Publisher}%
      }
      \strng{namehash}{378583d49d9a8ada29208d6cb5267d5f}
      \strng{fullhash}{378583d49d9a8ada29208d6cb5267d5f}
      \field{sortinit}{A}
      \field{labelyear}{2013}
      \field{labeltitle}{Book}
      \field{title}{Book}
      \field{year}{2013}
    \endentry
    \entry{barwez_book_2013}{book}{}
      \name{labelname}{1}{}{%
        {{uniquename=0,hash=d0455efa6586ff2338c954fc0860f0d2}{Barwez}{B\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \name{author}{1}{}{%
        {{uniquename=0,hash=d0455efa6586ff2338c954fc0860f0d2}{Barwez}{B\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \list{publisher}{1}{%
        {Publisher}%
      }
      \strng{namehash}{d0455efa6586ff2338c954fc0860f0d2}
      \strng{fullhash}{d0455efa6586ff2338c954fc0860f0d2}
      \field{sortinit}{B}
      \field{labelyear}{2013}
      \field{labeltitle}{Book}
      \field{title}{Book}
      \field{year}{2013}
    \endentry
    \entry{carwez_artic_1873}{article}{}
      \name{labelname}{1}{}{%
        {{uniquename=0,hash=baa123e8e737243bb6575c9b2955a321}{Carwez}{C\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \name{author}{1}{}{%
        {{uniquename=0,hash=baa123e8e737243bb6575c9b2955a321}{Carwez}{C\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \strng{namehash}{baa123e8e737243bb6575c9b2955a321}
      \strng{fullhash}{baa123e8e737243bb6575c9b2955a321}
      \field{sortinit}{C}
      \field{labelyear}{1876}
      \field{labeltitle}{Article}
      \field{journaltitle}{Journal}
      \field{title}{Article}
      \field{year}{1876}
    \endentry
    \entry{carwez_book_2013}{book}{}
      \name{labelname}{1}{}{%
        {{uniquename=0,hash=baa123e8e737243bb6575c9b2955a321}{Carwez}{C\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \name{author}{1}{}{%
        {{uniquename=0,hash=baa123e8e737243bb6575c9b2955a321}{Carwez}{C\bibinitperiod}{Paul}{P\bibinitperiod}{}{}{}{}}%
      }
      \list{publisher}{1}{%
        {Publisher}%
      }
      \strng{namehash}{baa123e8e737243bb6575c9b2955a321}
      \strng{fullhash}{baa123e8e737243bb6575c9b2955a321}
      \field{sortinit}{C}
      \field{labelyear}{2013}
      \field{labeltitle}{Book}
      \field{title}{Book}
      \field{year}{2013}
    \endentry
  \endsortlist
\endrefsection
\endinput

答案1

您可以为字母表中的每个字母创建一个类别,并且使用\AtDataInput根据字段向每个类别添加条目sortinit

\documentclass{book}
\usepackage[style=alphabetic]{biblatex}

\addbibresource{biblatex-examples.bib}
\nocite{angenendt,bertram,doody,gillies}

% user-level test for skipbib enabled (e.g. related entry matuz:doody)
\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}
\AtDataInput{\ifskipbib{}{\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}

\begin{document}
\printbibheading
\bibbycategory
\end{document}

在此处输入图片描述

请注意,我们需要访问一些内部信息以避免在参考书目中跳过条目。我总是忘记将这些切换值提供给用户,但我们很快就会解决这个问题。

答案2

这里是内部的破解bibitem

\documentclass[]{scrartcl}

\usepackage[style=alphabetic]{biblatex}
\makeatletter
\def\blx@head@tempa{0}
\def\blx@bibitem#1{%
  \blx@ifdata{#1}
    {\begingroup
     \blx@getdata{#1}%
     \blx@imc@iffieldequals{sortinit}\blx@head@tempa{}{\item[]\textbf{\thefield{sortinit}}}%
       \global\let\blx@head@tempa\abx@field@sortinit%
     \blx@bibcheck
       \global\let\blx@noitem\@empty
     \iftoggle{blx@skipentry}{}{%
       \blx@setoptions@type\abx@field@entrytype
       \blx@setoptions@entry
       \blx@thelabelnumber
       \blx@addprefixnumber
       \addtocounter{instcount}\@ne
       \csuse{blx@item@\blx@theenv}\relax
       \blx@initsep
       \blx@namesep
       \csuse{blx@hook@bibitem}%
       \blx@execute
       \blx@initunit
       \blx@anchor
       \blx@beglangbib
       \bibsentence
       \blx@pagetracker
       \blx@driver\abx@field@entrytype
       \blx@postpunct
       \blx@endlangbib}%
     \endgroup}
    {}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

在此处输入图片描述

答案3

虽然有时在索引中使用“标题字母”来标记字母部分,但我从未在参考书目中遇到过这样的字母。我建议只在字母部分之间添加额外的间距;使用,只需将长度设置为正值biblatex即可完成此操作。\bibinitsep

\documentclass{book}

\usepackage[style=authoryear]{biblatex}

\setlength{\bibinitsep}{\baselineskip}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{A02,
  author = {Author, A.},
  year = {2002},
  title = {And now for something completely different},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

在此处输入图片描述

答案4

免责声明:这是一种解决方法,而不是解决方案。

您可以使用biblatex的功能根据keywords字段过滤书目条目来执行此操作。您需要做的就是添加keywords = {<letter>}到每个书目条目,然后\printbibliography[keyword=<letter>]我们会为您完成其余工作:

输出

我不得不使用我的参考书目,因为你的无法正确显示(不确定原因)。此外,\bibliography{<file>}现已弃用,因此我将其替换为\addbibresource{<file>.ext}。请参阅下面的示例。

\documentclass[12pt,twoside,a4paper]{book}
\begin{filecontents}{bib.bib}
@Article{a:agrawal:2001:01,
  title         = {Phenotypic Plasticity in the Interactions and Evolution of Species},
  author        = {Agrawal, Anurag A.},
  journal       = {Science},
  year          = {2001},
  month         = oct,
  volume        = {294},
  number        = {5541},
  pages         = {321--326},
  doi           = {10.1126/science.1060701},
  url           = {http://dx.doi.org/10.1126/science.1060701},
  keywords      = {A},
}

@Article{a:auld:2010:01,
  title         = {Re-evaluating the Costs and Limits of Adaptive Phenotypic Plasticity},
  author        = {Auld, Josh R. and Agrawal, Anurag A. and Relyea, Rick A.},
  journal       = {Proceedings of the Royal Society B: Biological Sciences},
  year          = {2010},
  month         = feb,
  volume        = {277},
  number        = {1681},
  pages         = {503--511},
  doi           = {10.1098/rspb.2009.1355},
  url           = {http://dx.doi.org/10.1098/rspb.2009.1355},
  keywords      = {A},
}

@Article{a:brown:2013:01,
  title         = {What Evolvability Really Is},
  author        = {Brown, Rachael L.},
  journal       = {The British Journal for the Philosophy of Science},
  year          = {2013},
  month         = aug,
  doi           = {10.1093/bjps/axt014},
  url           = {http://dx.doi.org/10.1093/bjps/axt014},
  keywords      = {B},
}

@Article{a:clune:2013:01,
  title         = {The Evolutionary Origins of Modularity},
  author        = {Clune, Jeff and Mouret, Jean-Baptiste and Lipson, Hod},
  journal       = {Proceedings of the Royal Society B: Biological Sciences},
  year          = {2013},
  month         = mar,
  volume        = {280},
  number        = {1755},
  doi           = {10.1098/rspb.2012.2863},
  url           = {http://dx.doi.org/10.1098/rspb.2012.2863},
  keywords      = {C},
}

@Article{a:dias:2013:01,
  title         = {Parental Olfactory Experience Influences Behavior and Neural Structure in Subsequent Generations},
  author        = {Dias, Brian G. and Ressler, Kerry J.},
  journal       = {Nature Neuroscience},
  publisher     = {Nature Publishing Group},
  year          = {2013},
  month         = dec,
  volume        = {},
  number        = {},
  pages         = {1546--1726},
  doi           = {10.1038/nn.3594},
  url           = {http://dx.doi.org/10.1038/nn.3594},
  keywords      = {D},
}
\end{filecontents}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{xspace}
\usepackage[style=authoryear-comp,hyperref,backend=biber,isbn=false,doi=false,url=false]{biblatex}
\addbibresource{bib.bib}
\title{}
\usepackage[francais]{babel}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}

\begin{document}

\nocite{*}
% \printbibliography
\printbibliography[keyword=A,title={A},heading=subbibliography]
\printbibliography[keyword=B,title={B},heading=subbibliography]
\printbibliography[keyword=C,title={C},heading=subbibliography]
\printbibliography[keyword=D,title={D},heading=subbibliography]
\end{document}

相关内容