I'm using biblatex to create my own style, focused on legal documents in Switzerland, as per my last posts.
I'm now stuck with some official statement from the Swiss governement, which are published in a separate bibliography. I already know about the great option in biblatex to make several "\printbibliography" with a filter.
The format should be like this text, with no formatting at all. There are only 3 elements, the title, the reference to find it in a online ledger (note) and the label. All the citation to this entry should be just the content of the label.
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).
For me, this would translate to the following bibtex entry (more or less), based on my reading of the biblatex manual, page 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}
}
how can I define my own entry type "message" ?
General guideline were answered by @Moewe in comment, which directed me to this post. To make this question more interesting, I'll come back with my own code and potential issue for this case.
Edit : Questions after my initial test
The definition went pretty well, the new type is working almost as expected.
The remaining issue is the formating of the "cited as" part. Ideally, it should be in plain text or in small caps. However, none of my tryouts have worked so far.
1) How can I set the style of "cite" in both the cite and bibliography in standard ?
2) How can I set the style of "cite" in both the cite and bibliography in Small Caps ?
Note : The part for cited is taken from my previous question, on the creation of own drivers.
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}
\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}
main.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 = {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
Best Answer
The general process of adding new entry types and setting them up correctly is explained in How can I create entirely new data types with BibLaTeX/Biber?.
You can change the format of the 'Message CPC' with
Note that there is no start here and that the changed format is
citetitle
(notlabel
orcitelabel
).In modern versions of
biblatex
, you can't put\DeclareDatamodelEntrytypes{message}
into the.bbx
file. Data model commands must live in the datamodel file with ending.dbx
.biblatex-xawi.bbx
biblatex-xawi.cbx
biblatex-xawi.dbx