autoryear-ext 與 introcite=label:從參考書目條目中刪除額外字母,但不從標籤中刪除

autoryear-ext 與 introcite=label:從參考書目條目中刪除額外字母,但不從標籤中刪除

我被要求以作者年份風格製作參考書目,標籤中只有第一作者。如果標籤雄心勃勃,則會在年份後面附加一個字母。這可以使用以下程式碼輕鬆產生(取自使用 biblatex 和 biber 建立具有固定縮排和作者年份標籤的參考書目):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=ext-authoryear, backend=biber, maxcitenames=1, uniquename=false, uniquelist=false, introcite=label, dashed=false]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
  @book{Shepard2001a,
  author = {Shepard, Frank and Fisher, John},
  year = {2001},
  title = {Livestock management},
}
@book{Shepard2001b,
  author = {Shepard, Frank and Farmer, Boris},
  year = {2001},
  title = {On food supplies},
}
\end{filecontents*}
\addbibresource{\jobname.bib} % if you’re using biblatex\addbibresource{biblatex-examples.bib}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{6em}

\begin{document}
  \cite{Shepard2001a, Shepard2001b}
  \printbibliography
\end{document}

如您所見,我正在使用ext-authoryearfrom biblatex-extwith introcite=label

結果看起來像這樣: 在此輸入影像描述

這很好,只是在參考書目條目中附加到年份的字母應該被刪除。我用紅線標記了「有問題」的字母。也就是說:我需要標籤中的字母,但不需要參考書目條目本身。 MWE 的條目應如下所示:

Shepard et al. 2001a
   Shepard, Frank and Boris Farmer (2001), ...

我不知道在哪裡改變它。

答案1

在巨集中替換\printdateextra為:\printdatedata+extradate

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=ext-authoryear, backend=biber, maxcitenames=1, uniquename=false, uniquelist=false, introcite=label, dashed=false]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
  @book{Shepard2001a,
  author = {Shepard, Frank and Fisher, John},
  year = {2001},
  title = {Livestock management},
}
@book{Shepard2001b,
  author = {Shepard, Frank and Farmer, Boris},
  year = {2001},
  title = {On food supplies},
}
\end{filecontents*}
\addbibresource{\jobname.bib} % if you’re using biblatex\addbibresource{biblatex-examples.bib}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{6em}

\makeatletter
  \renewbibmacro*{date+extradate}{%
    \iffieldundef{labelyear}
      {}
      {\printtext[\blx@delimcontext labeldate]{%
         \iflabeldateisdate
           {\printfield{issue}%
            \setunit*{\addspace}%
            \printdate}
           {\printlabeldateextra}}}}%
  \renewbibmacro*{bbx:ifmergeddate}{\iflabeldateisdate}%
  \renewbibmacro*{issue+date}{%
    \usebibmacro{bbx:ifmergeddate}
      {}
      {\printtext[issuedate]{%
         \printfield{issue}%
         \setunit*{\addspace}%
         \printdate}}}
\makeatother

\begin{document}
  \cite{Shepard2001a, Shepard2001b}
  \printbibliography
\end{document}

在此輸入影像描述

答案2

日期列印的代碼會隨所選mergedate設定的不同而變化。預設mergedate=true相當於mergedate=compact,其中可以如下避免修改。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=ext-authoryear, backend=biber,
  maxcitenames=1, uniquename=false, uniquelist=false,
  introcite=label, dashed=false]{biblatex}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{6em}

\makeatletter
\renewbibmacro*{date+extradate}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[\blx@delimcontext labeldate]{%
       \iflabeldateisdate
         {\printdate}
         {\printlabeldate}}}}
\makeatother


\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @book{Shepard2001a,
  author = {Shepard, Frank and Fisher, John},
  year   = {2001},
  title  = {Livestock management},
}
@book{Shepard2001b,
  author = {Shepard, Frank and Farmer, Boris},
  year   = {2001},
  title  = {On food supplies},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
  \cite{Shepard2001a, Shepard2001b}
  \printbibliography
\end{document}

謝潑德等人。 2001a/謝潑德、弗蘭克和鮑里斯法默 (2001)。關於食品供應。 2001b/謝潑德、弗蘭克和約翰費雪 (2001)。牲畜管理。

另一個答案使用程式碼作為mergedate=maximum基礎並重新定義bbx:ifmergeddateissue+date儘管這不是必需的。在此處的程式碼中,我們也刪除了falseextradate情況下的信息\iflabeldateisdate


具有不同輸出的另一種選擇是將authoryear引文與authortitle參考書目結合。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, bibstyle=ext-authortitle, citestyle=ext-authoryear,
  sorting=nyt,
  maxcitenames=1, uniquename=false, uniquelist=false,
  introcite=label, dashed=false]{biblatex}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{6em}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @book{Shepard2001a,
  author = {Shepard, Frank and Fisher, John},
  year   = {2001},
  title  = {Livestock management},
}
@book{Shepard2001b,
  author = {Shepard, Frank and Farmer, Boris},
  year   = {2001},
  title  = {On food supplies},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
  \cite{Shepard2001a, Shepard2001b}
  \printbibliography
\end{document}

謝潑德等人。 2001a/謝潑德、弗蘭克和鮑里斯·法默。關於食品供應。 2001.//謝潑德等。 2001b/謝潑德、弗蘭克和約翰費雪。牲畜管理。 2001年。

相關內容