2

I have a set number of references. (This would be the standard output)

  • Doe, Jane and Aart, Steve, 2010a
  • Doe, Jane and Bart, Mark, 2004
  • Doe, Jane and Smith, Mike, 2010b

And I need to sort them only by first author and then year, so they appear:

  • Doe, Jane and Bart, Mark, 2004
  • Doe, Jane and Aart, Steve, 2010a
  • Doe, Jane and Smith, Mike, 2010b
5

With

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \step[fieldsource=author, match=\regexp{(.+?)\s+and\s+(.+)}, final]
      \step[fieldset=sortname, fieldvalue={$1}]
    }
  }
}

you can populate the sortname field with only the very first name in author list. The the name bit of the sorting will really only rely on the first person in that list.

The MWE

\documentclass{article}
\usepackage[style=numeric,
            backend=biber,
            ]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{Doe10a,
  author = {Jane Doe and Steve Aart},
  year   = {2010}
}
@book{Doe04,
  author = {Jane Doe and Mark Bart},
  year   = {2004},
}
@book{Doe10b,
  author = {Jane Doe and Mike Smith},
  year   = {2010}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\DeclareNameAlias{default}{family-given}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \step[fieldsource=author, match=\regexp{(.+?)\s+and\s+(.+)}, final]
      \step[fieldset=sortname, fieldvalue={$1}]
    }
  }
}

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

gives

[1] Doe, Jane and Bart, Mark. 2004.

[2] Doe, Jane and Aart, Steve. 2010.

[3] Doe, Jane and Smith, Mike. 2010.

3

Sorting options are described in section 3.5 of the biblatex manual, with appropriate cross-referencing to the entry fields described in section 2.2 that are used to create entries in the bib resource file.

From the manual it can quickly be discovered that there are at least two ways to give you what you want.

The first, and the most obvious, option is to use a presort field (p27). Using presort permits intimate ordering of the bibliography by listing the items in the order you want them to appear. The second option is to use the sortname field. It overrides the default use of the author or editor (p27), which here, is the list of the names of two authors, not just the first name.

Both solutions are provided in this MWE.

\documentclass[a4paper,10pt]{article}
\usepackage{filecontents}
\usepackage[style=numeric,
            backend=biber,
            ]{biblatex}

\addbibresource{refs.bib}
\DeclareNameAlias{default}{last-first}

% Option 1 using sortname which overrides author as the primary sort field
%\begin{filecontents*}{refs.bib}
%    @article{Doe10a,
%        author={Jane Doe and Steve Aart},
%        sortname={Jane Doe},
%        year={2010}
%    }
%    @article{Doe04,
%        author={Jane Doe and Mark Bart},
%        sortname={Jane Doe},
%        year={2004},
%    }
%    @article{Doe10b,
%    author={Jane Doe and Mike Smith},
%    sortname={Jane Doe},
%    year={2010}
%}
%\end{filecontents*}

% Option 2: Uses presort so the bibliography is printed in a given order, here: A, B, C
\begin{filecontents*}{refs.bib}
    @article{Doe10a,
        author={Jane Doe and Steve Aart},
        presort={B},
        year={2010}
    }
    @article{Doe04,
        author={Jane Doe and Mark Bart},
        presort={A},
        year={2004},
    }
    @article{Doe10b,
        author={Jane Doe and Mike Smith},
        presort={C},
        year={2010}
    }
\end{filecontents*}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

enter image description here

In future questions, please post a MWE showing what you have attempted. It makes it much easier for people to help you.

2
  • 4
    By the way, you could eliminate all manual intervention in the data by using \DeclareSourcemap to automatically populate the sortname field with the first name.
    – PLK
    Oct 18 '16 at 10:57
  • @PLK Thank you for the suggestion and all your work on biblatex.
    – Ross
    Oct 18 '16 at 12:17

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.