BibLaTeX - 基于语言或机构的条件引用样式(法律案例引用)

BibLaTeX - 基于语言或机构的条件引用样式(法律案例引用)

我是 BibLaTeX 新手。我正尝试根据verbose-trad2我的需要构建一种经过修改的引用样式,这些需要是:

  1. 根据langid领域更改引用样式- 我想引用法国和英国的法律案例。问题是两者的引用风格截然不同,但在 BibLaTeX (@jurisdiction) 中却归类为相同的 @entryType。我使用 Zotero 来构建 .bib,因此构建自定义 @entryType 就不方便了。我最初的想法是使用\iffieldequalstrgbiblatex 包的命令,但它有些受限。
  2. 根据institution领域更改引用样式- 在法国,法律案例的引用样式取决于您引用的机构。例如:
  • CE,1981 年 2 月 6 日,内政部长 c. Benhamou,Rec. T.,795.(代表最高行政法院);
  • C. const.,n° 2004-503 DC,2004 年 8 月 12 日,地方自由和责任相关法,Rec. 144(代表宪法委员会)。

如您所见,两个引文中的数字并不在同一位置。我还尝试使用条件命令,但由于该字段institution是一个文字列表,因此它无法接受字符串作为要测试的值。无论如何,我陷入困境,找不到解决方案。

这是我目前写出的代码。它相当混乱,可能优化不足。我对样式做了其他更改,我们感兴趣的部分在最后。

该代码位于cit-style.tex我包含在主文档中的名为的文件中:

\usepackage[%
citestyle=verbose-trad2,%\texttt{}
bibstyle=verbose,%
citepages=omit,%
sorting=nyt,%
backref=true,%
isbn=false,%
url=false,%
doi=false,%
eprint=false,%
related=false,%
giveninits=true,%
autopunct=false % Permet de ne pas changer le marqueur de place - le problème étant que les erreurs de double ponctuation sont toujours possibles. Trouver une solution.
]{biblatex}
\addbibresource{biblio.bib}

\DeclareFieldFormat{guillemets}{\mkbibquote{#1}}
\DeclareListFormat{parentheses-liste}{\mkbibparens{#1}}

% Changement de la chaîne de caractère Références to Bibliographie
\DefineBibliographyStrings{french}{references={Bibliographie}}

% Changement du séparateur en virgule au lieu du point moche. 
\renewcommand{\newunitpunct}[0]{\addcomma\addspace}

% Virgule à la place du deux points entre le lieu et l'éditeur.
\newbibmacro*{publisher+location+series+date}{%
    \printlist{location}%
    \iflistundef{publisher}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcomma\space}}%
    \printlist{publisher}%
    \setunit*{\addcomma\space}%
    \printtext{coll.\space}%
    \printfield[guillemets]{series}%
    \setunit*{\addspace}%
    \printfield{number}%
    \newunit
    \usebibmacro{date}%
    \newunit}

\renewbibmacro*{series+number}{%
    \printtext{coll.\addspace}
    \printfield[guillemets]{series}%
    \setunit*{\addspace}%
    \printfield{number}%
    \newunit}

% Redéfinition de la macro affichant le titre de la revue et la date de publication (pour enlever les parenthèses).
\renewbibmacro*{volume+number+eid}{%
    \iffieldundef{number}%
    {}%
    {\addcomma\addspace%
        \printtext{\bibstring{number}}\addspace\printfield{number}}%
    \setunit*{\addcomma\addspace}%
    \iffieldundef{volume}%
    {}%
    {\printtext{\bibstring{volume}}\addspace\printfield{volume}}
    \setunit{\addcomma\space}%
    \printfield{eid}}

% Redéfinition de la macro qui affiche la date des articles.
\renewbibmacro*{issue+date}{%
    \printtext{%
        \addcomma\addspace%
        \printfield{issue}%
        \setunit*{\addspace}%
        \usebibmacro{date}}%
    \newunit}  

% Format NOM Prénom 
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}
\renewcommand*{\revsdnamepunct}{} %retire virgule entre les noms
\renewcommand*{\mkbibnamegiven}[1]{\mkbibparens{#1}} % ajoute des parenthèses autour des initiales du prénom.


\renewcommand{\mkibid}[1]{{\emph{#1}}}

\renewcommand{\intitlepunct}{ }

% Redéfinition du driver Book pour afficher la collection après l'éditeur et la ville.

\DeclareBibliographyDriver{book}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\printdelim{nametitledelim}}\newblock
    \usebibmacro{maintitle+title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+series+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit
    \printfield{pagetotal}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}

\newbibmacro{uk-case-cit}{% Macro which prints the citation for English case (without the title of the case) - Condition is important in order to print the brackets or not.
    \iffieldundef{volume}{% If the entry has no volume field, then the year of the report is important - brackets.
        \printfield[brackets]{year}%
    }%
    {% No brackets if no volume
        \printfield[parens]{year}
    }%
    \addspace%
    \printfield[default]{journaltitle}% prints the report title
    \addspace%
    \printfield[default]{pages}% prints the page
}%

\newbibmacro{fr-juridiction+date}{% for all french cases, prints the institution name and the date. I want this part to be conditionnal.
    \printlist{institution}%
    \newunit%
    \printdate%
}%

\newbibmacro{neutral-cit-oscola}{% prints the neutral citation if one has been filed in the .bib.
    \printfield{number}%
    \newunit%
    \usebibmacro{uk-case-cit}%
}%

\newbibmacro{oscola-juris}{% Prints the full english case citation. Based on the OSCOLA guidelines.
    \printfield{title}%
    \addspace%
    \iffieldundef{number}{%
        \usebibmacro{uk-case-cit}
    }%
    {%
        \usebibmacro{neutral-cit-oscola}%
    }%
    \addspace%
    \printlist[parentheses-liste]{institution}%
}%

\DeclareBibliographyDriver{jurisdiction}{ % Definition of the driver for the @jurisdiction entries.
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \iffieldequalstr{langid}{french}{% Is the entry a french case ? 
        \usebibmacro{fr-juridiction+date}
        \newunit%
        \usebibmacro{title}% This is where I would also like to insert a condition to print different citation styles according to the institution field.
    }%
    {% If not french, then prints following oscola guidelines.
        \usebibmacro{oscola-juris}%
    }%
    \usebibmacro{finentry}}

分子量 1 - main.tex:

\documentclass[12pt]{article}

\usepackage[french]{varioref}
\usepackage[french]{babel}

\input{cit-style.tex}

\begin{document}

\textbf{English Case (brackets because year of the report is important) :}

\cite{rice1911}

\textbf{English Case (parenthesis because year is not that important for the report)}

\cite{cooperWilson1937}

\textbf{Case from the French Conseil d'Etat :}

\cite{untitled2007}


\end{document}

MWE 2- biblio.bib

@jurisdiction{rice1911,
    title = {Board of {{Education}} v {{Rice}}},
    date = {1911},
    journaltitle = {A.C.},
    pages = {179},
    institution = {{UKHL}},
    url = {http://www.commonlii.org/uk/cases/UKLawRpAC/1911/18.html},
    langid = {english}
}

@jurisdiction{cooperWilson1937,
    title = {Cooper v {{Wilson}}},
    date = {1937-03-27},
    journaltitle = {K.B.},
    volume = {2},
    number = {[1937] 2 K.B. 309},
    pages = {9},
    institution = {{Court of Appeal}},
    urldate = {2023-10-11},
    langid = {english}
}

@jurisdiction{untitled2007,
    title = {Untitled},
    date = {2007-02-22},
    journaltitle = {Publié au recueil Lebon},
    number = {264541},
    institution = {{Conseil d'État}},
    url = {https://www.legifrance.gouv.fr/ceta/id/CETATEXT000018259406/},
    urldate = {2023-03-14},
    langid = {french},
    annotation = {Section du Contentieux}
}

我编译了所有内容TexStudio 中的 XeLaTeX,在 MacOs 14 Sonoma (MBA M2) 上。

总而言之,我正在尝试找到一种使样式调节更容易的方法。我在 biblatex 手册中找不到足够的文档。您知道如何实现这一点吗?

非常感谢,祝周末愉快!

胡吉

相关内容