Biblatex:文本的作者年份,參考書目的作者標題

Biblatex:文本的作者年份,參考書目的作者標題

我處於不幸的境地,我必須如標題所述引用。

只要不存在同一作者和同一年份的兩個不同的參考書目條目,那就沒問題。在這種情況下,我會輸入類似(Author 2012a)和的文字條目,(Author 2012b)但在參考文獻中應該附加一個看起來像 的條目(cited as: 2012a)

我在 biblatex 中重新定義東西來處理這個問題不夠好。理想情況下需要以下解決方案:

If there are multiple citations of the same author and year, then append "(cited as: <year><year_label>)", if not, do whatever you would normally do.

目前這是我的最小工作範例:

\documentclass{article}
\usepackage[maxcitenames=3,style=authortitle,citestyle=authoryear,dashed=false,backend=biber]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\newbibmacro*{publisher+location+date}{%
      \printlist{publisher}%
      \iflistundef{location}
        {\setunit*{\addcomma\space}}
        {\setunit*{\addcolon\space}}%
      \printlist{location}%
      \setunit*{\space}%
      \usebibmacro{date}%
      \newunit
    }

\begin{filecontents}{\jobname.bib}
  @article{JoeDoe2012,
    Author = {Joe Doe},
    Title = {My article's title},
    Journal = {My journal's title},
    Editor = {Ben Editor},
    URL = {http://webpage.com},
    Year = {2012},
  }

  @article{JoeDoe20121,
    Author = {Joe Doe},
    Title = {Same author same year},
    Journal = {My journal's title},
    Editor = {Ben Editor},
    URL = {http://webpage.com},
    Year = {2012},
  }
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
  We cite \autocite{JoeDoe2012} and \autocite{JoeDoe20121}
  \printbibliography
\end{document}

目前這看起來像:

在此輸入影像描述

雖然我被迫這樣做:

在此輸入影像描述

addendum = {(cited as: 2012a)}(在螢幕截圖中,我透過手動插入「 )」解決了該問題

我希望有人可以幫助我以我所描述的有條件的方式實現這一目標。

答案1

重命名德bibmacro{finentry}. 'a' 部分是 intoextrayear字段和2012intolabelyear字段。然後加入一個邏輯,即 if extrayearis undefined 不列印任何內容。另一方面,如果已定義,則列印括號之間的labelyearentrayear欄位。

微量元素:

\documentclass{article}
\usepackage[maxcitenames=3,style=authortitle,citestyle=authoryear,dashed=false,backend=biber]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\newbibmacro*{publisher+location+date}{%
      \printlist{publisher}%
      \iflistundef{location}
        {\setunit*{\addcomma\space}}
        {\setunit*{\addcolon\space}}%
      \printlist{location}%
      \setunit*{\space}%
      \usebibmacro{date}%
      \newunit
    }

\renewbibmacro{finentry}{%
\usebibmacro{citeas}%
\finentry}

\newbibmacro*{citeas}{%
\iffieldundef{extrayear}
  {}
  {\setunit{\adddot\space}
  \newunit\newblock
  \printtext[citeas]{%
  \printfield{labelyear}%
  \printfield{extrayear}}}}

\DeclareFieldFormat{citeas}{\mkbibparens{Cite as:\space#1}}

\begin{filecontents}{\jobname.bib}
  @article{JoeDoe2012,
    Author = {Joe Doe},
    Title = {My article's title},
    Journal = {My journal's title},
    Editor = {Ben Editor},
    URL = {http://webpage.com},
    Year = {2012},
  }

  @article{JoeDoe20121,
    Author = {Joe Doe},
    Title = {Same author same year},
    Journal = {My journal's title},
    Editor = {Ben Editor},
    URL = {http://webpage.com},
    Year = {2012},
  }

    @article{Moe2013,
      Author = {Moe Doe},
      Title = {Other author},
      Journal = {My journal's title},
      Editor = {Ben Editor},
      URL = {http://webpage.com},
      Year = {2010},
    }
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
  We cite \parencite{JoeDoe2012} and \parencite{JoeDoe20121}.

  Other author \parencite{Moe2013}
  \printbibliography
\end{document}

在此輸入影像描述

相關內容