我正在写一篇论文,其中多次引用了多年来在多个日期发行的同名报纸/期刊。我试图按期刊名称将这些参考文献分组,以便同一期刊的参考书目条目紧密相连,并与其他期刊的其他条目分开。
我仔细查阅了 biblatex 文档,能找到的唯一相关信息是bibnamesep
和bibitemsep
长度寄存器。它们似乎完全符合我的要求 - 具有相同标题的期刊的 bibitem 应该比不同的 bibitem 更接近。这里唯一的挑战是 bibnamesep 似乎使用名称部分和唯一性模板按作者姓名(而不是按标题)将作品分组。
这是我的 MWE:
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[T1]{fontenc} % Specify font encoding
\usepackage[utf8]{inputenc} % Specify encoding (for example, UTF-8)
\usepackage[dashed=false,sorting=nyt,style=verbose,labeldateparts=true,uniquelist=true,uniquename=true,singletitle=true]{biblatex}
% Preamble - Here you can load packages and define settings
\usepackage[english]{babel}
\begin{filecontents*}[overwrite]{mwe.bib}
@periodical{TheSun:20220101,
title = {The Sun},
date = {2022-01-01}
}
@periodical{TheTimes:20220601,
title = {The Sun},
date = {2022-06-01}
}
@periodical{TheTimes:20220901,
title = {The Sun},
date = {2022-09-01}
}
@periodical{TheGuardian:20210217,
title = {The Guardian},
date = {2021-02-17}
}
@periodical{TheGuardian:20210311,
title = {The Guardian},
date = {2021-03-11}
}
@periodical{TheGuardian:20210410,
title = {The Guardian},
date = {2021-04-10}
}
@periodical{TheAlmanac:202302,
title = {The Almanac},
date = {2023-02}
}
@periodical{TheAlmanac:202303,
title = {The Almanac},
date = {2023-03}
}
@periodical{TheAlmanac:202304,
title = {The Almanac},
date = {2023-04}
}
\end{filecontents*}
\addbibresource{mwe.bib}
\DeclareSortingTemplate{TitleYear}{
\sort{
\field{title}
}
\sort{
\field{sortyear}
\field{year}
\literal{9999}
}
\sort{
\field{month}
}
\sort{
\field{day}
}
}
\begin{document}
\bibitemsep=1pt
\bibnamesep=30pt
\nocite{*}
\begin{refcontext}[sorting=TitleYear]
\printbibliography
\end{refcontext}
\end{document}
它包含 9 个@periodical
条目 - 《太阳报》3 个、《卫报》3 个、《年鉴》3 个。它使用排序模板按期刊标题对条目进行排序,并将\bibitemsep
和\bibnamesep
分别设置为 1pt 和 30pt。这是我无法工作的一点:
正如您在上图中所看到的,所有参考文献之间都有 30pt 的间隔,而我希望“The Almanac”两个条目之间有 1pt 的间隔,但“The Almanac”和“The Guardian”之间有 30pt 的间隔。
答案1
\bibnamesep
仅适用于 中编码名称不同的条目fullhash
。如果要将其更改为title
,可以尝试(本地)重新定义设置分隔符的相关内部宏。
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[
style=verbose,
sorting=nyt,
dashed=false,
labeldateparts=true,
uniquelist=true,uniquename=true,
singletitle=true,
]{biblatex}
\makeatletter
\def\blx@namesep@title{%
\ifnum\c@instcount>\@ne
\blx@imc@iffieldequals{title}\blx@prevtitle
{}
{\addvspace{\bibnamesep}}%
\fi
\global\let\blx@prevtitle\abx@field@title}
\newcommand*{\NamesepByTitle}{\let\blx@namesep\blx@namesep@title}
\makeatother
\DeclareSortingTemplate{TitleYear}{
\sort{
\field{title}
}
\sort{
\field{sortyear}
\field{year}
\literal{9999}
}
\sort{
\field{month}
}
\sort{
\field{day}
}
}
\begin{filecontents*}[overwrite]{\jobname.bib}
@periodical{TheSun:20220101,
title = {The Sun},
date = {2022-01-01}
}
@periodical{TheTimes:20220601,
title = {The Sun},
date = {2022-06-01}
}
@periodical{TheTimes:20220901,
title = {The Sun},
date = {2022-09-01}
}
@periodical{TheGuardian:20210217,
title = {The Guardian},
date = {2021-02-17}
}
@periodical{TheGuardian:20210311,
title = {The Guardian},
date = {2021-03-11}
}
@periodical{TheGuardian:20210410,
title = {The Guardian},
date = {2021-04-10}
}
@periodical{TheAlmanac:202302,
title = {The Almanac},
date = {2023-02}
}
@periodical{TheAlmanac:202303,
title = {The Almanac},
date = {2023-03}
}
@periodical{TheAlmanac:202304,
title = {The Almanac},
date = {2023-04}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\bibitemsep=1pt
\bibnamesep=30pt
\nocite{*}
\begin{refcontext}[sorting=TitleYear]
\NamesepByTitle
\printbibliography
\end{refcontext}
\end{document}