2

Recently I reinstalled Windows 10 on my computer, so I reinstalled texlive, texstudio, etc.

I had a bibliography style which was perfect thanks to this forum but yesterday when I compiled, I discovered with horror that my bibliography style had changed.

Indeed, as you can see with pictures, there are not bracket for authors and byeditor's initial, besides citation style and the label are in small caps whereas I would like in lower case. I don't understand why it's changing.

Before update and with my last configuration I had: Before Now I have that: Now

And to success to compile I have to replace firstinit by giveninits

Do you have an idea? I guess it's cause to update of biblatex but I'm a too bad in code to know where the issue is ?

Thanks, PS: sorry for my big MWE ...

\documentclass[10pt]{article}
\RequirePackage{polyglossia}
\setdefaultlanguage{french}
\setmainfont[Mapping=tex-text]{Times New Roman}
\RequirePackage{xpatch}
\usepackage{csquotes} 

%MACRO

\providecommand{\ier}{\textsuperscript{er}}
\providecommand{\iers}{\textsuperscript{ers}}
\providecommand{\iere}{\textsuperscript{ère}}
\providecommand{\ieres}{\textsuperscript{ères}}
\providecommand{\ieme}{\textsuperscript{e}}
\providecommand{\iemes}{\textsuperscript{es}}
\providecommand{\nd}{\textsuperscript{nd}}
\providecommand{\nds}{\textsuperscript{nds}}
\providecommand{\nde}{\textsuperscript{nde}}
\providecommand{\ndes}{\textsuperscript{ndes}}
\providecommand{\no}{\textsuperscript{o}}
\providecommand{\nos}{\textsuperscript{os}}
\providecommand{\mme}{M\textsuperscript{me}\space}
\providecommand{\mmes}{M\textsuperscript{mes}\space}
\providecommand{\mr}{M.\space}
\providecommand{\mrs}{MM.\space}

%bibliography
  \usepackage[%                                                             
  backend=bibtex,%
  style=authoryear,%
  autolang=hyphen,%
  giveninits,%
  mergedate=false,%
  style=authoryear,
  maxcitenames=2,%
  maxbibnames=999% 
  ]{biblatex} 
  \addbibresource{bibliographie/fusion}

  \renewcommand*{\revsdnamepunct}{}
  \renewcommand*{\finalnamedelim}{\multinamedelim}
  \renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}
  \DeclareNameAlias{byeditor}{sortname}
  \DeclareNameAlias{sortname}{last-first}

  \renewcommand*{\labelnamepunct}{\space\textendash\space}                  %tiret après le label
  \renewbibmacro*{date+extrayear}{}%                                            rajoute date

  \DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1} 
  \renewbibmacro{in:}{%                                                                 enlève guillemets articles
    \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

  \renewbibmacro*{issue+date}{%
    \printfield{issue}%
    \setunit{\addcomma\space}%
    \printdate%
    \newunit}

  \DeclareFieldFormat{postnote}{#1} %enlève le p. automatique pour le postnote dans les citations

  \renewbibmacro*{publisher+location+date}{%
    \printlist{location}%
    \setunit*{\addcomma\space}%
    \printlist{publisher}%
    \setunit*{\addcomma\space}%
    \usebibmacro{date}%
    \newunit}


  %Met les abréviations des revues
  \renewbibmacro*{journal}{%
    \iffieldundef{shortjournal}
    {%
        \iffieldundef{journaltitle}
        {}
        {%
            \printtext[journaltitle]
            {%
                \printfield[titlecase]{journaltitle}%
                \setunit{\subtitlepunct}%
                \printfield[titlecase]{journalsubtitle}%
            }%
        }%
    }
    {\printtext[journaltitle]{\printfield[titlecase]{shortjournal}}}%
  }


  %Enlever le tiret lorsqu'il y a une récurrence des auteurs
  %
  \makeatletter
  \AtEveryBibitem{%
    \global\undef\bbx@lasthash%
    \clearfield{extraalpha}}
  \makeatother



  % "Et al." en ITALIQUE
  \renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
    \ifboolexpr{
        test {\ifnumequal{\value{listcount}}{\value{liststop}}}
        and
        test \ifmorenames
    }
    {\ifnumgreater{\value{liststop}}{1}
        {\finalandcomma}
        {}%
        \andothersdelim\bibstring[\emph]{andothers}}
    {}}

  %%% Histoire des noms    et al...
  \makeatletter
  \renewbibmacro*{begentry}{%
    \renewcommand*{\mkbibnamelast}[1]{##1}%
    \defcounter{maxnames}{\blx@maxcitenames}%
    \printtext[bold]{\usebibmacro{cite}\addspace:\space}%
    \defcounter{maxnames}{\blx@maxbibnames}
    \renewcommand*{\mkbibnamelast}[1]{\textsc{\textnohyphenation{##1}}}}
  \makeatother

  %minuscule citation
  \AtBeginDocument{\renewcommand*{\mkbibnamelast}[1]{#1}}   

  %Enlève parenthèse colloque

  \renewbibmacro*{event+venue+date}{                        
    \iffieldundef{eventtitle}
    {}
    {%
        \bibstring{presentedat}%
        \printfield{eventtitle}%
    }%
    \ifboolexpr{
        test {\iffieldundef{venue}}
        and
        test {\iffieldundef{eventyear}}
    }
    {}
    {\setunit*{\addspace}%
        \printtext{%
            \printfield{venue}%
            \setunit*{\addcomma\space}%
            \printeventdate}}%
    \newunit
  }


  \DefineBibliographyStrings{french}{%
    byeditor = \iffieldequalstr{keywords}{source}%                      
    {Établit\space par}%
    {dir\adddotspace\smartof}, 
    in = {\textit{in}},%                                    %et en italique
    editor           = {dir\adddotspace},%
    editors          = {dir\adddotspace},%
    opcit = \iffieldequalstr{entrytype}{article}{art\adddotspace cit\adddot}{\emph{op\adddotspace cit}\adddot},%
    idem = {\emph{idem}},%
    byeditor = {dir\adddot},% Remplace sous la direction de pour les improceedings etc. 
    ibidem = {\emph{ibid\adddot}},%
    %pagetotal = {p\adddot},%
    %pages            = {pp\adddot},%
  }

  %modifie les pages des articles ... par pp. au lieu de p.
  \DeclareFieldFormat[article,inbook,inproceedings,incollection]{pages}{pp\adddotspace #1}%


  %enlève la virugule avant dir.
  \makeatletter
  \renewbibmacro*{bbx:editor}[1]{%
    \ifboolexpr{
        test \ifuseeditor
        and
        not test {\ifnameundef{editor}}
    }
    {\usebibmacro{bbx:dashcheck}
        {\bibnamedash}
        {\printnames{editor}%
            %   \setunit{\addcomma\space}% DELETED
            \setunit{\addspace}% ADDED
            \usebibmacro{bbx:savehash}}%
        %     \usebibmacro{#1}% DELETED
        \printtext{\usebibmacro{#1}}% ADDED
        \clearname{editor}}
    {\global\undef\bbx@lasthash}}
  \makeatother


  % put (dir.) at the end (byeditor)  pour tout ce qui est in : auteur dir.
  \renewbibmacro*{byeditor+others}{%
    \ifnameundef{editor}
    {}
    {%%%\usebibmacro{byeditor+othersstrg}       %%%% suppress
        \setunit{\addcomma\addspace}%
        \printnames[byeditor]{editor}%
        \setunit{\addspace}%
        % \addspace                                  %%%% suppress
        %     \usebibmacro{byeditor+othersstrg}          %%%% 
        \usebibmacro{editor+othersstrg}             %%%% 
        \clearname{editor}%            %%%%%%%%% 
        \newunit}%
    \usebibmacro{byeditorx}%
    \usebibmacro{bytranslator+others}}



  %%modifié book pour virgule
  \DeclareBibliographyDriver{book}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{maintitle+title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\addcomma
    \printfield{pagetotal}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \usebibmacro{series+number}%     rajoute a la fin series + nomber pour avoir la collection a la fin de la ligne. La modification du style est plus bas.
    \newunit\newblock
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}

  %Change ordre des entrées pour les in quelquechoses : 
  \DeclareBibliographyDriver{incollection}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others}%
    \setunit{\space\textendash\space}\newblock
    \usebibmacro{maintitle+title}%
    \newunit\newblock   
    \usebibmacro{in:}%
    \usebibmacro{bybookauthor}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins
    \usebibmacro{maintitle+booktitle}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}

  \DeclareBibliographyDriver{inproceedings}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others}%
    \setunit{\space\textendash\space}\newblock
    \usebibmacro{maintitle+title}%
    \newunit\newblock   
    \usebibmacro{in:}%
    \usebibmacro{byeditor+others}%
    \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins 
    \usebibmacro{maintitle+booktitle}%
    \newunit\newblock
    \usebibmacro{event+venue+date}%
    \newunit\newblock
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \printlist{organization}%
    \newunit
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \usebibmacro{series+number}%
    %  \newunit\newblock %%%% enlever
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}

  \DeclareBibliographyDriver{inbook}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others}%
    \setunit{\space\textendash\space}\newblock
    \usebibmacro{maintitle+title}%
    \newunit\newblock   
    \usebibmacro{in:}%
    \usebibmacro{byeditor+others}%
    \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins
    \usebibmacro{maintitle+booktitle}%
    \usebibmacro{bybookauthor}%
    \newunit\newblock
    \usebibmacro{maintitle+booktitle}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}

  \DeclareBibliographyDriver{proceedings}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{editor+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{maintitle+title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{event+venue+date}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \iffieldundef{maintitle}
    {\printfield{volume}%
        \printfield{part}}
    {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \printlist{organization}%
    \newunit
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\addcomma
    \printfield{pagetotal}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}%
    \newunit\newblock
    \usebibmacro{series+number}% rajoute collection
    \newunit\newblock
    \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
        \usebibmacro{related}}
    {}%
    \usebibmacro{finentry}}


  %% Pour avoir collaboration après l'auteur pour namea
  \makeatletter
  \renewbibmacro*{author}{%
    \ifboolexpr{
        test \ifuseauthor
        and
        not test {\ifnameundef{author}}
    }
    {\usebibmacro{bbx:dashcheck}
        {\bibnamedash}
        {\printnames{author}%
            \setunit{\addcomma\space}%
            \usebibmacro{bbx:savehash}%
            \usebibmacro{authorstrg}%
            \ifnameundef{namea}
            {}
            {\setunit{\addcomma\space}%
                \global\undef\bbx@lasthash%
                \usebibmacro{authorstrg}%
                \setunit{\addspace}%
                \usebibmacro{bynameastrg}%
                \setunit{\addspace}%
                \printnames{namea}}}}
    {\global\undef\bbx@lasthash}}
  \newbibmacro*{bynameastrg}{%
    \iffieldundef{nameatype}
    {}
    {\usebibmacro{bytypestrg}{namea}{editor}}}
  \makeatother


  %met entre parenthèse la collection et le numéro dans la même parenthèse
  \renewbibmacro*{series+number}{%
    \iffieldundef{series}
    {}
    {\printtext[parens]{%
            \printtext{}%
            \printfield{series}%
            \setunit*{\space}%
            \printfield{number}%
            \printtext{}}%
    }} %%% il y a un point en enleveant \nopunct.

    %Rajoute une virgule après le titre du journal et avant le numéro du volume     
    \renewbibmacro*{journal+issuetitle}{%
        \usebibmacro{journal}%
        \setunit*{\addcomma\space}%
        \iffieldundef{series}
        {}
        {\newunit
            \printfield{series}%
            \setunit{\addspace}}%
        \usebibmacro{volume+number+eid}%
        \setunit{\addspace}%
        \usebibmacro{issue+date}%
        \setunit{\addcolon\space}%
        \usebibmacro{issue}%
        \newunit}

    %Permet d'enlever le tiret après in si pas d'auteur.
    \renewbibmacro{in:}{%
        \ifentrytype{article}
        {}
        {\printtext{\bibstring{in}}%
            \printunit{\intitlepunct}}}


    %permet de mettre les initiales entre parenthèses et surtout les particules nobilaires
    \renewcommand*{\revsdnamepunct}{\addspace}

    \renewbibmacro*{name:last-first}[4]{%
        \ifuseprefix
        {\usebibmacro{name:delim}{#3#1}%
            \usebibmacro{name:hook}{#3#1}%
            \ifblank{#3}{}{%
                \ifcapital
                {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
                {\mkbibnameprefix{#3}\isdot}%
                \ifpunctmark{'}{}{\bibnamedelimc}}%
            \mkbibnamelast{#1}\isdot
            \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
            \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibparens{\mkbibnamefirst{#2}}\isdot}}% added \mkbibparens
        {\usebibmacro{name:delim}{#1}%
            \usebibmacro{name:hook}{#1}%
            \mkbibnamelast{#1}\isdot
            \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
            \ifblank{#2#3}{}{\revsdnamepunct}%
            \ifblank{#2}{}{\bibnamedelimd\bibopenparen\mkbibnamefirst{#2}\isdot}% added \bibopenparen
            \ifblank{#3}{}{\bibnamedelimd\ifblank{#2}{\bibopenparen}{}\mkbibnameprefix{#3}\isdot}% added \ifblank{#2}{\bibopenparen}{}
            \ifblank{#2#3}{}{\bibcloseparen}}}% this line is new
    %%%


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

@Book{arnaud2005,
    title =     {Les routes de la navigation antique. Itinéraires en Méditerranée},
    publisher = {Errance},
    year =      {2005},
    author =    {Pascal Arnaud},
    pagetotal = {248},
    address =   {Paris},
}

@Inproceedings{arcelin1976,
    author =    {Patrice Arcelin},
    title =     {Les civilisations de l'âge du Fer en Provence},
    booktitle = {La préhistoire française, II. Les civilisations néolithiques et protohistoriques de la France},
    year =      {1976},
    pages =     {657-675},
    editor =    {Guilaine, Jean},
    address =   {Paris},
}


\end{filecontents}

\addbibresource{\jobname.bib}


\begin{document} 

    \cite{arnaud2005, arcelin1976}

    \printbibliography


\end{document}

Edit 1: I have just discovered a last problem which appears for certain cases, how it appears with you:

@Book{roman.roman1997,
  title =     {Histoire de la Gaule (VI\ieme{} s. av. J.-C. -- I\ier{} s. ap. J.-C.). Une confrontation culturelle},
  publisher = {Fayard},
  year =      {1997},
  author =    {Daniele Roman and Yves Roman},
  pagetotal = {791},
  address =   {Paris},
  owner =     {Axel},
}

This problem of initial appears in some other cases while my bibliography contains more than 500 entries which works well. Do you have an idea? I try to recreate entry, remove accent, change title etc. Nothing works !

new problem... :(

  • If your biblatex is not older than version 3.3, you need to adapt the name format, see Biblatex 3.3 name formatting. – moewe Apr 12 '16 at 17:34
  • Didn't check, but maybe it's enough to change name:last-first to name:family-given. All \mkbibnamelasts need to be \mkbibnamefamily, \mkbibnamefisrt becomes \mkbibnamegiven etc. pp. – moewe Apr 12 '16 at 17:35
  • 2
    @cfr Amongst the many changes in name handling in biblatex 3.3 is that the name:family-given macros have to be defined differently for Biber and BibTeX. With the BibTeX backend the name parts are strings and are tested with \ifblank, while with Biber they are macros and are tested with \ifempty. I suppose that is a problem here. The \ifempty macro had some other problems and so in the upcoming version 3.4 Biber will use \ifdefvoid. Using the "wrong" test can lead to unexpected output I guess. (I didn't have to check the case at hand, but I suspect that's what's going on.) – moewe Apr 14 '16 at 6:27
  • 1
    Of course above I wanted to say "I didn't have time to check the case at hand." Just did a bit of investigating and indeed, with the modified code below you don't get spurious space. – moewe Apr 14 '16 at 14:47
  • 1
    If you don't like it, you can use uniquename=false, – moewe Apr 15 '16 at 8:37
5

If you use Biber you will need the following redefinition of name:family-given

\renewbibmacro*{name:family-given}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifdefvoid{#3}{}{%
       \ifcapital
         {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
         {\mkbibnameprefix{#3}\isdot}%
       \ifprefchar{}{\bibnamedelimc}}%
     \mkbibnamefamily{#1}\isdot
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#4}}}
       {}
       {\bibnamedelimd\bibopenparen}%
     \ifdefvoid{#2}{}{\mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#4}{}{\ifdefvoid{#2}{}{\bibnamedelimd}\mkbibnamesuffix{#4}\isdot}%
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#4}}}
       {}
       {\bibcloseparen}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamefamily{#1}\isdot
     \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}
       {\revsdnamepunct\bibopenparen}%
     \ifdefvoid{#2}{}{\mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#3}{}{\ifdefvoid{#2}{}{\bibnamedelimd}\mkbibnameprefix{#3}\isdot}%
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}
       {\bibcloseparen}}}

Aside from the changes already applied by cfr (those are also explained in Biblatex 3.3 name formatting) we need to change the \ifblanks to \ifdefvoid (this is contrary to what you currently see in version 3.3, but \ifempty had some problems and will be removed).

Because name handling has changed so drastically, the old code and current BibTeX code needs to use \ifblank, while current Biber needs \ifdefvoid.

  • Thanks you very much ! I will keep two version of code to watch and learn ! To finish do you have an idea for the citation style's issue ? Why I have small caps when I do \parencite for example : I have (ARCELIN 1976) and I would like (Arcelin 1976). I think that I make an excessive use of your kindness and yours talents – Axelito Apr 14 '16 at 18:59
  • 1
    @Axelito Mhhh, did it not have small caps before? I'd have thought if we change all \mkbibnamelasts to \mkbibnamefamily everything should work. Try \DefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}. – moewe Apr 15 '16 at 7:27
  • My hero ! I have no words (in english) to explain my gratitude ! :D – Axelito Apr 15 '16 at 7:36
  • @moewe : thank you. What's the purpose of the \ifboolexpe{% (and following) lines exactly ? – Carg Jun 6 '16 at 16:36
  • 1
    @Carg I think the old version was \ifempty{#2#3}. In the old days the arguments were "strings", now they are macros. While two strings #2 and #3 are empty if their concatenation #2#3 is empty, this doesn't work as easy with macros. \ifdefvoid{\a\b} doesn't work. – moewe Jun 7 '16 at 4:32
3

The following seems to work. This uses Latin Modern since I doubt very much that I have a font called Times New Roman complete with small-caps etc.

I had to switch to the Biber backend to get this to work. Without that, Biblatex refused to countenance a UTF-8 encoded database file, which you presumably want in this case.

modified example

\begin{filecontents}{\jobname.bib}
@Book{arnaud2005,
  title =     {Les routes de la navigation antique. Itinéraires en Méditerranée},
  publisher = {Errance},
  year =      {2005},
  author =    {Pascal Arnaud},
  pagetotal = {248},
  address =   {Paris},
}
@Inproceedings{arcelin1976,
  author =    {Patrice Arcelin},
  title =     {Les civilisations de l'âge du Fer en Provence},
  booktitle = {La préhistoire française, II. Les civilisations néolithiques et protohistoriques de la France},
  year =      {1976},
  pages =     {657-675},
  editor =    {Guilaine, Jean},
  address =   {Paris},
}
\end{filecontents}
\documentclass[10pt]{article}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{xpatch}
\usepackage{csquotes}

\providecommand{\ier}{\textsuperscript{er}}
\providecommand{\iers}{\textsuperscript{ers}}
\providecommand{\iere}{\textsuperscript{ère}}
\providecommand{\ieres}{\textsuperscript{ères}}
\providecommand{\ieme}{\textsuperscript{e}}
\providecommand{\iemes}{\textsuperscript{es}}
\providecommand{\nd}{\textsuperscript{nd}}
\providecommand{\nds}{\textsuperscript{nds}}
\providecommand{\nde}{\textsuperscript{nde}}
\providecommand{\ndes}{\textsuperscript{ndes}}
\providecommand{\no}{\textsuperscript{o}}
\providecommand{\nos}{\textsuperscript{os}}
\providecommand{\mme}{M\textsuperscript{me}\space}
\providecommand{\mmes}{M\textsuperscript{mes}\space}
\providecommand{\mr}{M.\space}
\providecommand{\mrs}{MM.\space}

%bibliography
\usepackage[%
backend=biber,
style=authoryear,
autolang=hyphen,
uniquename=init,
giveninits,
mergedate=false,
maxcitenames=2,
maxbibnames=999,
]{biblatex}

\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}
\DeclareNameAlias{byeditor}{sortname}
\DeclareNameAlias{sortname}{family-given}

\renewcommand*{\labelnamepunct}{\space\textendash\space}                  %tiret après le label
\renewbibmacro*{date+extrayear}{}%                                            rajoute date

\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}
\renewbibmacro{in:}{%                                                                 enlève guillemets articles
  \ifentrytype{article}
  {}
  {\printtext{\bibstring{in}\intitlepunct}}}

\renewbibmacro*{issue+date}{%
  \printfield{issue}%
  \setunit{\addcomma\space}%
  \printdate%
  \newunit}

\DeclareFieldFormat{postnote}{#1} %enlève le p. automatique pour le postnote dans les citations

\renewbibmacro*{publisher+location+date}{%
  \printlist{location}%
  \setunit*{\addcomma\space}%
  \printlist{publisher}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  \newunit}

%Met les abréviations des revues
\renewbibmacro*{journal}{%
  \iffieldundef{shortjournal}
  {%
    \iffieldundef{journaltitle}
    {}
    {%
      \printtext[journaltitle]
      {%
        \printfield[titlecase]{journaltitle}%
        \setunit{\subtitlepunct}%
        \printfield[titlecase]{journalsubtitle}%
      }%
    }%
  }
  {\printtext[journaltitle]{\printfield[titlecase]{shortjournal}}}%
}

%Enlever le tiret lorsqu'il y a une récurrence des auteurs
\makeatletter
\AtEveryBibitem{%
  \global\undef\bbx@lasthash%
  \clearfield{extraalpha}}
\makeatother

% "Et al." en ITALIQUE
\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
  {\ifnumgreater{\value{liststop}}{1}
    {\finalandcomma}
    {}%
    \andothersdelim\bibstring[\emph]{andothers}}
  {}}

%%% Histoire des noms    et al...
\makeatletter
\renewbibmacro*{begentry}{%
  \renewcommand*{\mkbibnamefamily}[1]{##1}%
  \defcounter{maxnames}{\blx@maxcitenames}%
  \printtext[bold]{\usebibmacro{cite}\addspace:\space}%
  \defcounter{maxnames}{\blx@maxbibnames}
  \renewcommand*{\mkbibnamefamily}[1]{\textsc{\textnohyphenation{##1}}}}
\makeatother

%minuscule citation
\AtBeginDocument{\renewcommand*{\mkbibnamefamily}[1]{#1}}

%Enlève parenthèse colloque
\renewbibmacro*{event+venue+date}{
  \iffieldundef{eventtitle}
  {}
  {%
    \bibstring{presentedat}%
    \printfield{eventtitle}%
  }%
  \ifboolexpr{
    test {\iffieldundef{venue}}
    and
    test {\iffieldundef{eventyear}}
  }
  {}
  {\setunit*{\addspace}%
    \printtext{%
      \printfield{venue}%
      \setunit*{\addcomma\space}%
      \printeventdate}}%
  \newunit
}

\DefineBibliographyStrings{french}{%
  byeditor = \iffieldequalstr{keywords}{source}%
  {Établit\space par}%
  {dir\adddotspace\smartof},
  in = {\textit{in}},%                                    %et en italique
  editor           = {dir\adddotspace},%
  editors          = {dir\adddotspace},%
  opcit = \iffieldequalstr{entrytype}{article}{art\adddotspace cit\adddot}{\emph{op\adddotspace cit}\adddot},%
  idem = {\emph{idem}},%
  byeditor = {dir\adddot},% Remplace sous la direction de pour les improceedings etc.
  ibidem = {\emph{ibid\adddot}},%
  %pagetotal = {p\adddot},%
  %pages            = {pp\adddot},%
}

%modifie les pages des articles ... par pp. au lieu de p.
\DeclareFieldFormat[article,inbook,inproceedings,incollection]{pages}{pp\adddotspace #1}%

%enlève la virugule avant dir.
\makeatletter
\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
  {\usebibmacro{bbx:dashcheck}
    {\bibnamedash}
    {\printnames{editor}%
      %   \setunit{\addcomma\space}% DELETED
      \setunit{\addspace}% ADDED
      \usebibmacro{bbx:savehash}}%
    %     \usebibmacro{#1}% DELETED
    \printtext{\usebibmacro{#1}}% ADDED
    \clearname{editor}}
  {\global\undef\bbx@lasthash}}
\makeatother

% put (dir.) at the end (byeditor)  pour tout ce qui est in : auteur dir.
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
  {}
  {%%%\usebibmacro{byeditor+othersstrg}       %%%% suppress
    \setunit{\addcomma\addspace}%
    \printnames[byeditor]{editor}%
    \setunit{\addspace}%
    % \addspace                                  %%%% suppress
    %     \usebibmacro{byeditor+othersstrg}          %%%%
    \usebibmacro{editor+othersstrg}             %%%%
    \clearname{editor}%            %%%%%%%%%
    \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

%%modifié book pour virgule
\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
  {\printfield{volume}%
    \printfield{part}}
  {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\addcomma
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
  {\printfield{isbn}}
  {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \usebibmacro{series+number}%     rajoute a la fin series + nomber pour avoir la collection a la fin de la ligne. La modification du style est plus bas.
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

%Change ordre des entrées pour les in quelquechoses :
\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others}%
  \setunit{\space\textendash\space}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{bybookauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
  {\printfield{volume}%
    \printfield{part}}
  {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
  {\printfield{isbn}}
  {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{inproceedings}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others}%
  \setunit{\space\textendash\space}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{byeditor+others}%
  \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{event+venue+date}%
  \newunit\newblock
  \iffieldundef{maintitle}
  {\printfield{volume}%
    \printfield{part}}
  {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
  {\printfield{isbn}}
  {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \usebibmacro{series+number}%
  %  \newunit\newblock %%%% enlever
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{inbook}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others}%
  \setunit{\space\textendash\space}\newblock
  \usebibmacro{maintitle+title}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{byeditor+others}%
  \setunit{\textendash\space}\newblock            %%%remplace \newunit\newblock pour rajouter un tiret entre le dir. et le mainttille des bouquins
  \usebibmacro{maintitle+booktitle}%
  \usebibmacro{bybookauthor}%
  \newunit\newblock
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
  {\printfield{volume}%
    \printfield{part}}
  {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
  {\printfield{isbn}}
  {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{proceedings}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{editor+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{event+venue+date}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
  {\printfield{volume}%
    \printfield{part}}
  {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\addcomma
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
  {\printfield{isbn}}
  {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \usebibmacro{series+number}% rajoute collection
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

%% Pour avoir collaboration après l'auteur pour namea
\makeatletter
\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
  {\usebibmacro{bbx:dashcheck}
    {\bibnamedash}
    {\printnames{author}%
      \setunit{\addcomma\space}%
      \usebibmacro{bbx:savehash}%
      \usebibmacro{authorstrg}%
      \ifnameundef{namea}
      {}
      {\setunit{\addcomma\space}%
        \global\undef\bbx@lasthash%
        \usebibmacro{authorstrg}%
        \setunit{\addspace}%
        \usebibmacro{bynameastrg}%
        \setunit{\addspace}%
        \printnames{namea}}}}
  {\global\undef\bbx@lasthash}}
\newbibmacro*{bynameastrg}{%
  \iffieldundef{nameatype}
  {}
  {\usebibmacro{bytypestrg}{namea}{editor}}}
\makeatother

%met entre parenthèse la collection et le numéro dans la même parenthèse
\renewbibmacro*{series+number}{%
  \iffieldundef{series}
  {}
  {\printtext[parens]{%
      \printtext{}%
      \printfield{series}%
      \setunit*{\space}%
      \printfield{number}%
      \printtext{}}%
  }} %%% il y a un point en enleveant \nopunct.

%Rajoute une virgule après le titre du journal et avant le numéro du volume
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addcomma\space}%
  \iffieldundef{series}
  {}
  {\newunit
    \printfield{series}%
    \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

%Permet d'enlever le tiret après in si pas d'auteur.
\renewbibmacro{in:}{%
  \ifentrytype{article}
  {}
  {\printtext{\bibstring{in}}%
    \printunit{\intitlepunct}}}

%permet de mettre les initiales entre parenthèses et surtout les particules nobilaires
\renewcommand*{\revsdnamepunct}{\addspace}

\renewbibmacro*{name:family-given}[4]{%
  \ifuseprefix
  {\usebibmacro{name:delim}{#3#1}%
    \usebibmacro{name:hook}{#3#1}%
    \ifblank{#3}{}{%
      \ifcapital
      {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
      {\mkbibnameprefix{#3}\isdot}%
      \ifpunctmark{'}{}{\bibnamedelimc}}%
    \mkbibnamefamily{#1}\isdot
    \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
    \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibparens{\mkbibnamegiven{#2}}\isdot}}% added \mkbibparens
  {\usebibmacro{name:delim}{#1}%
    \usebibmacro{name:hook}{#1}%
    \mkbibnamefamily{#1}\isdot
    \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
    \ifblank{#2#3}{}{\revsdnamepunct}%
    \ifblank{#2}{}{\bibnamedelimd\bibopenparen\mkbibnamegiven{#2}\isdot}% added \bibopenparen
    \ifblank{#3}{}{\bibnamedelimd\ifblank{#2}{\bibopenparen}{}\mkbibnameprefix{#3}\isdot}% added \ifblank{#2}{\bibopenparen}{}
    \ifblank{#2#3}{}{\bibcloseparen}}}% this line is new

\addbibresource{\jobname.bib}

\begin{document}
\cite{arnaud2005, arcelin1976}
\printbibliography
\end{document}
  • It works but the citation style is still in small caps. And after initial I don't want a space before the bracket. And I don't understand the difference between biber and bibtex... – Axelito Apr 13 '16 at 11:18
  • As far as I could tell, the image my code produced matched the target image in the question. If there's a mismatch, I'm afraid that it is too subtle for my eye! – cfr Apr 13 '16 at 17:37
  • Biber means you run biber to generate the bibliography and citations rather than bibtex. I.e. latex (or pdflatex or xelatex or lualatex) -> biber -> latex (-> latex if required) as opposed to latex -> bibtex -> latex -> latex. – cfr Apr 13 '16 at 17:39
  • Tanks for the explanation of difference. And for subtle difference is that I have a space after initial: I have: (P. ) ... I would like: (P.) I hope that I'm understandable – Axelito Apr 13 '16 at 18:54
  • OK. I see. I'm guessing you didn't write this code but I can't find an attribution in it. Is the source another answer here or somewhere else? Do you know who wrote it? – cfr Apr 13 '16 at 22:09

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.