0

In my first question I covered the definition of the Bibliography driver, and now I'm almost done with the definition, thanks to the help of this forum.

GutNicolas, Die unbezifferte Forderungsklage nach der Schweizerischen Zivil-prozessordnung, These, Bâle , 2014 (cité :Gut , These ).

I'd need to get this kind of bibliography :

Gut Nicolas, Die unbezifferte Forderungsklage nach der Schweizerischen Zivil-prozessordnung, thèse, Bâle 2014 (cité :Gut-These ).

This means :

  1. Change the delimiter in the cited as part
  2. Change the delimiter in case of multiple location to " / "
  3. Allows multiple location (builtin ?)
  4. Remove the punctuation (,) in between the type, location and year part.
  5. Change the use of "printfield{label}" to "printfield{type}"

Question :

Which kind of parameter should I investigate ?

Edit 1 - MWE instead of Extracts

Following the remark from @moewe, I edit this post to include a MWE.

Main.Tex

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

Main.bib

@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
8
  • Please post the full .bbx and .cbx files so we know what we are talking about. It would also help if you could add a short .tex document with an example .bib entry of a @thesis that uses your custom styles. – moewe Apr 25 '18 at 12:53
  • Call me stupid, but I don't see any code at all. – moewe Apr 25 '18 at 14:12
  • You're far from stupid, but much faster than my edition skills. I needed to cut through my current version to isolate the relevant part – XaWin Apr 25 '18 at 14:24
  • Ah OK, I thought you'd show us the entire thing. – moewe Apr 25 '18 at 14:32
  • Well, my full style contains non-MWE relevant things. Among other, other entry type and drivers, conditional bibliography, as per my others posts here (tex.stackexchange.com/questions/427231/… or tex.stackexchange.com/questions/427906/…) – XaWin Apr 25 '18 at 14:35
1
  1. I think we had this before \DeclareDelimFormat{nametitledelim}{\textendash} is what you need.

  2. As for the names, where you use multinamedelim and finalnamedelim you now need

    \DeclareDelimFormat{multilistdelim}{\addnbspace\slash\addspace}
    \DeclareDelimAlias{finallistdelim}{multilistdelim}
    
  3. Is already possible. location is a list field and you can give multiple locations separated by and: location = {Berne and Bâle},

  4. This is done in the location+date macro.

  5. Done.

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
4
  • Indeed for (1) it was part of some comments in another message. This line triggers a warning "Package biblatex Warning: Delimiter 'nametitledelim' in context '' already defined, overwriting.". Is there any way to remove it? – XaWin Apr 25 '18 at 15:48
  • @XaWi That is only a warning that can be safely ignored. Newer versions of biblatex do not issue a warning in these cases any more: github.com/plk/biblatex/pull/621 – moewe Apr 25 '18 at 15:49
  • And another question, why do we need a starred \DeclareFieldFormat*{citetitle}{#1} but a normal. plain \DeclareDelimFormat{nametitledelim}{\textendash} ? – XaWin Apr 25 '18 at 15:55
  • @XaWi The star is needed if you want to overwrite type-specific definitions (type-specific definitions are made using the optional argument). citetitle has type-specific defaults, so these need to be reset with the starred version. \DeclareDelimFormat is similar, but there the starred version erases context-specific definitions. There are context-specific definitions of nametitle and we don't want to overwrite those. – moewe Apr 25 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.