plk / biber

Backend processor for BibLaTeX
Artistic License 2.0
336 stars 38 forks source link

Sorting in tool mode #222

Closed moewew closed 6 years ago

moewew commented 6 years ago
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <sorting scheme="year">
    <sort order="1">
      <sortitem order="1">year</sortitem>
    </sort>
  </sorting>
</config>

does not sort

@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of methods for deriving atomic charges from the
                  electrostatic potential and moments},
  journaltitle = {Journal of Computational Chemistry},
  date         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}

@book{baez/article,
  author       = {Baez, John C. and Lauda, Aaron D.},
  title        = {Higher-Dimensional Algebra {V}: 2-Groups},
  journaltitle = {Theory and Applications of Categories},
  date         = 2004,
  volume       = 12,
  pages        = {423-491},
  version      = 3,
  eprint       = {math/0307200v3},
  eprinttype   = {arxiv},
}

@article{angenendt,
  author       = {Angenendt, Arnold},
  title        = {In Honore Salvatoris~-- Vom Sinn und Unsinn der
                  Patrozinienkunde},
  journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
  date         = 2002,
  volume       = 97,
  pages        = {431--456, 791--823},
}

with biber --tool as expected. as expected (sigfridsson > angenendt > baez/article) for me. Instead the order stays as is.

The example .conf file follows the example in the documentation. This may have to do with the name changes scheme -> template. But no amount of guessing was enough to get things going. I think

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <sortingtemplate name="year">
    <sort order="1">
      <sortitem order="1">year</sortitem>
    </sort>
  </sortingtemplate>
</config>

might be a step in the right direction. But it's not enough ...

moewew commented 6 years ago

Aha! Turns out I was almost there. It's just important that tool is the template name.

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <sortingtemplate name="tool">
    <sort order="1">
      <sortitem order="1">entrytype</sortitem>
    </sort>
    <sort order="2">
      <sortitem order="1">entrykey</sortitem>
    </sort>
  </sortingtemplate>
</config>

works. That is actually documented.

plk commented 6 years ago

Docs are fixed. It's not so simple to automate the template name as a config file could be used for tool mode and non tool mode and could have several templates to select from etc.

moewew commented 6 years ago

I see, that makes sense. Thank you.