我创建了一个自定义条目类型来管理档案的寄存器,其中管辖权是参考文献的引导元素,而不是作者。我想配置DeclareBibliographyDriver
(使用biblatex
)以添加具有相同管辖权。
因此,就我而言,bib 文件references.bib
有下一个条目(@register
自定义条目类型在哪里)
@register{refacteID312,
jurisdiction = {Biarritz, Pyrénées Atlantiques, France},
volume = {Etat Civil, Collection communale, Marriages (1843-1852)},
section = {Section 1845},
repository = {Archives Départementales des Pyrénées Atlantiques},
repositorylocation = {Bayonne},
}
@register{refacteID313,
jurisdiction = {Biarritz, Pyrénées Atlantiques, France},
volume = {Etat Civil, Collection communale, Marriages (1853-1862)},
section = {Section 1845},
repository = {Archives Départementales des Pyrénées Atlantiques},
repositorylocation = {Bayonne},
}
@book{negretoponymie1996,
title = {Toponymie générale de la {France}},
volume = {2},
publisher = {Librairie Droz},
author = {Nègre, Ernest},
year = {1996},
}
书目的输出如下:
我想要这样的东西:
数据模型文件evidence.dbx
与条目类型@register
定义有以下内容:
\DeclareDatamodelEntrytypes{register}
\DeclareDatamodelFields[type=field,datatype=literal]{
jurisdiction,
volume,
section,
repository,
repositorylocation,
}
\DeclareDatamodelEntryfields[register]{
jurisdiction,
volume,
section,
repository,
repositorylocation,
}
示例中的 tex 文件包含以下内容:
\documentclass{book}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[datamodel=evidence,backend=biber,style=authortitle]{biblatex}
\addbibresource{Lib1.bib}
\DeclareFieldFormat[register]{jurisdiction}{#1}
\DeclareFieldFormat[register]{volume}{\mkbibquote{#1}}
\DeclareFieldFormat[register]{section}{#1}
\DeclareFieldFormat[register]{repository}{#1}
\DeclareFieldFormat[register]{repositorylocation}{#1}
\DeclareBibliographyDriver{register}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{jurisdiction}%
\newunit\newblock
\printfield{volume}%
\newunit\newblock
\printfield{section}%
\newunit\newblock
\printfield{repository}%
\newunit
\printfield{repositorylocation}%
\usebibmacro{finentry}}
\begin{document}
\nocite{*}
\printbibliography[title={Referencias}]
\end{document}
我该如何改进这个主体以便将破折号放在具有相同管辖权的参考书目条目中?
答案1
biblatex
内置了处理用破折号替换名称列表的一切功能,但不包括文字字段。因此,我们需要重新创建biblatex
用于简单文字字段的名称的功能。此处显示的直接解决方案的一个警告是,文字字段的破折号检查与名称字段的破折号检查不交互,因此如果 a 的author
和@book
ajurisdiction
的@register
相同,您将不会得到破折号。
这个想法是保存最后一个jurisdiction
,\savefield
并在下一个条目中将其与进行比较\iffieldequals
。
\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\begin{filecontents}{evidence.dbx}
\DeclareDatamodelEntrytypes{register}
\DeclareDatamodelFields[type=field,datatype=literal]{
jurisdiction,
volume,
section,
repository,
repositorylocation,
}
\DeclareDatamodelEntryfields[register]{
jurisdiction,
volume,
section,
repository,
repositorylocation,
}
\end{filecontents}
\usepackage[datamodel=evidence,backend=biber,style=authortitle]{biblatex}
\DeclareFieldFormat[register]{jurisdiction}{#1}
\DeclareFieldFormat[register]{volume}{\mkbibquote{#1}}
\DeclareFieldFormat[register]{section}{#1}
\DeclareFieldFormat[register]{repository}{#1}
\DeclareFieldFormat[register]{repositorylocation}{#1}
\makeatletter
\InitializeBibliographyStyle{\global\undef\bbx@last@jurisdiction}
\newbibmacro*{bbx:dashcheck:jurisdiction}[2]{%
\ifboolexpr{
test {\iffieldequals{jurisdiction}\bbx@last@jurisdiction}
and
not test \iffirstonpage
and
(
not bool {bbx@inset}
or
test {\iffieldequalstr{entrysetcount}{1}}
)
}
{#1}
{#2}}
\newbibmacro*{bbx:save:jurisdiction}{%
\savefield{jurisdiction}{\bbx@last@jurisdiction}}%
\newbibmacro{jurisdiction}{%
\usebibmacro{bbx:dashcheck:jurisdiction}
{\bibnamedash}
{\usebibmacro{bbx:save:jurisdiction}%
\printfield{jurisdiction}}}
\makeatother
\DeclareBibliographyDriver{register}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{jurisdiction}%
\newunit\newblock
\printfield{volume}%
\newunit\newblock
\printfield{section}%
\newunit\newblock
\printfield{repository}%
\newunit
\printfield{repositorylocation}%
\usebibmacro{finentry}}
\begin{filecontents}{\jobname.bib}
@register{refacteID312,
jurisdiction = {Biarritz, Pyrénées Atlantiques, France},
volume = {Etat Civil, Collection communale, Marriages (1843-1852)},
section = {Section 1845},
repository = {Archives Départementales des Pyrénées Atlantiques},
repositorylocation = {Bayonne},
}
@register{refacteID313,
jurisdiction = {Biarritz, Pyrénées Atlantiques, France},
volume = {Etat Civil, Collection communale, Marriages (1853-1862)},
section = {Section 1845},
repository = {Archives Départementales des Pyrénées Atlantiques},
repositorylocation = {Bayonne},
}
@book{negretoponymie1996,
title = {Toponymie générale de la {France}},
volume = {2},
publisher = {Librairie Droz},
author = {Nègre, Ernest},
year = {1996},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography[title={Referencias}]
\end{document}