7

I need to sort my biblatex entries on the base of the first author only (authortitle style), but I need the complete list of authors in the bibliography. I can use something like

\DeclareSortingScheme{mio}{
 \sort{\field{author}}
}

but how can I extract the first author only? Otherwise said, how can I extract partial infos from bibtex entries (the first author as an example?)

Can anyone help me?

Thank you

I use biblatex biber teklive

Order of reference here should be the inverse

enter image description here

Example:

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\usepackage[natbib = true, backend = biber, style = authoryear, sorting = nyt]{biblatex}

\begin{filecontents}{\jobname.bib}

@article{A2014,
author={A,B and C,D},
title={Test},
year = {2014}
}

@article{A2000,
author={A,B and D,E},
title={Test},
year = {2000}
}

\end{filecontents} 

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography

\end{document}

UPDATE

I have the answer right now, but I edited the question anyway because I think this could be a common problem for newbies like me and I didn't find an example on the net

Therefore, please answer this question giving also some detail about the use of sortname, \DeclareSourcemap \DeclareSortingScheme to help me learn.

2
  • How is the normal sorting scheme inadequate? Normally it is sorted by author, with secondary and subsequent authors only coming into play with multi-author works, but still sorted by primary author.
    – Nigel
    Sep 26, 2014 at 4:12
  • Please, post a MWE or a example of what you want. For example, in the sorting is only necessary the lastname of the first author or you need sorting using the fullname of the fisrt author. Depending of you answer the approach is different. Sep 26, 2014 at 4:40

1 Answer 1

9

How I commented in your question I see two possibilities for sorting the bibliographies entries:

The first: Using only the Last Name of the First Author

How you are using biber, you are able to use labelalpha (biblatex.pdf. page 59). Using labelalpha you can use only one author, with the maxalphanames. Then if it is set to 1 biber only use the first author (really the lastname) for make the labelalpha. Finally, it is necessary to specify a sorting scheme that use labelalpha for example anyt (Page 254, biblatex.pdf). Then load biblatex whith:

\usepackage[maxalphanames=1,labelalpha,maxbibnames=99, sorting=anyt, style=authoryear, natbib=true,  backend=biber]{biblatex}

MWE

\documentclass{article}
\begin{filecontents}{MWE.bib}
@article{A2014,
author={A,B and C,D},
title={Test},
year = {2014}
}

@article{A2000,
author={A,B and D,E},
title={Test},
year = {2000}
}

\end{filecontents}
\usepackage[maxalphanames=1,labelalpha,maxbibnames=99, sorting=anyt, style=authoryear, natbib=true,  backend=biber]{biblatex}
\addbibresource{MWE.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

The maxbibanames=99 is for printed the full authors in the bibliography.

The second: Using the fullname of the First Author

This is possible using DeclareStyleSourcemap. The most the default alphabetic sorting schemes of biblatex are able to use sortname field. Then it is possible use DeclareStyleSourcemap for copy the fullname of the first author in the sortname field. For a explains about Regular Expressions read the perl documentation here.

\DeclareStyleSourcemap{
    \maps[datatype=bibtex]{
      \map{
        \step[fieldsource=author, match=\regexp{(.+)\sand}, final]
        \step[fieldset=sortname, fieldvalue=$1, final]  }
}}

MWE

\documentclass{article}
\begin{filecontents}{MWE.bib}
@article{A2014,
author={A,Bo and M,M},
title={Test},
year = {2014}
}

@article{A2000,
author={A,Co and D,E},
title={Test},
year = {2000}
}

\end{filecontents}

\RequirePackage[maxbibnames=99, sorting=nyt, style=authoryear,  backend=biber]{biblatex}

\DeclareStyleSourcemap{
    \maps[datatype=bibtex]{
      \map{
        \step[fieldsource=author, match=\regexp{(.+)\sand}, final]
        \step[fieldset=sortname, fieldvalue=$1, final]  }
}}

\addbibresource{MWE.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

7
  • For me the first solution does not work (using Biber 1.9). The second works fine.
    – Jörg
    Nov 29, 2014 at 15:46
  • is there a solution for backend=bibtex8?
    – Jaska
    Jan 11, 2016 at 17:01
  • The sorting=anyt seems to break down with additional references by only one author. How can one handle such a case? Jan 28, 2016 at 0:35
  • 1
    If you have more than 2 authors and you still want to use just the first for sorting, replace (.+)\sand with (.+?)\sand in the regexp{}-function -- otherwise only the last is removed for sorting
    – kromuchi
    Jul 25, 2016 at 16:44
  • I modified the line to \step[fieldsource=author, match=\regexp{([^,]+),\s+(.).*?\sand}, final]. this gives me sorting by first author, first initial (i.e. J. Smith and James Smith are sorted the same). Don't know if it works with prefixes/postfixes.
    – Åsmund
    Dec 27, 2016 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .