编辑:初次测试后的问题

编辑:初次测试后的问题

我正在使用 biblatex 创建自己的风格,专注于瑞士的法律文件,按照我上一篇文章

我现在只能看到瑞士政府的一些官方声明,这些声明发表在单独的书目中。我已经知道 biblatex 中有一个很棒的选项,可以使用过滤器创建多个“\printbibliography”。

格式应该像这个文本一样,没有任何格式。只有 3 个元素,标题、在在线分类账中找到它的引用(注释)和标签。对此条目的所有引用都应该只是标签的内容。

Message du Conseil fédéral du 28 juin 2006 relatif au code de procédure civile suisse (CPC), FF 2006 p. 6841 ss (cité : Message CPC).

对我来说,根据我对biblatex 手册,第 8 页 ss。

@message{messageCPC,
    title       = {Message du Conseil fédéral du 28 juin 2006 relatif au code de procédure civile
suisse (CPC)},
    note        = {FF 2006 p. 6841 ss},
    label       = {Message CPC}
}

我如何定义自己的条目类型“消息”?

@Moewe 在评论中回答了一般指导原则,这指导了我到这个帖子。为了让这个问题更有趣,我将回顾我自己的代码和这个案例的潜在问题。

编辑:初次测试后的问题

定义进行得非常顺利,新类型几乎按预期工作。剩下的问题是“引用为”部分的格式。理想情况下,它应该是纯文本或小写字母。然而,到目前为止,我的尝试都没有成功。

1) 如何以标准格式设置引用和参考书目中的“引用”样式? 2) 如何以小型大写格式设置引用和参考书目中的“引用”样式?

注:引用部分取自我的上一个问题,关于创建自己的驱动程序。

主文本

% MweBiblatex Swiss Legal
\documentclass{article}

% Needed by Biblatex
\usepackage{polyglossia}
\setmainlanguage{french}

\usepackage{csquotes}
\usepackage[style=biblatex-xawi, language=french, backend=biber, bibencoding=UTF8]{biblatex}

\addbibresource{main.bib}

\begin{document}

\section{Expectation}
This test contains a citation to a message as well as several authors documents. Here are the expectation for citation :
\begin{itemize}
    \item book single author : "\textsc{Druey}"
    \item book multi-authors  : "\textsc{Druey/Comte}"
    \item message : "Message CPC"
\end{itemize}

When displayed in the bibliography, this item should become :

Message du Conseil fédéral du 28 juin 2006 relatif au code de procédure civilesuisse (CPC), FF 2006 p. 6841 ss (cité : \textsc{Message CPC})

\section{Test}

This is a series of citation to regular type, and a message at the very end. book single author : \cite{Druey}, \cite{DrueyComte}

If there are both type of data, then the table of content must be split in 2 parts, the first for all the non-message elements, the second for . The 2 parts must have subtitle (subsection) which should not appear in the table of content.

Test of citation message : \cite{MessageCPC}

\end{document}

主目录

@book{DrueyComte,
  author      = {Druey, Jean-Nicolas and Comte, Alfred Leopold},
  title       = {Grundriss des Erbrechts},
  edition     = 6,    
  date        = {2016},
  location    = {Berne}
}

@book{Druey,
  author      = {Druey, Jean-Nicolas},
  title       = {Titre au hasard},
  date        = {2016},
  edition     = 2,
  location    = {Berne},
  label       = {Druey-Test}
}

@thesis{gut,
  author      = {Gute, Nicolas},
  title       = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
  date        = {2014},
  location    = {Bâle},
  label       = {thèse}
}

@message{MessageCPC,
    title       = {Message du Conseil fédéral du 28 juin 2006 relatif au code de procédure civile
suisse (CPC)},
    note        = {FF 2006 p. 6841 ss},
    label       = {Message CPC}
}

biblatex-xawi.bbx

% Encoding of this file: UTF-8. Code is ASCII compatible.
\ProvidesFile{biblatex-xawi.bbx}[2018/04/13 v1.1 alpha)]
\RequireBiber[2]
\RequireBibliographyStyle{authortitle}

% Formatage de la bibliography
\setlength{\bibhang}{0pt}
\setlength{\bibitemsep}{1.5\baselineskip}

% --- --- Code de bas niveau --- --- %

% Partie 1 : BibMacro pour le "cité comme"
% format : (cité : Auteur-label)

\DefineBibliographyStrings{french}{citedas = {cit\'e}}
\DefineBibliographyStrings{french}{citedas = {cit\'e}}

\newbibmacro{citedas:cite}{%
  \begingroup
    \delimcontext{cite}%
    \DeclareFieldFormat{bibhyperref}{##1}%
    \csuse{blx@hook@cite}%
    \csuse{blx@hook@citekey}%
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \citetrackerfalse\pagetrackerfalse\backtrackerfalse
    \defcounter{maxnames}{\blx@maxcitenames}%
    \usebibmacro{cite}%
  \endgroup
}

\newbibmacro{citedas}{%
  \ifsingletitle
    {}
    {\printtext[parens]{%
       \bibstring{citedas}%
       \addcolon\space
       \usebibmacro{citedas:cite}}}}


% --- --- Nouveau type : message --- --- %
\DeclareDatamodelEntrytypes{message}

\DeclareFieldFormat*[message]{title}{#1}
\DeclareFieldFormat*[message]{note}{#1}
\DeclareFieldFormat*[message]{label}{#1}
\DeclareFieldFormat*[message]{citelabel}{#1}

\DeclareBibliographyDriver{message}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \printfield{title}%
    \newunit\newblock
    \printfield{note}%
    \setunit{\addspace}%
    \usebibmacro{citedas}%
    \usebibmacro{finentry}
}

\endinput % seulement à la fin

biblatex-xawi.cbx

% Encoding of this file: UTF8. Code is ASCII compatible. 

% PREAMBULE / REGLES GENERALES
\ProvidesFile{biblatex-xawi.cbx}[2018/04/13 v1.0 alpha]

\RequireCitationStyle{authortitle}
\ExecuteBibliographyOptions{singletitle,uniquename,uniquelist,autocite=inline}

% Definition de la partie "Labeltitle"
\DeclareLabeltitle{%
  \field{label}
  \field{shorttitle}
  \field{title}
  \field{maintitle}
}


\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifnameundef{labelname}
       {\usebibmacro{cite:title}}
       {\ifsingletitle
          {\printtext[bibhyperref]{\printnames{labelname}}}
          {\printnames{labelname}%
       \setunit{\nametitledelim}%
       \usebibmacro{cite:title}}}}%
    {\usebibmacro{cite:shorthand}}}

\renewbibmacro*{textcite}{%
  \ifnameundef{labelname}
    {\ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \iffieldundef{shorthand}
       {\usebibmacro{cite:title}}%
       {\usebibmacro{cite:shorthand}}}
    {\ifthenelse{\ifsingletitle\AND
                 \(\iffieldundef{prenote}\OR\value{citecount}>1\)}
       {\printtext[bibhyperref]{\printnames{labelname}}}
       {\printnames{labelname}%
    \setunit{%
      \global\booltrue{cbx:parens}%
      \addspace\bibopenparen}%
    \ifnumequal{\value{citecount}}{1}
      {\usebibmacro{prenote}}
      {}%
    \iffieldundef{shorthand}
      {\usebibmacro{cite:title}}%
      {\usebibmacro{cite:shorthand}}}}}

\endinput

答案1

添加新条目类型并正确设置它们的一般过程在如何使用 BibLaTeX/Biber 创建全新的数据类型?

您可以使用以下方式更改“消息每次点击费用”的格式

\DeclareFieldFormat[message]{citetitle}{#1}

请注意,这里没有开始,并且改变的格式是citetitle(不是labelcitelabel)。

在 现代 版本中biblatex,您无法将\DeclareDatamodelEntrytypes{message}放入文件中.bbx。数据模型命令必须位于以 结尾的数据模型文件中.dbx

biblatex-xawi.bbx

\ProvidesFile{biblatex-xawi.bbx}[2018/04/18 v1.1 alpha]
\RequireBiber[2]
\RequireBibliographyStyle{authortitle}
\ExecuteBibliographyOptions{dashed=false}

% Formatage de la table
\setlength{\bibhang}{0pt}
\setlength{\bibitemsep}{1.5\baselineskip}

\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimFormat[bib,biblist]{multinamedelim}{\addnbspace\slash\addspace}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}%

\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\revsdnamepunct}{}

\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat*{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[message]{citetitle}{#1}

\DefineBibliographyStrings{french}{citedas = {cit\'e}}

\newbibmacro{citedas:cite}{%
  \begingroup
    \delimcontext{cite}%
    \DeclareFieldFormat{bibhyperref}{##1}%
    \csuse{blx@hook@cite}%
    \csuse{blx@hook@citekey}%
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \citetrackerfalse\pagetrackerfalse\backtrackerfalse
    \defcounter{maxnames}{\blx@maxcitenames}%
    \usebibmacro{cite}%
  \endgroup
}

\newbibmacro{citedas}{%
  \ifsingletitle
    {}
    {\printtext[parens]{%
       \bibstring{citedas}%
       \addcolon\space
       \usebibmacro{citedas:cite}}}}

\renewbibmacro*{location+date}{%
  \printlist{location}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \newunit}

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \printfield{edition}%
  \newunit\newblock
  \usebibmacro{location+date}%
  \setunit{\addspace}%
  \usebibmacro{citedas}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{thesis}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit\newblock
  \printfield{label}%
  \newunit\newblock
%  \setunit{\addspace}% <--- do you really want that?
  \usebibmacro{location+date}%
  \setunit{\addspace}%
  \usebibmacro{citedas}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{message}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{title}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addspace}%
  \usebibmacro{citedas}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


\endinput % <- only at the very end!

biblatex-xawi.cbx

\ProvidesFile{biblatex-xawi.cbx}[2018/04/18 v1.1]

\RequireCitationStyle{authortitle}
\ExecuteBibliographyOptions{singletitle,uniquename,uniquelist,autocite=inline}

\DeclareDelimFormat{nametitledelim}{\textendash}

\DeclareLabeltitle{%
  \field{label}
  \field{shorttitle}
  \field{title}
  \field{maintitle}
}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifnameundef{labelname}
       {\usebibmacro{cite:title}}
       {\ifsingletitle
          {\printtext[bibhyperref]{\printnames{labelname}}}
          {\printnames{labelname}%
       \setunit{\printdelim{nametitledelim}}%
       \usebibmacro{cite:title}}}}%
    {\usebibmacro{cite:shorthand}}}

\renewbibmacro*{textcite}{%
  \ifnameundef{labelname}
    {\ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \iffieldundef{shorthand}
       {\usebibmacro{cite:title}}%
       {\usebibmacro{cite:shorthand}}}
    {\ifthenelse{\ifsingletitle\AND
                 \(\iffieldundef{prenote}\OR\value{citecount}>1\)}
       {\printtext[bibhyperref]{\printnames{labelname}}}
       {\printnames{labelname}%
    \setunit{%
      \global\booltrue{cbx:parens}%
      \addspace\bibopenparen}%
    \ifnumequal{\value{citecount}}{1}
      {\usebibmacro{prenote}}
      {}%
    \iffieldundef{shorthand}
      {\usebibmacro{cite:title}}%
      {\usebibmacro{cite:shorthand}}}}}

\endinput

biblatex-xawi.dbx

\ProvidesFile{biblatex-xawi.dbx}[2018/04/18 v1.1]

\DeclareDatamodelEntrytypes{message}

\endinput

相关内容