我一直在使用 biblatex,并参考了本书中的一些答案。
缩写列表分为 4 个部分,其中 3 个部分为讨论的主要作者,另一个部分为其他主要文本
本书的书目分为 5 个子书目,其中 3 个为主要作者,1 个为其他主要文本,最后一个为次要文本。
一切正常,除了子围兜中出现了一些不必要的多余线条。下面是一个由 MWE 生成的示例,其中 Benacerraf & Putnam 的条目和 Berger 的条目之间有一条额外的线条:
不幸的是,MWE 有点长:
\documentclass[a4,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[english=american]{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Moore1903,
author = {Moore, G. E.},
title = {Principia Ethica},
date = {1903},
publisher = {Cambridge University Press},
location = {Cambridge},
shorthand = {PE},
}
@Book{Frege1893,
author = {Frege, Gottlob},
title = {Grundgesetze der Arithmetik},
date = {1893},
volume = {I},
publisher = {Hermann Pohle},
location = {Jena},
related = {Frege2013a},
relatedtype = {englishtitle},
shorthand = {BLI},
shorttitle = {Grundgesetze I},
}
@Book{Frege2013a,
author = {Frege, Gottlob},
title = {{B}asic {L}aws of {A}rithmetic, \emph{Vol. I}},
date = {2013},
}
@Article{Candlish1989,
author = {Candlish, Stewart},
title = {The Truth about F. H. Bradley},
journaltitle = {Mind},
date = {1989},
volume = {98},
number = {391},
pages = {331--48},
}
@Collection{Benacerraf1984,
editor = {Benacerraf, Paul and Putnam, Hilary},
title = {Philosophy of Mathematics: Selected Readings},
date = {1984},
edition = {revised and expanded},
publisher = {Prentice-Hall},
location = {Englewood Cliffs, NJ},
}
@Book{Bell1979,
author = {Bell, David},
title = {Frege's Theory of Judgment},
date = {1979},
publisher = {Clarendon Press},
location = {Oxford},
}
@Book{Wittgenstein1979,
author = {Wittgenstein, Ludwig},
title = {Notebooks, 1914--1916},
date = {1979},
editor = {Wright, G. H. von and Anscombe, G. E. M.},
translator = {Anscombe, G. E. M.},
edition = {2},
publisher = {Basil Blackwell},
location = {Oxford},
origyear = {1913},
shorthand = {NB},
shorttitle = {Notebooks},
}
@Book{Russell1903a,
author = {Russell, Bertrand},
title = {The Principles of Mathematics},
date = {1903},
publisher = {Cambridge University Press},
location = {Cambridge},
shorthand = {PoM},
shorttitle = {Principles},
}
@Collection{Berger2011,
editor = {Berger, Alan},
title = {Saul Kripke},
date = {2011},
publisher = {Cambridge University Press},
location = {Cambridge},
}
\end{filecontents}
\usepackage[style=oxyear,indexing=cite,issuestyle=parens,natbib=true]{biblatex}
\usepackage{citeall}
\addbibresource{\jobname.bib}
% Environment for Abbreviation lists with the shorthands italicized by \emph
\DeclareFieldFormat{shorthand}{\emph{#1}}
\defbibenvironment{abbrevs}
{\list
{\printfield[shorthandwidth]{shorthand}}
{\setlength{\labelwidth}{\shorthandwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{\emph{##1}\hss}}}
{\endlist}
{\item}
% Titles for Parts of Bibliography
\defbibheading{subbibtitleonly}[\bibname]{%
\section*{#1}}
% Main primary sources categories
\newcommand*{\generateauthorcategory}[3]{%
\DeclareBibliographyCategory{by#1}%
\DeclareIndexNameFormat{cat#1}{%
\ifboolexpr{%
test {\ifdefstring{\namepartfamily}{#2}}%
and%
test {\ifdefstring{\namepartgiven}{#3}}%
}%
{\addtocategory{by#1}{\thefield{entrykey}}}%
{}}%
\AtDataInput{\indexnames[cat#1][1-999]{author}}}
\generateauthorcategory{frege}{Frege}{Gottlob}
\generateauthorcategory{russell}{Russell}{Bertrand}
\generateauthorcategory{moore}{Moore}{G.\bibnamedelimi E.}
% Filter for other primary sources, but NOT main ones
\defbibfilter{notmainprimary}{%
not category=byfrege %
and not category=bymoore %
and not category=byrussell %
}
% Check for all primary sources and another for secondary sources
\defbibcheck{primarysource}{
\iffieldint{origyear}
{\ifnumless{\thefield{origyear}}{1936}
{}
{\skipentry}
}
{\iffieldint{year}
{\ifnumless{\thefield{year}}{1936}
{}
{\skipentry}
}
{\skipentry}
}
}
\defbibcheck{secondarysource}{
\iffieldint{origyear}
{\ifnumgreater{\thefield{origyear}}{1936}
{}
{\skipentry}
}
{\iffieldint{year}
{\ifnumgreater{\thefield{year}}{1936}
{}
{\skipentry}
}
{\skipentry}
}
}
% Filtering entries for abbreviations lists
\DeclareBiblistFilter{fregeabbrevs}{
\filter[type=field,filter=shorthand]
}
\DeclareBiblistFilter{mainabbrevs}{
\filter[type=field,filter=shorthand]
}
\DeclareBiblistFilter{moreabbrevs}{
\filter[type=field,filter=shorthand]
}
% Sorting the abbreviations lists
\DeclareSortingTemplate{fregeabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{shorthand} } }
\DeclareSortingTemplate{mainabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{shorthand} } }
\DeclareSortingTemplate{moreabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{author} } }
% Adding English titles of Frege's works (from entries related to) to German entries in Bibliography
\newbibmacro*{related:englishtitle}[1]{%
\entrydata{#1}{%
\printtext{English title:}%
\setunit{\addspace}%
\usebibmacro{title}}}
% Drivers for printing abbreviations lists
\DeclareBibliographyDriver{fregeabbrevs}{%
\iffieldequalstr{relatedtype}{englishtitle}
{\entrydata{\thefield{related}}{\usebibmacro{title}}}
{{\usebibmacro{title}}}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\DeclareBibliographyDriver{mainabbrevs}{%
\usebibmacro{title}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\DeclareBibliographyDriver{moreabbrevs}{%
\renewbibmacro*{date+extradate}{}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\begin{document}
\chapter*{Abbreviations}
The following abbreviations are for frequently cited primary sources. Full details of these works are in the Bibliography.
\printbiblist[env=abbrevs,title={Writings of Frege}, heading=subbibtitleonly, category=byfrege]{fregeabbrevs}
\printbiblist[env=abbrevs,title={Writings of Moore}, heading=subbibtitleonly, category=bymoore]{mainabbrevs}
\printbiblist[env=abbrevs,title={Writings of Russell}, heading=subbibtitleonly, category=byrussell]{mainabbrevs}
\printbiblist[env=abbrevs,title={Other Primary Sources}, heading=subbibtitleonly, check=primarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]{moreabbrevs}\newpage
\citeall
\chapter*{Bibliography}
\printbibliography[title={Writings of Frege}, heading=subbibtitleonly, category=byfrege]
\printbibliography[title={Writings of Moore}, heading=subbibtitleonly, category=bymoore]
\printbibliography[title={Writings of Russell}, heading=subbibtitleonly, category=byrussell]
\printbibliography[title={Other Primary Sources}, heading=subbibtitleonly, check=primarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]
\printbibliography[title={Secondary Sources}, heading=subbibtitleonly, check=secondarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]
\end{document}
显然,问题并没有得到解决参考书目中出现多余的行
原因是,如果使用\printbibliography
而不是 ,\chapter*{Bibliography}
并且使用 5 个后续命令来打印子书目,则生成的没有子书目的书目不会有多余的行:
非常感谢您的帮助!
答案1
当你注意到以下情况时,你实际上已经接近自己调试这个问题了:
原因是,如果使用
\printbibliography
而不是 ,\chapter*{Bibliography}
并且使用后续 5 个命令来打印子书目,则生成的没有子书目的书目不会有多余的行。
这让我们找到了有问题的参考书目中唯一不同的东西,即检查secondarysource
。我不确定为什么检查会在那里引入虚假空格,但显然确实如此,因为如果我们使用以下方法处理它们:
\defbibcheck{secondarysource}{%
\iffieldint{origyear}
{\ifnumgreater{\thefield{origyear}}{1936}
{}
{\skipentry}%
}
{\iffieldint{year}
{\ifnumgreater{\thefield{year}}{1936}
{}
{\skipentry}%
}
{\skipentry}%
}%
}
多余的线已经消失了。
在全:
\documentclass[a4,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[english=american]{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Moore1903,
author = {Moore, G. E.},
title = {Principia Ethica},
date = {1903},
publisher = {Cambridge University Press},
location = {Cambridge},
shorthand = {PE},
}
@Book{Frege1893,
author = {Frege, Gottlob},
title = {Grundgesetze der Arithmetik},
date = {1893},
volume = {I},
publisher = {Hermann Pohle},
location = {Jena},
related = {Frege2013a},
relatedtype = {englishtitle},
shorthand = {BLI},
shorttitle = {Grundgesetze I},
}
@Book{Frege2013a,
author = {Frege, Gottlob},
title = {{B}asic {L}aws of {A}rithmetic, \emph{Vol. I}},
date = {2013},
}
@Article{Candlish1989,
author = {Candlish, Stewart},
title = {The Truth about F. H. Bradley},
journaltitle = {Mind},
date = {1989},
volume = {98},
number = {391},
pages = {331--48},
}
@Collection{Benacerraf1984,
editor = {Benacerraf, Paul and Putnam, Hilary},
title = {Philosophy of Mathematics: Selected Readings},
date = {1984},
edition = {revised and expanded},
publisher = {Prentice-Hall},
location = {Englewood Cliffs, NJ},
}
@Book{Bell1979,
author = {Bell, David},
title = {Frege's Theory of Judgment},
date = {1979},
publisher = {Clarendon Press},
location = {Oxford},
}
@Book{Wittgenstein1979,
author = {Wittgenstein, Ludwig},
title = {Notebooks, 1914--1916},
date = {1979},
editor = {Wright, G. H. von and Anscombe, G. E. M.},
translator = {Anscombe, G. E. M.},
edition = {2},
publisher = {Basil Blackwell},
location = {Oxford},
origyear = {1913},
shorthand = {NB},
shorttitle = {Notebooks},
}
@Book{Russell1903a,
author = {Russell, Bertrand},
title = {The Principles of Mathematics},
date = {1903},
publisher = {Cambridge University Press},
location = {Cambridge},
shorthand = {PoM},
shorttitle = {Principles},
}
@Collection{Berger2011,
editor = {Berger, Alan},
title = {Saul Kripke},
date = {2011},
publisher = {Cambridge University Press},
location = {Cambridge},
}
\end{filecontents}
\usepackage[style=oxyear,indexing=cite,issuestyle=parens,natbib=true]{biblatex}
\usepackage{citeall}
\addbibresource{\jobname.bib}
% Environment for Abbreviation lists with the shorthands italicized by \emph
\DeclareFieldFormat{shorthand}{\emph{#1}}
\defbibenvironment{abbrevs}
{\list
{\printfield[shorthandwidth]{shorthand}}
{\setlength{\labelwidth}{\shorthandwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{\emph{##1}\hss}}}
{\endlist}
{\item}
% Titles for Parts of Bibliography
\defbibheading{subbibtitleonly}[\bibname]{%
\section*{#1}}
% Main primary sources categories
\newcommand*{\generateauthorcategory}[3]{%
\DeclareBibliographyCategory{by#1}%
\DeclareIndexNameFormat{cat#1}{%
\ifboolexpr{%
test {\ifdefstring{\namepartfamily}{#2}}%
and%
test {\ifdefstring{\namepartgiven}{#3}}%
}%
{\addtocategory{by#1}{\thefield{entrykey}}}%
{}}%
\AtDataInput{\indexnames[cat#1][1-999]{author}}}
\generateauthorcategory{frege}{Frege}{Gottlob}
\generateauthorcategory{russell}{Russell}{Bertrand}
\generateauthorcategory{moore}{Moore}{G.\bibnamedelimi E.}
% Filter for other primary sources, but NOT main ones
\defbibfilter{notmainprimary}{%
not category=byfrege %
and not category=bymoore %
and not category=byrussell %
}
% Check for all primary sources and another for secondary sources
\defbibcheck{primarysource}{%
\iffieldint{origyear}
{\ifnumless{\thefield{origyear}}{1936}
{}
{\skipentry}%
}
{\iffieldint{year}
{\ifnumless{\thefield{year}}{1936}
{}
{\skipentry}%
}
{\skipentry}%
}%
}
\defbibcheck{secondarysource}{%
\iffieldint{origyear}
{\ifnumgreater{\thefield{origyear}}{1936}
{}
{\skipentry}%
}
{\iffieldint{year}
{\ifnumgreater{\thefield{year}}{1936}
{}
{\skipentry}%
}
{\skipentry}%
}%
}
% Filtering entries for abbreviations lists
\DeclareBiblistFilter{fregeabbrevs}{
\filter[type=field,filter=shorthand]
}
\DeclareBiblistFilter{mainabbrevs}{
\filter[type=field,filter=shorthand]
}
\DeclareBiblistFilter{moreabbrevs}{
\filter[type=field,filter=shorthand]
}
% Sorting the abbreviations lists
\DeclareSortingTemplate{fregeabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{shorthand} } }
\DeclareSortingTemplate{mainabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{shorthand} } }
\DeclareSortingTemplate{moreabbrevs}{ \sort[final]{ \field{sortshorthand} } \sort{ \field{author} } }
% Adding English titles of Frege's works (from entries related to) to German entries in Bibliography
\newbibmacro*{related:englishtitle}[1]{%
\entrydata{#1}{%
\printtext{English title:}%
\setunit{\addspace}%
\usebibmacro{title}}}
% Drivers for printing abbreviations lists
\DeclareBibliographyDriver{fregeabbrevs}{%
\iffieldequalstr{relatedtype}{englishtitle}
{\entrydata{\thefield{related}}{\usebibmacro{title}}}
{{\usebibmacro{title}}}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\DeclareBibliographyDriver{mainabbrevs}{%
\usebibmacro{title}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\DeclareBibliographyDriver{moreabbrevs}{%
\renewbibmacro*{date+extradate}{}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\addcomma\space}\newblock
\printlabeldate}
\begin{document}
\chapter*{Abbreviations}
The following abbreviations are for frequently cited primary sources. Full details of these works are in the Bibliography.
\printbiblist[env=abbrevs,title={Writings of Frege}, heading=subbibtitleonly, category=byfrege]{fregeabbrevs}
\printbiblist[env=abbrevs,title={Writings of Moore}, heading=subbibtitleonly, category=bymoore]{mainabbrevs}
\printbiblist[env=abbrevs,title={Writings of Russell}, heading=subbibtitleonly, category=byrussell]{mainabbrevs}
\printbiblist[env=abbrevs,title={Other Primary Sources}, heading=subbibtitleonly, check=primarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]{moreabbrevs}\newpage
\citeall
\chapter*{Bibliography}
\printbibliography[title={Writings of Frege}, heading=subbibtitleonly, category=byfrege]
\printbibliography[title={Writings of Moore}, heading=subbibtitleonly, category=bymoore]
\printbibliography[title={Writings of Russell}, heading=subbibtitleonly, category=byrussell]
\printbibliography[title={Other Primary Sources}, heading=subbibtitleonly, check=primarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]
\printbibliography[title={Secondary Sources}, heading=subbibtitleonly, check=secondarysource, notcategory=byfrege, notcategory=bymoore, notcategory=byrussell]
\end{document}