![声明以 biblatex 结尾的参考书目选项](https://linux22.com/image/339911/%E5%A3%B0%E6%98%8E%E4%BB%A5%20biblatex%20%E7%BB%93%E5%B0%BE%E7%9A%84%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E9%80%89%E9%A1%B9.png)
来自瑞士阿尔卑斯山的问候,
我想提交以下问题:
我的目的是创建一个新的参考书目选项,我可以在加载包时随意切换biblatex-swiss-legal
。
总体背景
我的MWE如下:
\documentclass[12pt,a4paper]{article}
\usepackage[french,german]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=biblatex-swiss-legal-general,backend=biber,autolang=other,jurisdictionindex=true,commentarystyle=styleA]{biblatex}
\addbibresource{Referencingtest.bib}
% Bibliography entries (using JabRef)
@Commentary{bskor1, % This is the main entry, from which the customa (smaller)
location = {Basel}, % citations will be created, it only appears in the bibliography
date = {2015},
title = {Basler Kommentar. Obligationenrecht},
titleaddon = {OR},
editor = {Honsell, Heinrich and Vogt, Nedim Peter and Wiegand, Wolfgang},
edition = {6},
series = {bsk},
volume = {I},
}
@Customa{bsk19/20or, % This entry will appear in the document
crossref = {bskor1},
author = {Huguenin, Claire and Meize, Barbara},
part = {19/20},
}
我想将文件中的设计更改commentarystyle
为styleD
如下形式.bbx
:
\newbibmacro{customa:styleD}{% <-- This is actually a test, not having any idea
\bibsstring{\thefield{series}}% how it will look like, being unable to make it appear
\printtext{-}% on the pdf result
\printnames{labelname}%
\addcomma\addspace%
\printfield{titleaddon}\addspace%
\printfield{part}%
}%
并且可能看起来像:
BsK-Huguenin/Meize,OR 19/20 N 12。
样式 A、B 和 C 如下所示(与原始包相比,它们略有修改,大部分涉及标点符号,没有使用\newblock
nor \newunit
):
\newbibmacro{customa:styleA}{%
\iffieldbibstring{series}%
{\bibsstring{\thefield{series}}}%
{\printfield{series}}%
\iffieldundef{series}{}{\printtext{-}}\printnames{labelname}\addcomma%
\iffieldundef{type}%
{%
\iftoggle{bbx:adarticle}%
{\addspace}%
{\addspace}%
}%
{%
\iffieldbibstring{type}%
{\bibsstring{\thefield{type}}}%
{\printfield{type}}%
\addspace}%
\iffieldundef{part}%
{}%
{\iftoggle{bbx:adarticle}%
{\bibsstring{ad}\addspace}%
{}%
\ifboolexpr{%
test {\iffieldequalstr{series}{beckkuko}}
or
test {\iffieldequalstr{series}{mnk}}
or
test {\iffieldequalstr{series}{nmk}}
or
test {\iffieldequalstr{series}{palandt}}
or
test {\iffieldequalstr{series}{stk}}
}
{% Si le commentaire est allemand (DEU)
\ifboolexpr{% Test pour savoir s'il y a plusieurs articles
test {\IfSubStr{\thefield{part}}{-}}
or
test {\IfSubStr{\thefield{part}}{f.}}
or
test {\IfSubStr{\thefield{part}}{ff.}}
or
test {\IfSubStr{\thefield{part}}{\psq}}
or
test {\IfSubStr{\thefield{part}}{\psqq}}
}
{\bibstring{articlesde}}
{\bibstring{articlede}}
}%
{\bibsstring{article}}% Si le commentaire n'est pas allemand (donc suisse)
\addspace\printfield{part}%
}%
\addspace%
\printfield{titleaddon}%
}
\newbibmacro{customa:styleB}{%
\iffieldundef{series}
{\usebibmacro{customa:styleA}}% Si les séries ne sont pas définies, utilisation du style A
{\iffieldbibstring{series}%
{\bibsstring{\thefield{series}}\printtext{-}}%
{\iffieldundef{series}%
{}%
{\printfield{series}\printtext{-}}%
}%
\iffieldundef{titleaddon}%
{}%
{\printfield{titleaddon}\addspace}%
\iffieldundef{volume}%
{}%
{\thefield{volume}}%
\addcomma\addspace%
\printnames{labelname}%
\iffieldundef{type}%
{%
\iftoggle{bbx:adarticle}%
{\addspace}%
{\addspace}%
}%
{\addcomma\addspace%
\iffieldbibstring{type}{\bibsstring{\thefield{type}}}{\printfield{type}}%
\newunit}%
\iffieldundef{part}%
{}%
{\iftoggle{bbx:adarticle}%
{\bibsstring{ad}\newunit}%
{}%
\addcomma\addspace\bibsstring{article}\addspace\printfield{part}%
}%
}}%
\newbibmacro{customa:styleC}{%
\iftoggle{bbx:firstnames}
{\printnames{author}}%
{\printnames{labelname}}%
\iffieldundef{series}%
{}%
{\newblock\usebibmacro{printin}%
\iffieldbibstring{series}%
{\biblstring{\thefield{series}}}%
{\printfield{series}}%
}%
\iffieldundef{type}%
{%
\iftoggle{bbx:adarticle}%
{\newunit}%
{\newblock}%
}%
{\newblock%
\iffieldbibstring{type}{\bibsstring{\thefield{type}}}{\printfield{type}}%
\newunit}%
\iffieldundef{part}%
{}%
{\iftoggle{bbx:adarticle}%
{\bibsstring{ad}\newunit}%
{}%
\bibsstring{article}\addspace\printfield{part}%
}%
\addcomma\addspace%
\printfield{titleaddon}%
}
相应的引用样式如下:
款式 A:
BsK-Huguenin/Meize,第 19/20 OR 条,N 12。
风格 B:
BsK-OR I,Huguenin/Meize,第 19/20 条,N 12。
风格C:
Huguenin/Meize,载于:Basler Kommentar,Art. 19/20 OR,N 12。
注意:
- 作者应该使用小写字母;
- 正在使用该软件包的德语版本;
- “N 12”是瑞士注释中使用的边距编号,通过作者创建的
\footcite
此命令来定义。\providecommand{\chaparN}[2]{\S~#1 \parN #2}
我应该说一下,这style C
对我的论文没有任何用处,但如果我需要的话,我宁愿保留这个选择。
我的问题
我是不是寻求有关上述部分的帮助,更希望获得有关以下内容的帮助:
\DeclareBibliographyOption{commentarystyle}{%
\ifcsdef{blx@opt@commentarystyle@#1}
{\blx@commentarystyle\csuse{blx@opt@commentarystyle@#1}}
{\blx@err@invopt{commentarystyle=#1}{}}}
\cslet{blx@opt@commentarystyle@styleA}\z@
\let\blx@opt@commentarystyle@styleB\@ne
\let\blx@opt@commentarystyle@styleC\tw@
\let\blx@opt@commentarystyle@styleD\ % this is where I'm having trouble.
如果没有最后一条线,我无法使用该选项加载包styleD
,但我无法弄清楚结尾是什么(在最后一个 之后\
,例如z@
,@ne
,tw@
分别代表样式 A、B 和 C),因为如果我复制其中一种样式,则会使用该样式而不是styleD
。
有谁知道@
在最后一行末尾添加什么字母组合才能使其加载?
干杯,
阿尔凯因
附加信息
附言:如果你去查看原始biblatex-swiss-legal
软件包,你就会发现它实际上已经很旧了(2014 年 1 月),并且没有考虑到从那时起新的 biblatex/biber 变化,我已经更正了该文件。
PSS:如果这个问题看起来很愚蠢或者很容易解决,我请求饶恕,我仍然是新手,并试图掌握 biblatex。
答案1
biblatex-swiss-legal-base.bbx
用于选择样式的代码customa
不是那么容易扩展的。不过我们可以做到。
\DeclareBibliographyOption{commentarystyle}
用以下块替换
\providebibmacro{customa:full}{}
\DeclareBibliographyOption[string]{commentarystyle}{%
\ifcsdef{abx@macro@customa:#1}
{\renewbibmacro{customa:full}{%
\testibid{\usebibmacro{customa:#1}}}}
{\blx@err@invopt{commentarystyle=#1}{you need to define the bibmacro 'customa:#1'}}}
然后您只需将\ExecuteBibliographyOptions
代码移至文件的最末尾,.bbx
即可避免过早出现错误。
从现在开始,您可以订购commentarystyle=<styleX>
,如果定义了 bibmacro customa:<styleX>
,否则会发出错误。