按 urldate 排序在线资源

按 urldate 排序在线资源

我想@online按照字段中给出的访问日期对我的资源进行排序urldate

目前,我可以按排序对所有条目进行排序nty,但我希望看到@online按访问日期排序的条目。

\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{westfahl:space,aristotle:physics,ctan,baez/online,markey,sigfridsson}


\printbibliography[title=Unsorted]

\newrefcontext[sorting=nty]
\printbibliography[title=Alphabetic]

\newrefcontext[sorting=ynt]
\printbibliography[title=By year]
\end{document}

问题是,如何根据提取日期进行排序。

答案1

如果您想要@online按来源进行排序urldate,则必须定义一个新的排序模板。参见biblatex 按日期排序,但请注意,我们的方案需要基于url...日期部分。

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,defernumbers=true]{biblatex}

\DeclareSortingTemplate{urldatenty}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{urlyear}
    \literal{9999}
  }
  \sort{
    \field{urlmonth}
    \literal{99}
  }
  \sort{
    \field{urldate}
    \literal{99}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{appleby,
  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  date    = {1980},
  url     = {http://example.com/~sir_humphrey/importance},
  urldate = {2018-10-01}
}
@online{elk,
  author  = {Anne Elk},
  title   = {A Theory on Bronotsauruses},
  date    = {1972},
  url     = {http://example.com/~elk/bronto},
  urldate = {2018-04-06}
}
@online{woolley,
  author  = {Bernard Woolley},
  title   = {On the Ablative Case in Ancient Greek},
  date    = {1981},
  url     = {http://example.com/~wooll/abl},
  urldate = {2018-01-02}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\nocite{sigfridsson,worman,nussbaum,appleby,elk,woolley}

\printbibliography[nottype=online, title={\refname{} (sans \texttt{@online})}]
\newrefcontext[sorting=urldatenty]
\printbibliography[type=online, title={Online sources (sorted by \texttt{urldate})}]
\end{document}

非 <code>@online</code> bib 按 <code>nty</code> 排序(全局方案),<code>@online</code>-bib 按 <code>urldate</code> 排序。

urldatenty在这种情况下,可以通过制定全局排序方案(这意味着您可以摆脱)来实现相同的排序\newrefcontext,但这感觉像是作弊。

相关内容