Following my initial problems about the creation of a new style as well as my first try which ended in an error with the cite, I've created a new BBX/CBX combo.
So I'm progressing, I chose option 2 from my last post, I took the authortitle-terse
as a base and copy-pasted it in my own style, then made some small changes. The code is below.
In short, neither my "book" nor my "thesis" driver definition are working. Here are my issues:
1) Book
- Delimiter are completely off
- The case for multiple authors is not consistent, it seems the driver do not recognize family and given name
- There is an extra "," between family and first name
- Moreover, I could not code this requirement : if the label field is set, there should be an extra text after the bibliography which says (cité : all author family names in small caps separated by "/"-field
Example for the first cite :
Druey Jean-Nicolas, Titre au hasard ,2e éd., Berne 2016 (cité : Druey-Titre)
2) Thesis
- There are " between the title
- The title is not in italic
- There is an extra "," between first and family name
- The separation for block and unit seems way off from my need…
3) Language not detected
I had to force the recnognition of the language. It was not automatically taken.
This caused some real pain, as I only noticed that the issue after adding the "edition" field, noticing that it was in English.
MWE Code
Main.tex
% 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 (copy-past of 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
Best Answer
@book
In general you don't want to change
\newblockpunct
you need to change\newunitpunct
The parser recognises the names correctly, you want
You need
See below
@thesis
Your main problem was that you had an
\endinput
after the driver for@book
. That line causedbiblatex
to ignore everything after it, so the@thesis
driver was never read.With
you get all titles in italics without quotation marks.
Language not detected
Your MWE detected the French language just fine for me without
language=french
. If you use really ancient versions ofbiblatex
orpolyglossia
that could be problematic, but with a fairly modern version, you should be fine.The citation style
The
label
field is only added if there are two works by the same authors. And only then you get to see 'cité' in the bibliography.The styles are already equipped to do that for us, we only need
and two macros to print the 'cité' information in the bibliography
Test document
.bbx
.cbx