biblatex 按日期排序

biblatex 按日期排序

我已经编写了自己的 biblatex 样式来引用管辖权。我意识到书目中的排序不是按年份排序的。我将日期字段分配给每个书目项目,但似乎只考虑了年份。查阅手册后,我相信目前没有办法使用日期字段进行排序。

我的问题是,是否有人对如何使用其他排序字段手动按正确顺序对管辖区进行排序有建议?

我知道这远不是一个明智的解决方案,但我的论文将在一周后的周一截止。

因此我很感激您的建议。

最小示例:

\listfiles   
\documentclass[a4paper,11pt]{article} 

\usepackage[utf8]{inputenc}   
\usepackage[ngerman]{babel}   
\usepackage{textcomp} % Zusätzliche Symbole   
\usepackage{filecontents}

\usepackage[babel,german=quotes]{csquotes} %  
\usepackage[style=authortitle,backend=biber,sorting=nyt,date=short,]{biblatex} 


\DeclareFieldFormat[jurisdiction]{number}{\RN{#1}}  
\DeclareFieldFormat{institution}{#1}  
\DeclareFieldFormat{origdate}{#1}  
\newbibmacro*{usera}{  
  \iffieldundef{usera}  
    {}  
    {\printfield{usera}}}  

\newbibmacro*{institution}{%  
  \printlist{institution}%  
  \setunit*{\addspace}%  
  }

\newbibmacro*{number}{%  
  \iffieldundef{number}  
    {}%  
    {\printfield{number}}}  

\newbibmacro*{vom}{
   \printtext{v.}%
   \setunit*{\addspace}%
   }

\newbibmacro*{journaltitle}{  
 \iffieldundef{shortjournal}%  
    {\printfield{journaltitle}}%  
    {\printfield{shortjournal}}%  
  }

\newbibmacro*{note+pages}{%  
  \printfield{note}%  
  \setunit{\bibpagespunct}%  
  \printfield{pages}%  
  \newunit  
}

\newbibmacro*{origdate}{\printorigdate}

\DeclareBibliographyDriver{jurisdiction}{%  
  \usebibmacro{bibindex}%  
  \usebibmacro{begentry}%  
  \usebibmacro{institution}%  
  \usebibmacro{vom}%  
  \usebibmacro{date}%  
  \setunit{\labelnamepunct}\newblock  
  \usebibmacro{usera}  
  \newunit  
  \usebibmacro{journaltitle}  
  \setunit*{\addspace}  
  \usebibmacro{number}  
  \setunit{\addspace}  
  \usebibmacro{origdate}  
  \newunit  
  \usebibmacro{note+pages}  
  \setunit{\bibpagerefpunct}\newblock  
  \usebibmacro{pageref}%  
  \usebibmacro{finentry}}  




\bibliography{Literatur} % Einbinden der bibliographischen Daten. 

\begin{filecontents}{Literatur.bib}  
@jurisdiction{bmf1998,  
  institution = {BMF-Schr.},  
  date = {1998-03-25},  
  shortjournal = {BStBl.},  
  origdate = {1998},  
  number = {1},  
  usera = {},  
  pages = {268--344}  
}  

@jurisdiction{bmf2000a,
  institution = {BMF-Schr.},
  date = {2000-03-29},
  shortjournal = {BStBl.},
  origdate = {2000},
  number = {1},
  usera = {},
  pages = {462--463}
}

@jurisdiction{bmf2000b,
  institution = {BMF-Schr.},
  date = {2000-10-05},
  shortjournal = {BStBl.},
  origdate = {2000},
  number = {1},
  usera = {},
  pages = {1383--1390}
}

@jurisdiction{bmf2000c,
  institution = {BMF-Schr.},
  date = {2000-07-18},
  shortjournal = {BStBl.},
  origdate = {2000},
  number = {1},
  usera = {},
  pages = {1198}
}

@jurisdiction{bmf2000d,
  institution = {BMF-Schr.},
  date = {2000-02-25},
  shortjournal = {BStBl.},
  origdate = {2000},
  number = {1},
  usera = {},
  pages = {372--375}
}

@jurisdiction{bmf2001,
  institution = {BMF-Schr.},
  date = {2001-06-07},
  shortjournal = {BStBl.},
  origdate = {2001},
  number = {1},
  usera = {},
  pages = {367}
}

@jurisdiction{bmf2004,
  institution = {BMF-Schr.},
  date = {2004-11-26},
  shortjournal = {BStBl.},
  origdate = {2004},
  number = {1},
  usera = {},
  pages = {1190--1191}
}

@jurisdiction{bmf2004a,
  institution = {BMF-Schr.},
  date = {2004-03-26},
  shortjournal = {BStBl.},
  origdate = {2004},
  number = {1},
  usera = {},
  pages = {434--441}
}

@jurisdiction{bmf2008,
  institution = {BMF-Schr.},
  date = {2008-07-04},
  shortjournal = {BStBl.},
  origdate = {2008},
  number = {1},
  usera = {},
  pages = {718--729}
}

@jurisdiction{bmf2008,
  institution = {BMF-Schr.},
  date = {2008-08-11},
  shortjournal = {BStBl.},
  origdate = {2008},
  number = {1},
  usera = {},
  pages = {838--845}
}

@jurisdiction{bmf2009,
  institution = {BMF-Schr.},
  date = {2009-05-20},
  shortjournal = {BStBl.},
  origdate = {2009},
  number = {1},
  usera = {},
  pages = {671--672}
}

@jurisdiction{bmf2009a,
  institution = {BMF-Schr.},
  date = {2009-03-26},
  shortjournal = {BStBl.},
  origdate = {2009},
  number = {1},
  usera = {},
  pages = {514}
}

@jurisdiction{bmf2009b,
  institution = {BMF-Schr.},
  date = {2009-02-24},
  shortjournal = {BStBl.},
  origdate = {2009},
  number = {1},
  usera = {},
  pages = {440--444}
}

@jurisdiction{bmf2010,
  institution = {BMF-Schr.},
  date = {2010-04-16},
  shortjournal = {BStBl.},
  origdate = {2010},
  number = {1},
  usera = {},
  pages = {354--367}
}

@jurisdiction{bmf2011,
  institution = {BMF-Schr.},
  date = {2011-07-11},
  shortjournal = {BStBl.},
  origdate = {2011},
  number = {1},
  usera = {},
  pages = {713--715}
}

@jurisdiction{bmf2011a,
  institution = {BMF-Schr.},
  date = {2011-11-11},
  shortjournal = {BStBl.},
  origdate = {2011},
  number = {1},
  usera = {},
  pages = {1314--1415},
}

@jurisdiction{bmf2011b,
  institution = {BMF-Schr.},
  date = {2011-12-08},
  shortjournal = {BStBl.},
  origdate = {2011},
  number = {1},
  usera = {},
  pages = {1279--1286}
}
\end{filecontents}

% ================================================================================================== 
% Beginn des eigentlichen Dokuments. 
\begin{document} 

\nocite{*}


\printbibliography

\end{document}

答案1

編輯莫威(2018-07-14)以符合biblatex>= v3.8 的新名称和排序模板定义。请参阅旧版本的编辑历史。

presort在任何预定义的排序方案下,您都可以使用和字段覆盖书目的顺序sortkeypresort字段用于将书目中的条目分组在一起。字段sortkey用作主排序键。

从 biblatex 手册的附录中,您可以看到预定义的排序方案仅使用和字段建立时间顺序yearvolume使用 biber 作为后端,您还可以使用\DeclareSortingTemplate考虑monthday。当数据不可用时,可以使用指定后备值\literal{<value>}。否则将使用“小”后备值。

这里我定义了一个基于nytfrom 的新排序方案biblatex.def

\documentclass{article}
\usepackage{csquotes}
\usepackage[american]{babel}
\usepackage[backend=biber,sorting=nymdt]{biblatex}

\DeclareSortingTemplate{nymdt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field[padside=left,padwidth=2,padchar=0]{month}
    \literal{00}
  }
  \sort{
    \field[padside=left,padwidth=2,padchar=0]{day}
    \literal{00}
  }
  \sort{
    \field{sorttitle}
  }
  \sort{
    \field[padside=left,padwidth=4,padchar=0]{volume}
    \literal{0000}
  }
}

\begin{filecontents}{\jobname.bib}
@Article{ref1,
  author = {Lastname, Firstname},
  title = {Article entry with presort field},
  journaltitle = {Journal},
  volume = {12},
  date = {2001-01/2001-02},
  pages = {92--122},
  presort = {A}}
@Book{ref2,
  author = {Lastname, Firstname},
  title = {A book entry with presort field},
  year = {2001},
  month = feb,
  day = {11},
  presort = {A}}
@Book{ref3,
  author = {Lastname, Firstname},
  title  = {A book entry with sortkey field},
  date = {2000-01-01},
  sortkey = {1}}
@article{itzhaki:phys,
  author = {Itzhaki, Nissan},
  volume = {54},
  number = {2},
  journal = {Phys. Rev. D},
  doi = {10.1103/PhysRevD.54.1557},
  year = {1996},
  month = {7},
  day = {15},
  title = {Black hole information versus locality},
  pages = {1557--1563}}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{ref1,ref2,ref3}
\nocite{knuth:ct,knuth:ct:a,knuth:ct:b,itzhaki,itzhaki:phys}
\printbibliography
\end{document}

在此处输入图片描述

请注意示例中指定日期的各种方式。字段date遵循yyyy-mm-dd格式,但您可以省略-mm-dd-dd。此字段还接受以分隔的日期范围/(例如yyyy/yyyy,,)。默认情况下,范围的开头用于排序。您还可以使用、和字段指定日期。接受的字符串值,但只能是 3 个字母的缩写(,,,yyyy-mm-dd/yyyy-mm-dd... )。这些必须不带引号或括号(例如)。yyyy/yearmonthdaymonthjanfebmarmonth = jul

您可以使用字段在一定程度上覆盖时间顺序sortyear。在 中biblatex-examples.bibknuth:ct和条目分别被赋予值、和。knuth:ct:aknuth:ct:bsortyear1984-01984-11986-1

对于降序日期,请使用direction=descending的选项设置\sort

\DeclareSortingTemplate{ndymdt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort[direction=descending]{
    \field{sortyear}
    \field{year}
    \literal{9999}
  }
  \sort[direction=descending]{
    \field[padside=left,padwidth=2,padchar=0]{month}
    \literal{99}
  }
  \sort[direction=descending]{
    \field[padside=left,padwidth=2,padchar=0]{day}
    \literal{99}
  }
  \sort{
    \field{sorttitle}
  }
  \sort[direction=descending]{
    \field[padside=left,padwidth=4,padchar=0]{volume}
    \literal{9999}
  }
}

在此处输入图片描述

更多详细信息\DeclareSortingTemplate请参阅 biblatex 手册。

相关内容