Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In answering this question: Creating Entry in Bibtex for Executive Orders I gave a biblatex solution which used a new entry type for Executive Orders. This particular entry type has no author, but it's possible (and in fact likely) that in some situations, multiple entries with the same year might be cited in a single document. In this situation, there needs to be some way of deciding the sort order for that entry. In this particular case, it would make the most sense to sort by the Number field.

The entry has the following fields:

@executiveorder{Executive-Order2007,
        Number = {13423},
        Pages = {919},
        Volume = {3},
        Year = {2007}}

So the question is this: how do I add sorting information for odd entries like this that don't have the normal elements that one would sort on?

share|improve this question
    
How about year? –  Harish Kumar Feb 18 '13 at 0:36
    
@Harish The question is intended to be more general than solving this particular instance, but in any case the point is how do you sort all the entries within the same year. –  Alan Munn Feb 18 '13 at 0:38

2 Answers 2

up vote 5 down vote accepted

You should add the number sort in a \sort{} clause of its own:

\sort{
    \field{sortyear}
}
\sort{
    \field{number}
}

Putting them in the same \sort{} clause won't do what you want. You want to sort by sortyear, and then by number. Putting them in the same \sort{} clause will sort by the first field found in the \sort{} clause, so if there is always a year field:

\sort{
    \field{year}
    \field{number}
}

is equivalent to

\sort{
    \field{year}
}

as the \field{number} is never used. In general, entries are sorted in turn by each \sort{} clause and within each clause, the first field found is used by that clause.

On another note, you can define as many sorting schemes as you like and use them seperately in \printbibliography by way of its sorting option (biblatex 2.0+ with biber only). However, it doesn't sound like this is what you need.

share|improve this answer
1  
Thanks, Philip. This works perfectly. Now I also understand the sorting scheme much better. –  Alan Munn Feb 19 '13 at 4:31

biblatex has built in the field presort that according to the manual is

A special field used to modify the sorting order of the bibliography. This field is the first item the sorting routine considers when sorting the bibliography, hence it may be used to arrange the entries in groups.

Then one can extend the sorting schema using year and number; for example a variation of the ynt schema could be:

\DeclareSortingScheme{executiveorder}{
  \sort{
    \field{presort}
  }
  \sort{
    \field{sortkey}
  }
  \sort{
    \field{sortyear}
  }
  \sort{
    \field{number}
  }
  \sort{
     \field{sortname}
     \field{author}
     \field{editor}
  }
  \sort{
    \field{title}
  }
}

EDIT: Modified the schema, putting number in a \sort clause by own.

share|improve this answer
    
Thanks. Some things still aren't clear to me, however. As far as I know that there can only be one sorting scheme per .bbx, so how do I integrate a sorting scheme for this entry type into the larger scheme? I tried adding \field{number} to the apa sorting scheme in the year section at it seemed to have no effect. –  Alan Munn Feb 18 '13 at 2:37
    
@AlanMunn I think you can define several sorting schemes, and then only one is effective (sorting=<SORTINGSCHEMA>). I would copy the apa schema, modify it (adding \field{number} after \field{sortyear}) and insert it in the preamble of a document (untested) –  Guido Feb 18 '13 at 4:11
    
That's what I did, and it didn't seem to work. –  Alan Munn Feb 18 '13 at 4:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.