7

I am trying to modify the way labels are formatted in the alphabetic style, as defined by biblatex: instead of the first 3 letters of the author and the last 2 digits of the year, I would like to have the whole last name of the author and the 4 digits of the year.
I can do it when there only one author with this code, slightly modified from the original definition:

\DeclareLabelalphaTemplate{
\labelelement{
\field[final]{shorthand}
\field{label}
\field[strside=left,ifnames=1]{labelname}%
\field[strside=left, names=3]{labelname}
 }
\labelelement{
\literal{~}
 }
\labelelement{
\field[strside=right]{year}
 }
\labelelement{
\literal{~:  }%
 }
 }

When there are severals authors, the names should be separated by a comma and a space (even the last one), and I didn't see a way to introduce this between the elements of the names list.
Does someone know if it is possible to achieve this ?

I have managed to satisfy the other requirements printing the names as last (firstinit.), comma separated. One way of trying the same for the label would be to print the list of the authors without the firstname part. Here is an example of what I obtain right now :

enter image description here

As you can see, when there are 2 or more authors, I'm unable to insert whatsoever between the names.

  • 2
    It really sounds like authoryear is more for you. – moewe Jan 25 '14 at 9:17
  • 1
    @Bernard That change (moving the year in the bibliography) is entirely independent of the citation style, so I'd also favour starting with authoryear and describing what needs to alter. – Joseph Wright Jan 25 '14 at 13:16
  • 1
    @Joseph Wright But authoryear doesn't have any label in the bibliography, so I should modify the style so as to obtain one as required. Back to square one, plus modifying so as to have the year at the end (not a big challenge). But maybe it would be better to look a the reading style. – Bernard Jan 25 '14 at 15:38
  • 1
    @Joseph Wright I added to the question an example of what I'm able to do now. It's not me who requires this label but an archaeological review. – Bernard Jan 25 '14 at 16:00
  • 1
    What happens with more authors? In my subject area, 20+ people is not impossible and I don't think would work. – Joseph Wright Jan 25 '14 at 16:14
7

The following is an attempt to get the style you seem to aim at.

As noted in the comments above, authoryear seems much more fitting than alphabetic in the case at hand.

You will have to load biblatex with

\usepackage[backend=biber, style=authoryear, firstinits, mergedate=false, maxcitenames=3, maxbibnames=999]{biblatex}

That implies that all the names are to appear in the bibliography while (in text) citations are shortened to a maximum of three names.

We use a period to separate blocks,

\renewcommand*{\newunitpunct}{\addperiod\space}

but no final punctuation.

\renewcommand*{\finentrypunct}{}

Names are formatted last first initials with the initials in parentheses, there is no comma between the names and the last name is set in small caps.

\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameFormat{last-first}{%
  \iffirstinits
    {\usebibmacro{name:last-first}{#1}{(#4)}{#5}{#7}}
    {\usebibmacro{name:last-first}{#1}{(#3)}{#5}{#7}}%
  \usebibmacro{name:andothers}}

There is a dash between the name and the title

\renewcommand*{\labelnamepunct}{\space--\space}

And we get rid of the additional year in the bibliography

\renewbibmacro*{date+extrayear}{}%

Articles do not get an In before the journal

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

And the date is not in parentheses

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

Furthermore, there is no colon but a comma between the location and the publisher

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

Finally, this code adds the bolded label before each entry in the bibliography. The code now makes sure to print only as many names as are printed in normal citations, we also assure the citation labels do not use small caps while the actual bibliography does.

\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

Currently the citation labels in the text use small caps, to get rid of that bahviour, also issue

\AtBeginDocument{\renewcommand*{\mkbibnamelast}[1]{#1}}

MWE

\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, firstinits, mergedate=false, maxcitenames=3, maxbibnames=999]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@collection{py:dicocer,
  editor        = {Michel Py},
  title         = {Dictionnaire des céramiques antiques (VIIe s. av. n. è. -- VIIe s. de n. è.) en Méditerranée nord-occidentale (Provence, Languedoc, Ampurdan)},
  series        = {Lattara},
  publisher     = {Lattes},
  number        = {6},
  date          = {1993},
  pagetotal     = {624},
}
@collection{CompGreekTrag:EuripidesIV,
  editor        = {Grene, David and Lattimore, Richmond},
  maintitle     = {The Complete Greek Tragedies},
  title         = {Euripides IV},
  date          = {1968-11},
  isbn          = {0-226-30783-2},
  pagetotal     = {314},
}
@incollection{beowulf06aa,
  editor        = {Stephen Greenblatt and M. H. Abrams and Carol T. Christ and Alfred David and Barbara K. Lewalski and Lawrence Lipking and George M. Logan and Deidre Shauna Lynch},
  title         = {Beowulf},
  booktitle     = {The Norton Anthology of English Literature},
  year          = {2006},
  edition       = {8},
  publisher     = {W. W. Norton},
  location      = {New York, New York},
  volume        = {1},
  pages         = {34-100},
}
@book{bohec,
  author        = {Le Bohec, Yann},
  title         = {Histoire militaire des guerres puniques},
  date          = {1996},
  location      = {Monaco},
  publisher     = {Rocher},
  isbn          = {2-268-02147-5},
}
@article{leveau,
  author        = {Philippe Leveau},
  title         = {Le franchissement du Rhône par Hannibal: le chenal et la navigation fluviale à la fin de l’Âge du Fer},
  journaltitle  = {Revue archéologique},
  date          = {2003},
  volume        = {35},
  pages         = {25-50},
  doi           = {10.3917/arch.031.0025},
}
@article{Shapiro2000,
  author        = {A.M. James Shapiro and Jonathan R.T. Lakey and Edmond A. Ryan and Gregory S. Korbutt and Ellen Toth and Garth L. Warnock and Norman M. Kneteman and Ray V. Rajotte},
  title         = {Islet Transplantation in Seven Patients with Type 1 Diabetes Mellitus Using a Glucocorticoid-Free Immunosuppressive Regimen},
  journaltitle  = {New England Journal of Medicine},
  date          = {2000},
  volume        = {343},
  number        = {2},
  pages         = {230--238},
  doi           = {10.1056/NEJM200007273430401},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\renewcommand*{\newunitpunct}{\addperiod\space}
\renewcommand*{\finentrypunct}{}
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameFormat{last-first}{%
  \iffirstinits
    {\usebibmacro{name:last-first}{#1}{(#4)}{#5}{#7}}
    {\usebibmacro{name:last-first}{#1}{(#3)}{#5}{#7}}%
  \usebibmacro{name:andothers}}

\renewcommand*{\labelnamepunct}{\space--\space}

\renewbibmacro*{date+extrayear}{}%

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1}

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

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

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


\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

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

\begin{document}
  \cite{wilde,cicero,coleridge,vangennep,vazques-de-parga,bohec,leveau,beowulf06aa,Shapiro2000,CompGreekTrag:EuripidesIV,py:dicocer}
  \printbibliography
\end{document}

enter image description here

  • I'll look at it later, but at first sight, it seems to fulfill all the requirements. Splendid! I'll have another requirement (adding new fields), but I think it's another question — and I'll try first myself… – Bernard Jan 25 '14 at 17:35

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.