![编辑 1 - 使用 MWE 代替 Extracts](https://linux22.com/image/374857/%E7%BC%96%E8%BE%91%201%20-%20%E4%BD%BF%E7%94%A8%20MWE%20%E4%BB%A3%E6%9B%BF%20Extracts.png)
在我的第一个问题中我介绍了参考书目驱动程序的定义,现在我几乎完成了定义,感谢这个论坛的帮助。
GutNicolas,《瑞士民事诉讼法中关于非礼勿视的条款》,《巴塞尔》,2014(引用:Gut,这些 )。
我需要获得这种书目:
Gut Nicolas,《瑞士民事诉讼法中的特殊要求》,巴塞尔 2014 年(引用:Gut-These)。
这意味着 :
- 更改引用部分的分隔符
- 将多个位置的分隔符更改为“ / ”
- 允许多个位置(内置?)
- 删除类型、位置和年份部分之间的标点符号 (,)。
- 将“printfield{label}”的用法更改为“printfield{type}”
问题 :
我应该调查哪种参数?
编辑 1 - 使用 MWE 代替 Extracts
根据@moewe 的评论,我编辑了这篇文章以包含 MWE。
主特克斯
% MweBiblatex Swiss Legal
\documentclass{article}
% Needed by Biblatex
\usepackage{polyglossia}
\setmainlanguage{french}
\usepackage{csquotes}
\usepackage[style=biblatex-xawi, language=french, bibencoding=UTF8, backend=biber]{biblatex}
\addbibresource{main.bib}
\begin{document}
\section{Test de la bibliographie}
\printbibliography
\section{Tests de citation}
\nocite{*}
\subsection{Thèse}
\cite{gut}
\end{document}
主页
@thesis{gut,
author = {Gut, Nicolas},
title = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
date = {2014},
location = {Bâle},
label = {These}
}
@thesishabilitation{gut2,
author = {Gut, Nicolas},
title = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
date = {2017},
location = {Berne},
label = {Forderungsklage}
}
@thesis{other,
author = {Other, Nicolas},
title = {A title for a thesis},
date = {2017},
location = {Berne}
}
biblatex-xawi.cbx
% PREAMBULE / REGLES GENERALES
\ProvidesFile{biblatex-xawi.cbx}[2018/04/13 v1.0 alpha]
\RequireCitationStyle{authortitle}
% --- --- Formatage général des citations --- --- %
\DeclareFieldFormat*{citetitle}{#1}
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---%
% --- Formatage de la citation spécifique dans les citations --- %
% 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
biblatex-xawi.bbx
\ProvidesFile{biblatex-xawi.bbx}[2018/04/13 v1.1 alpha)]
% Depencances
\RequireBiber[2]
\RequireBibliographyStyle{authortitle}
% Localisation
\NewBibliographyString{
thesis,
habilthesis
}
\DefineBibliographyStrings{french}{
citedas = {cité},
thesis = {Thèse}
habilthesis = {Thèse d'habilitation}
}
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---%
% --- --- Setting default options --- --- %
\ExecuteBibliographyOptions{%
maxbibnames=99, % nombre max. de noms pour les entrées
maxcitenames=4, % nombre max. de noms pour les citations
mincrossrefs=1, % nombre min pour les références croisées
bibwarn=false, % avertissement uniques pour les entrés bibliographiques
dashed=false, % Nom entier même si répétition
singletitle=true,
uniquename=full,
uniquelist=true
}
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---%
% --- --- Formatage général des citations & bibliogryphies --- --- %
% Formatage global :
\DeclareFieldFormat{title}{\mkbibemph{#1}}
% Format des séparateurs entre les noms: des slash
% \DeclareDelimFormat{multinamedelim}{\slash}
% \DeclareDelimFormat[bib,biblist]{multinamedelim}{\addnbspace\slash\addspace}
% \DeclareDelimAlias{finalnamedelim}{multinamedelim}%
% Dans les citations, pas d'espaces entre les slash (contrairement à la bibliographie)
\renewcommand*{\multinamedelim}{\ifcitation{\slash}{\addnbspace\slash\addspace}}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\revsdnamepunct}{}
\DeclareNameAlias{sortname}{family-given}
% Remove all possible shorthand
% https://tex.stackexchange.com/questions/244714/how-to-disable-the-use-of-shorthands-in-biblatex
\DeclareFieldInputHandler{shorthand}{\def\NewValue{}}
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---%
% --- --- Pilote de bibliographie pour Thèse et Thèse d'habilitation --- --- %
% Formatage du style par défaut
\DeclareFieldFormat[thesis]{title}{#1}
\DeclareFieldFormat[thesis]{location}{#1}
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit\newblock
\printfield{label}%
\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}}
%
\DeclareStyleSourcemap{
\maps{
\map{
\pertype{thesis}
\step[fieldset=type, fieldvalue=thesis]
}
\map{
\step[typesource=thesehabilitation, typetarget=thesis, final]
\step[fieldset=type, fieldvalue=habilthesis]
}
}
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---%
% --- Formatage de la citation spécifique dans la bibliographie --- %
% format : (cité : Auteur-label)
% Voir aussi partie "CBX" pour la partie "citation"
\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}
}
}
}
\endinput % seulement à la fin
答案1
我认为我们之前就有了这个,
\DeclareDelimFormat{nametitledelim}{\textendash}
这就是您所需要的。至于名称,
multinamedelim
您finalnamedelim
现在需要使用\DeclareDelimFormat{multilistdelim}{\addnbspace\slash\addspace} \DeclareDelimAlias{finallistdelim}{multilistdelim}
已经可以了。
location
是一个列表字段,您可以给出多个位置,用以下分隔符分隔and
:location = {Berne and Bâle},
这是在
location+date
宏中完成的。完毕。
example.tex
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{french}
\usepackage{csquotes}
\usepackage[style=biblatex-xawi, backend=biber]{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 = {These}
}
@habilthesis{gut2,
author = {Gut, Nicolas},
title = {Die unbezifferte Forderungsklage nach der Schweizerischen Zivilprozessordnung},
date = {2017},
location = {Berne and Bâle},
label = {Forderungsklage}
}
@thesis{other,
author = {Other, Nicolas},
title = {A title for a thesis},
date = {2017},
location = {Berne}
}
@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}
}
@thesis{habilthesis2,
author = {Author Habilitation},
title = {Title Thése Habilitation},
date = {2014},
type = {habilthesis},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
\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}
\printbibliography
\end{document}
biblatex-xawi.bbx
\ProvidesFile{biblatex-xawi.bbx}[2018/04/25 v1.2 alpha]
\RequireBibliographyStyle{authortitle}
\ExecuteBibliographyOptions{%
maxbibnames=99, % nombre max. de noms pour les entrées
maxcitenames=4, % nombre max. de noms pour les citations
mincrossrefs=1, % nombre min pour les références croisées
bibwarn=false, % avertissement uniques pour les entrés bibliographiques
dashed=false, % Nom entier même si répétition
singletitle=true,
uniquename=full,
uniquelist=true,
}
\NewBibliographyString{thesis,habilthesis}
\DefineBibliographyStrings{french}{
citedas = {cit\'e},
thesis = {th\`ese},
habilthesis = {th\`ese d'habilitation},
}
% 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}%
\DeclareDelimFormat{multilistdelim}{\addnbspace\slash\addspace}
\DeclareDelimAlias{finallistdelim}{multilistdelim}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\revsdnamepunct}{}
\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat[thesis]{title}{#1}
\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{type}%
\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{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}}
% If you must ...
\DeclareFieldInputHandler{shorthand}{\def\NewValue{}}
\DeclareStyleSourcemap{
\maps[datatype=bibtex,overwrite=false]{
\map{
\step[typesource=habilthesis, typetarget=thesis, final]
\step[fieldset=type, fieldvalue=habilthesis]
}
\map{
\pertype{thesis}
\step[fieldset=type, fieldvalue=thesis]
}
}
}
\endinput % <- only at the very end!
biblatex-xawi.cbx
\ProvidesFile{biblatex-xawi.cbx}[2018/04/25 v1.2]
\RequireCitationStyle{authortitle}
%\ExecuteBibliographyOptions{singletitle,uniquename,uniquelist,autocite=inline}
\DeclareFieldFormat*{citetitle}{#1}
\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