我被要求以作者年份風格製作參考書目,標籤中只有第一作者。如果標籤雄心勃勃,則會在年份後面附加一個字母。這可以使用以下程式碼輕鬆產生(取自使用 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-authoryear
from biblatex-ext
with introcite=label
。
這很好,只是在參考書目條目中附加到年份的字母應該被刪除。我用紅線標記了「有問題」的字母。也就是說:我需要標籤中的字母,但不需要參考書目條目本身。 MWE 的條目應如下所示:
Shepard et al. 2001a
Shepard, Frank and Boris Farmer (2001), ...
我不知道在哪裡改變它。
答案1
在巨集中替換\printdateextra
為:\printdate
data+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}
另一個答案使用程式碼作為mergedate=maximum
基礎並重新定義bbx:ifmergeddate
,issue+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}