MWE 代码

MWE 代码

在我最初遇到的问题创造新风格以及我的第一次尝试,最终以引用错误结束,我创建了一个新的 BBX/CBX 组合。

所以我继续前进,我选择了选项2来自我上一篇文章,我authortitle-terse以 为基础,按照自己的风格复制粘贴,然后做了一些小改动。代码如下。

简而言之,我的“书”和“论文”驱动程序定义都不起作用。以下是我的问题:

1)书籍

  1. 分隔符完全关闭
  2. 多位作者的情况并不一致,司机似乎不认识家人和名字
  3. 姓和名之间有一个多余的“,”
  4. 此外,我无法编写此要求:如果设置了标签字段,则参考书目后应该有一个额外的文本,内容为(引用:所有作者姓氏均采用小写字母,并以“/”字段分隔

第一个引用的示例:Druey Jean-Nicolas, Titre au hasard ,2e éd., Berne 2016 (引用:Druey-Titre)

2)论文

  1. 标题之间有“
  2. 标题不是斜体
  3. 名字和姓氏之间有一个多余的“,”
  4. 块和单元的分离似乎与我的需要相差甚远......

3) 未检测到语言

我不得不强制识别语言。它不是自动识别的。这确实很麻烦,因为我只是在添加“版本”字段后才注意到这个问题,并注意到它是英文的。

MWE 代码

主文本

% 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}
% \usepackage[style=authortitle-terse, backend=biber, bibencoding=UTF8]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@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      = {Gut, Nicolas},
  title       = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
  date        = {2014},
  location    = {Bâle},
  label       = {thèse},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\section{expectation}
My goal as a real citation in the reference table as :\\
\textsc{Druey} Jean-Nicolas/\textsc{Comte} Alfred Leopold, \textit{Grundriss des Erbrechts, 6e ed}, Berne 2016\\
Output of the cite command should be like "\textsc{Druey/Comte}".

\section{test}
En matière de successions, le CC offre aux héritiers plusieurs façons de procéder (test 1) \cite{DrueyComte}, (test 2) \cite{Druey}.

Finalement, on cite la thèse de N. Gut ici : \cite{gut}.
\printbibliography

\end{document}

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 table
\setlength{\bibhang}{0pt}
\setlength{\bibitemsep}{1.5\baselineskip}

% NOUVELLES COMMANDES DE BIBLIOGRAPHIE %
% \newcommand{\printpaperbibliography}{\printbibliography[nottype=online, title=Bibliographie]}
% \newcommand{\printonlinebibliography}{\printbibliography[type=online, title=Sources en ligne]}

% Format des séparateurs entre les noms: des slash
\renewcommand*{\multinamedelim}{\ifcitation{\slash}{\addnbspace\slash\addspace}}% Dans les citations, pas d'espaces entre les slash (contrairement à la bibliographie)
\renewcommand*{\finalnamedelim}{\multinamedelim}%
\renewcommand*{\newblockpunct}{,}
% \renewcommand*{\newunitpunct}{}

% NOUVELLES COMMANDES DE BIBLIOGRAPHIE %

\DeclareBibliographyDriver{book}{%
    \printnames{author}%
    \newunit\newblock
    \printfield{title}%
    \newunit\newblock%
    \printfield{edition}%
    \newunit\newblock
    \printlist{location}%
    \setunit{\addspace}%
    \printfield{year}%
    \finentry}
\endinput

\DeclareBibliographyDriver{thesis}{%
    \printnames{author}%
    \newunit\newblock%
    \printfield{title}%
    \newunit\newblock%
    \printfield{label}%
    \newunit\newblock%
    \setunit{\addspace}%
    \printlist{location}%
    \setunit{\addspace}%
    \printfield{year}%
    \finentry}
\endinput

biblatex-xawi.cbx(复制粘贴authortitle-terse

% 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}

\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

@book

  1. 一般来说,你不想改变\newblockpunct你需要改变\newunitpunct

  2. 解析器正确识别名称,你想要

     \DeclareNameAlias{sortname}{family-given}
    
  3. 你需要

     \renewcommand*{\revsdnamepunct}{}
    
  4. 见下文

@thesis

\endinput您的主要问题是,在 的驱动程序后面有一个@book。该行导致biblatex忽略其后的所有内容,因此@thesis驱动程序从未被读取。

\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat*{citetitle}{\mkbibemph{#1}}

您将获得斜体且不带引号的所有标题。

未检测到语言

您的 MWE 在没有 的情况下也能很好地检测到法语language=french。如果您使用非常古老的版本biblatex或,polyglossia这可能会有问题,但使用相当现代的版本,您应该没问题。

引用风格

label只有当同一作者有两部作品时才会添加该字段。只有这样您才能在参考书目中看到“引用”。

风格已经为我们做好了准备,我们只需要

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

以及两个宏来打印参考书目中的“引用”信息

测试文档

\listfiles
\documentclass{article}

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

\usepackage{csquotes}
\usepackage[style=biblatex-xawi, backend=biber, bibencoding=UTF8]{biblatex}
% \usepackage[style=authortitle-terse, backend=biber, bibencoding=UTF8]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@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      = {Gut, Nicolas},
  title       = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
  date        = {2014},
  location    = {Bâle},
  label       = {thèse},
}
@book{gut2,
  author      = {Gut, Nicolas},
  title       = {Ein Buch},
  date        = {2015},
  location    = {Berne},
  label       = {Buch},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\section{expectation}
My goal as a real citation in the reference table as :\\
\textsc{Druey} Jean-Nicolas/\textsc{Comte} Alfred Leopold, \textit{Grundriss des Erbrechts, 6e ed}, Berne 2016\\
Output of the cite command should be like "\textsc{Druey/Comte}".

\section{test}
En matière de successions, le CC offre aux héritiers plusieurs façons de procéder (test 1) \cite{DrueyComte}, (test 2) \cite{Druey}.

Finalement, on cite la thèse de N. Gut ici : \cite{gut}.

\cite{gut2}

\printbibliography

\end{document}

.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}}

\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}}

\endinput % <- only at the very end!

.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

在此处输入图片描述

相关内容