1

Following my success with thesis, I'm getting now to a more complex topic, meaning the cross-referencing.

I got some big law books, called commentaire in french, which containing several sub-parts containing very detailled analysis on some piece of legislation called "article" in french (but this has nothing to do with article entry type). The relation is that the sub-parts (child) are cited in the text, but not the main book (parent). However, both the parent and the child entry should be cited.

I found the settings mincrossrefs which I've set to 1 to trigger the display of both parent and children.

So I've created a new type called "collectif", would contains only the parents infos. This is because these kind of parents type have unique formatting (see below, about authors/editors).

Now, I got some issue, because the formating of both piece should follow very strict rules. I'll start with the parent entry, where my code (MWE below) is mainly working as expected :

  1. All the editors should be in standard format (OK)
  2. After the names a string "(édit. ) should be displayed
  3. After editors, the should be a seperator (OK)
  4. The title should be in italic (OK)
  5. Finally, there should be a block location + year (OK).

Now the child entry should be similar as what I need in a book. So I've taken the codes from another question I asked. But I've got some issues when attempting to use it. Here are my requirements :

  1. Authors is small caps (OK)
  2. Title in Italic, not OK, I dont why the style is reset
  3. insertion of the cross-ref, the format should be "in :". At the moment I got "in : sous la dir. de "
  4. Again, the editors names are in small caps. Not that if a book contains both editors and authors, the authors should nevertheless be in small caps. So I need to have no-small caps only in the parent
  5. There is a ", " between the location and the year.

Finally, the addition of my new entry type seems to conflict with previous version : 11. The cited as is broker. It should identify that the "author" of child can also have a duplicate with other bilbiography entries, as in my MWE, there are 3 books/parts of commentaire from author "Bohnet".

At this point, I've tried, but there are too many movings parts and I cannot try to apply the solution proposed in some other questions

Question:

  1. What would the fixes of my horrible code be ?

MWE code

Main.tex

% MweBiblatex Swiss Legal
\documentclass{article}

% Needed by Biblatex
\usepackage{polyglossia}
\setmainlanguage{french}
\usepackage{parskip}
\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}

\subsection{Libre}
% Bohnet, livre Procédure : \cite{bohnetLivre} \\
Bohnet, livre Procédure en schéma : \cite{bohnetSchema} \\

\subsection{Commentaires}
Bohnet, commentaires : cite as \cite{cpc85} \\ and should be in bibliography as \\

\textsc{Bohnet} François, art. 85 CPC, in : Bohnet François et al. (édit.), Code de procédure civile commenté, Bâle 2011.

Bohnet François /Haldy Jacques /Jeandin Nicolas /Schweizer Philippe /Tappy Denis (edit.), Code de procédure civile commenté, Bâle 2011

\end{document}

Main.bib

@book{bohnetLivre,
  author        = {Bohnet, François},
  title         = {Procédure civile},
  edition       = 2,
  date          = {2014},
  location      = {Bâle},
  label         = {Procédure}
}

@book{bohnetSchema,
  author      = {Bohnet, François},
  title       = {La procédure civile en schémas},
  date        = {2014},
  location    = {Bâle},
  label         = {Schéma}
}

@book{bohnetActions,
  author        = {Bohnet, François},
  title         = {Actions civiles},
  subtitle      = {Conditions et conclusions},
  date          = {2014},
  location      = {Bâle},
  label         = {Actions}
}

@collectif{coCPC,
  editor        = {Bohnet, François and Haldy, Jacques and Jeandin, Nicolas and Schweizer, Philippe and Tappy, Denis},
  title         = {Code de procédure civile commenté},
  date          = {2011},
  location      = {Bâle},
}

@inbook{cpc85,
  author        = {Bohnet, François},
  title         = {art. 85 CPC},
  date          = {2011},
  location      = {Bâle},
  label         = {Commentaire},
  crossref      = {coCPC},
}

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\'e},
  thesis      = {th\`ese},
  habilthesis = {th\`ese d'habilitation},
}

% --- --- Setting default options --- --- %    
\ExecuteBibliographyOptions{%
    maxbibnames=99, % nombre max. de noms pour les entrées
    maxcitenames=99, % 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 de la bibliographie --- --- %

% Formatage des paramètres de la bibliographie
\setlength{\bibhang}{0pt}
\setlength{\bibitemsep}{1.5\baselineskip}

% Formatage global :
\DeclareFieldFormat{title}{\mkbibemph{#1}}

% Dans les citations, pas d'espaces entre les slash (contrairement à la bibliographie)
\renewcommand*{\multinamedelim}{\ifcitation{\slash}{\addnbspace\slash\addspace}}
\renewcommand*{\finalnamedelim}{\multinamedelim}
% BibLatex v2.8+ : Format des séparateurs entre les noms: des slash
% \DeclareDelimFormat{multinamedelim}{\slash}
% \DeclareDelimFormat[bib,biblist]{multinamedelim}{\addnbspace\slash\addspace}
% \DeclareDelimAlias{finalnamedelim}{multinamedelim}%

\renewcommand*{\multilistdelim}{\slash}
%\renewcommand*{\multilistdelim}{\addnbspace\slash\addspace}
\renewcommand*{\finallistdelim}{\multilistdelim}

\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 les ouvrages collectifs --- --- %

\DeclareFieldFormat[collectif]{title}{#1}
\DeclareFieldFormat[collectif]{editor}{#1}

\DeclareBibliographyDriver{collectif}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{editor}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \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{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}
}

% --- Formatage de la citation spécifique dans la bibliographie --- %

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

\newbibmacro{thesis:type+origlocation}{%
    \printfield{type}%
    \setunit*{\addspace}%
    \printlist{origlocation}%
    \newunit
}

\endinput % seulement à la fin

biblatex-xawi.cbx

\ProvidesFile{biblatex-xawi.cbx}[2018/04/13 v1.0 alpha]

\RequireCitationStyle{authortitle}

\DeclareFieldFormat*{citetitle}{#1}
\DeclareDelimFormat{nametitledelim}{\textendash}

% --- 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.dbx

\ProvidesFile{biblatex-xawi.dbx}[2018/04/18 v1.1]    
\DeclareDatamodelEntrytypes{collectif}    
\endinput
  • I agree with your assessment that this question is quite ambitious indeed. It required a lot of work for someone to give a proper and comprehensive answer here (it will at least involve defining one entirely new driver). On the other hand, this question is not going to be particularly interesting for future visitors, since it is quite unlikely they have the exact same problem and even if they have a requirement that is similar to one of your 10(!) subrequirements, it is going to be quite some work for them to figure out what does what. ... – moewe Apr 29 '18 at 6:23
  • ... What makes this question additionally less attractive for me is the fact that I can't use features of the current biblatex release such as \DeclareDelimAlias. Not only is it more cumbersome to answer if I'm not allowed the full power of a recent biblatex, it will also lead to the propagation of older coding techniques while I would very much prefer to spread the new, simpler way of doing things. – moewe Apr 29 '18 at 6:27
  • One thing I will say, though. Don't define a new type @collectif, stick with the standard type @collection. Make the entry cpc85 an @incollection and you have some things solved. Then you need to (re-)define the drivers for @collection and @incollection in the same way as your @thesis driver. Have a look at the drivers in standard.bbx to make sure you don't miss anything. In an @incollection, the title of the parent @collection can be accessed as booktitle. This does not work for your custom @collectif because you have not set up an inheritance rule to that effect. – moewe Apr 29 '18 at 6:31

Your Answer

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

Browse other questions tagged or ask your own question.