# Order by first author only (not all names) than by year or Sort by a partial entry in biblatex

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

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}

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

• 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. 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

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}
\begin{document}
\nocite{*}
\printbibliography
\end{document}


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


• 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
• 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 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. Dec 27, 2016 at 14:04