我被要求制作一个作者年份格式的书目,标签中只有第一作者。如果标签太过激进,则会在年份后附加一个字母。这可以通过以下代码轻松制作(取自使用 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
,尽管这不是必要的。在此处的代码中,我们还删除了extradate
在 where 为 false 的情况下的信息\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}