如何自动获取引用中的日期“origdate”?

如何自动获取引用中的日期“origdate”?

我正在authoryear使用biblatex

例如,当我输入时\parencite[p.6]{gusfield2009},我得到:

(Gusfield,2009 年,第 6 页)

如何获取origdate引文中的条目以便获得:

(Gusfield,[1981] 2009,第 6 页)

答案1

如果你只想要origdate引用,你需要

\documentclass[a4paper,british]{article}
\usepackage[utf8]{inputenc} 
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{test,
  author  = {Walter Ordsmith},
  title   = {An Old Work},
  date    = {2010},
  edition = {5},
  origdate = {1981},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareFieldFormat{origdate}{\mkbibbrackets{#1}}
\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \printorigdate
     \setunit*{\addspace}
     \usebibmacro{cite:labeldate+extradate}}
    {\usebibmacro{cite:shorthand}}}

\begin{document}
  \cite{test} and \parencite[6]{test}
  \printbibliography
\end{document}

产量 在此处输入图片描述


编辑

以下方法将其纳入origdate更多引用命令和参考书目。

\documentclass[a4paper,british]{article}
\usepackage[utf8]{inputenc} 
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,mergedate=maximum]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{test,
  author  = {Walter Ordsmith},
  title   = {An Old Work},
  date    = {2010},
  edition = {5},
  origdate = {1981},
}
@book{testn,
  author  = {Walter Ordsmith},
  title   = {A New Work},
  date    = {2013},
}
@book{testm,
  author  = {Walter Ordsmith},
  title   = {A Very Old Work},
  date    = {2000},
  edition = {8},
  origdate = {1882},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareFieldFormat{origdate}{\mkbibbrackets{#1}}
\renewbibmacro*{cite:labeldate+extradate}{%
  \iffieldundef{origyear}
    {}
    {\printorigdate
     \setunit{\addspace}}%
  \iffieldundef{labelyear}
    {}
    {\printtext[bibhyperref]{\printlabeldateextra}}}

\DeclareCiteCommand{\citeorigyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield{origyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\renewbibmacro*{date+extradate}{%
  \iffieldundef{origyear}
    {}
    {\printorigdate
     \setunit{\addspace}}%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{%
       \iflabeldateisdate
         {\printdateextra}
         {\printlabeldateextra}}}}

\begin{document}
  \cite{test} and \parencite[6]{test}.
  And \parencite[6]{testn} is nice and \textcite{testm} was written in \citeyear{testm}.

  \nocite{*}
  \printbibliography
\end{document}

给出 在此处输入图片描述

答案2

另一个选择是使用 biblatex-chicago 包,它带有支持样式origdate

所以

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{hume_1751_enquiry,
    origdate = {1751},
    date = {1975-06-12},
    author = {Hume, David},
    title = {An Enquiry Concerning the Principles of Morals},
    booktitle = {Enquiries Concerning Human Understanding and
        Concerning the Principles of Morals},
    editor = {Selby-Bigge, L. A. and Nidditch, P. H.},
    annotation = {Selby-Bigge and Nidditch's 1975 edition is
        based off a collection of Hume's essays postumously
        published in 1777. Hume's ``An Equiry Concerning the
        Principles of Morals" was first published in 1751.},
    publisher = {Oxford University Press},
    location = {New York},
    edition = {3},
    isbn = {978-0-19-824536-0}
}
\end{filecontents}

\usepackage[authordate,
    backend=biber,
    sorting=nyt,
    backref=true,
    alldates=iso8601,
    cmsdate=both,
    annotation=true]{biblatex-chicago}
\addbibresource{\jobname.bib}

\begin{document}

Lorem \autocite[179]{hume_1751_enquiry}.

\printbibliography

\end{document}

将导致

cmsdate 两者

cmsdate选项控制如何在引文和参考列表中显示origdate和。我个人的偏好是使用哪个,其效果是消除引文中的字段,但在参考条目中显示两个日期(将移动到条目末尾):datecmsdate=ondatedate

cmsdate 日期

如果你想遵循《芝加哥格式手册》,指定不使用“p.”作为页码前面的。但如果您愿意,您可以使用...

\autocite[p. 179]{hume_1751_enquiry}.

... 回来 ...

(休谟[1751] 1975,第 179 页)

更新

然而,更好的方法是将以下代码添加到您的序言中,以自动插入“p。”和“pp。”(而不是手动指定)...

\DeclareFieldFormat{postnote}{\mkpageprefix[pagination]{#1}}
\DeclareFieldFormat{volcitepages}{\mkpageprefix[pagination]{#1}}
\DeclareFieldFormat{multipostnote}{\mkpageprefix[pagination]{#1}}

...正如 moewe 在评论中所建议的那样。

相关内容