# Undefined control sequence “\DeclareSortingNamekeyScheme” Biber

I tried using the solution here https://tex.stackexchange.com/a/373581/100078 with XeLaTeX. It always gives the error Undefined control sequence "\DeclareSortingNamekeyScheme".

This is the code i'm trying to compile:

\documentclass{article}

\usepackage[backend=biber, style=authoryear]{biblatex}

\DeclareSortingNamekeyScheme{
\keypart{
\namepart{given}
}
\keypart{
\namepart{prefix}
}
\keypart{
\namepart{family}
}
\keypart{
\namepart{suffix}
}
}

\DeclareNameAlias{sortname}{default}

\begin{document}
\cite{sigfridsson,worman,geer,cicero,nussbaum,knuth:ct:a}
\printbibliography
\end{document}


This seems to be taken straight out of the docs and it still does not work.

I have given up on trying to find the solution to fix this. Any help, please?

P.S. I want to sort the authors by their first name, then last name. I tried another method (in place of default), but even this does not produce the effect.

\DeclareNameAlias{sortname}{first-last}


P.S. Doesn't matter what the references are. Biber compiles (if XeLaTeX produces its .bcf file).

The error log corresponding to the error:

(/usr/share/texlive/texmf-dist/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg
)))
! Undefined control sequence.
l.5 \DeclareSortingNamekeyScheme
{
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.6   \keypart
{
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.7     \namepart
{given}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

• Please add a compilable code to your question (not only a link) and show the complete error message (copy it from the log file) ... – Mensch Oct 18 '17 at 14:36
• Your texsystem (and so your biblatex) is probably to old for this command. – Ulrike Fischer Oct 18 '17 at 14:55
• Please correct \documentclassarticle} to \documentclass{article}. Add before the line \listfiles, compile 3 times and check the log file. At the end you find a list of used packages and version numbers. Please add this list to your question! BTW: With a current MiKTeX I can compile your MWE without errors! – Mensch Oct 18 '17 at 16:06
• \DeclareSortingNamekeyScheme was introduced in version 3.3 (released 2016-03-01), so probably your biblatex version is too old. The current version is 3.7. When you update to 3.3 or newer read Biblatex 3.3 name formatting. – moewe Oct 19 '17 at 8:44
• In that case it is indeed easiest to put the names in braces. That makes sure it is never split into its given and family part. With the code from the other answer you will only change the sorting, for other purposes the name is still split. The radical solution is to tell Biber/BibTeX that the name consists of only one part by wrapping it in braces. (That will also mean less code to set these things up for you.) – moewe Oct 22 '17 at 14:10

\DeclareSortingNamekeyScheme was introduced in version 3.3 and renamed in 3.8 to \DeclareSortingNamekeyTemplate. You are running an older version of biblatex that defines neither of the two commands. In order to use this command you will have to update your biblatex and Biber versions.
author = {{Anne Elk} and {Elizabeth Ditor}},

Will always come out the same even with the standard settings, you don't even need to change the sortname format or \DeclareSortingNamekeyScheme.
Since the name parsing and splitting is done by the backend, there is no biblatex` solution to treat a name as atomic if it wasn't input as atomic. We can only try to manipulate everything so that it looks as though the name is never split, but that is much more work than just putting the name in curly brackets.