biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

About the sorting order when multiple keys with @set keys are passed to citation cmd

Open hushidong opened this issue 7 years ago • 5 comments

For numeric style, when option sorting is set to none, the mutilple entries passed to citation cmd are usually listed with the citekeys' sequence. but if there are keys of @set, the sequence will be different, see the following example, Is there any masure can be used to keep the original sequence?

EG:

    \documentclass[twoside]{article}
    \usepackage{xcolor}
    \usepackage{hyperref}
    \usepackage[backend=biber,style=numeric,sorting=none,defernumbers=true]{biblatex}
    \usepackage{filecontents}
    \begin{filecontents}{\jobname.bib}
    @Book{Yi2014--,
      Title                    = {Test},
      Address                  = {Address},
      Author                   = {Yi and B and C},
      Publisher                = {Publisher},
      Year                     = {2014}
    }
    @Book{Yi2013--,
      Title                    = {Supersonic and hypersonic nozzle design},
      Address                  = {BeiJing},
      Author                   = {Yi, S H and Zhao, Y X and He, L and Zhang, M L},
      Publisher                = {National Defense Industry Press},
      Year                     = {2013}
    }
    @Book{Li2014--,
      Title                    = {Test},
      Address                  = {Address},
      Author                   = {Li and B and C},
      Publisher                = {Publisher},
      Year                     = {2014}
    }
    @Book{Li2013--,
      Title                    = {Supersonic and hypersonic nozzle design},
      Address                  = {BeiJing},
      Author                   = {Li, S H and Zhao, Y X and He, L and Zhang, M L},
      Publisher                = {National Defense Industry Press},
      Year                     = {2013}
    }
    @Book{Xi2013--,
      Title                    = {Supersonic and hypersonic nozzle design},
      Address                  = {BeiJing},
      Author                   = {Xi, S H and Zhao, Y X and He, L and Zhang, M L},
      Publisher                = {National Defense Industry Press},
      Year                     = {2013}
    }
    @Book{Mi2013--,
      Title                    = {Supersonic and hypersonic nozzle design},
      Address                  = {BeiJing},
      Author                   = {Mi, S H and Zhao, Y X and He, L and Zhang, M L},
      Publisher                = {National Defense Industry Press},
      Year                     = {2013}
    }
    \end{filecontents}
    \addbibresource{\jobname.bib}

    \begin{document}
    \section{multiple keys with set}
    \begin{refsection}
    \defbibentryset{biyi2013}{Yi2014--,Yi2013--}
    \defbibentryset{bili2013}{Li2014--,Li2013--}
    references\cite{Xi2013--,biyi2013,bili2013,Mi2013--}
    \printbibliography
    \end{refsection}

    \section{multiple keys without set}
    \begin{refsection}
    references\cite{Xi2013--,Yi2014--,Li2014--,Mi2013--}
    \printbibliography
    \end{refsection}
    \end{document} 

result:

default

hushidong avatar Feb 07 '18 12:02 hushidong

@PLK Could this be a Biber issue? The .bcf look similar enough

  <bcf:section number="1">
    <bcf:citekey type="set" members="Yi2014--,Yi2013--">biyi2013</bcf:citekey>
    <bcf:citekey type="set" members="Li2014--,Li2013--">bili2013</bcf:citekey>
    <bcf:citekey order="1">Xi2013--</bcf:citekey>
    <bcf:citekey order="1">biyi2013</bcf:citekey>
    <bcf:citekey order="1">bili2013</bcf:citekey>
    <bcf:citekey order="1">Mi2013--</bcf:citekey>
  </bcf:section>
  <!-- SECTION 0 (cont.) -->
  <bcf:section number="0">
  </bcf:section>
  <!-- SECTION 2 -->
  <bcf:bibdata section="2">
    <bcf:datasource type="file" datatype="bibtex">sortodrdenone.bib</bcf:datasource>
  </bcf:bibdata>
  <bcf:section number="2">
    <bcf:citekey order="1">Xi2013--</bcf:citekey>
    <bcf:citekey order="1">Yi2014--</bcf:citekey>
    <bcf:citekey order="1">Li2014--</bcf:citekey>
    <bcf:citekey order="1">Mi2013--</bcf:citekey>
  </bcf:section>

The only difference is the set definition.

moewew avatar Feb 08 '18 15:02 moewew

It might be considered a bug I think. Dynamic sets are treated as citation keys which explains this ordering. Looking into it.

plk avatar Feb 08 '18 18:02 plk

Hmm, the doc says "\defbibentryset implies the equivalent of a \nocite command, i. e., all sets which are declared are also added to the bibliography." This makes:

\defbibentryset{biyi2013}{Yi2014--,Yi2013--}
\defbibentryset{bili2013}{Li2014--,Li2013--}
\cite{Xi2013--,biyi2013,bili2013,Mi2013--}

equivalent to:

\cite{Yi2014--,Li2014--,Xi2013--,Mi2013--}

The problem is manifest due to sorting=none really because this means that the sets are considered first because they are effectively \nocited first. Because the sets are only defined in the first refsection, they appear in the .bbl sorting list in citation order.

plk avatar Feb 08 '18 18:02 plk

Ah right, I had forgotten about that, sorry.

I guess it is documented behaviour then. It is a bit undesirable in this case, but it has been this way for quite some time I assume.

moewew avatar Feb 08 '18 19:02 moewew

It's a rather esoteric issue, sortcites=true changes it and so does any other sorting than sorting=none.

plk avatar Feb 08 '18 19:02 plk