Wrong sorting in Bibliography

Feb 19, 2010 at 6:08 PM

I get the following sorted bibliography:


Derrida, Jacques, ...

Žižek Slavoj, ...

Fink Bruce, ...


Note, that Z is after D and before F


Butler, Judith, ...

de Saussure, Ferdinand, ...

Deleuze, Gilles, ...


Note that S (Saussure) is after B and before D


Is there a work around or a possiblity to fix this problem in the next release?


Best regards, A.

Feb 19, 2010 at 6:46 PM

I tested your first example, but it was sorted correctly in the few styles I tried (Harvard Anglia, Harvard Exeter, ABNT, ASA) so I can't reproduce the issue.

There is indeed the possibility of sorting going wrong in case you mix international alphabets but there is not much you can do about it. Some things just can't be compared.

Regarding your second example. The sorting will always happen on the first letter of the last name. BibWord nor the styles that come with Word are currently capable of sorting on the second part. There is no workaround available.

This feature already exists in BibWord for titles, so I don't think it would cause major redesign to introduce it for names. However, I do not plan on creating a new version in the next few months so don't expect anything. If you are interested in trying it yourself, the code for titles is incorporated in the format-title template.

Feb 19, 2010 at 7:20 PM

Your fast replies are amazing! Just awesome.


The first issue didn't appear with finished styles (I tried and compared) but with the framework (bibword tool for developers). Maybe you can give me a hint of how to fix this problem.

The second issue: It would be fantastic if you could incorporate this feature in a future release as this »problem« is probably useful for many people. Meanwhile I will try to figure it out myself for my own style based on your excellent framework. As soon as I have finished this style I will send it to you as it might be very useful for German and Austrian writers (philosophy, social studies, cultural studies, etc.). There are still a few details that need to be fixed.


Cheers, A.

Feb 19, 2010 at 9:49 PM
Edited Feb 19, 2010 at 9:51 PM

That is most likely because you didn't define a sortkey. There isn't one in the example that is in the template as no sortkey means the citations are just ordered according to in-text appearance.

A sortkey is a format string just like a display string and should be under source:

<source type="ArticleInAPeriodical">
  <column id="1">
    <format>{%Author:2%.}{ %Year|"n.d."%{%YearSuffix%}.}{ “%Title%.”}{ &lt;i&gt;%PeriodicalTitle%&lt;/i&gt.}</format>
  <sortkey>{%Author:0|Title:a%}{ %Year%}{ %Title:a%}</sortkey>

If the above example isn't clear enough, just check out one of the Harvard styles or ASA. They are all sorted alphabetically. Just look for sortkey. For example sortkey values, see here.

Note that ':a' at the end of the title in the above sortkey example is what I was talking about in my previous post. It ensures that if you sort based on title, the articles 'A', 'An', and 'The' are moved to the end of the title. For example 'The Scientific Method' becomes 'Scientific Method, The'.

Thinking a bit more about this, the best approach would be to use the create-sortkey template to realise the alternative name sorting. Currently this template takes a source as input and processes it directly. What you could do is first create a copy by going over each non-name element and if you come across names you could change them by moving the 'articles' to the end. You could then use that generated source in the rest of the template function. This idea is similar to what happens in the format-bibliography template where a copy of a source is made with an extra sortkey element added.

Feb 20, 2010 at 9:27 AM



I had already used the sortkey functionality. This name also gets ordered wrong with ASA. Is there a String or something that provides the order of the characters such as aäbcdefghijklmnoöpqrstuüvwxyzž?

For the second problem, (A-AN-THE) your hint was very helpful

Regards, A.

Feb 20, 2010 at 10:56 AM

The sorting is done by MSXSL internal sorting mechanism, there is nothing you can do about the order of the characters.

But I can't reproduce a wrong ordering with ASA so I'm not sure what is happening on your end. Just to check, open the source manager, and choose "Sort by Author" from the dropdown box at the top right. Are the names sorted correctly in that case?

You can try mailing me a document containing the sources and a stylesheet. I will take a look at them, but as I currently can't reproduce the error with ASA, there probably won't be much I can do.

Feb 20, 2010 at 2:01 PM

Dear Yves,

ok, maybe that's the problem. With Word 2008 (Macintosh) there is no dropdown box; no way to choose a sorting method. I checked on the Microsoft Website and found a screenshot that shows the dropdown box in the Windows version. It's crazy, they left out this important feature in the Mac version. So there is probably no work around for the Mac version or is there a possiblity to give a »sorting hint« within the stylesheet?

Version: Word 2008 12.2.3

Thank you very much for your help!


Cheers, A.

Feb 20, 2010 at 3:16 PM

I downloaded the Word 2010 Windows trial; it works fine; I saved the file and opened it in Word 2008 (Mac) and again the same problem. Guess it is one of the many many mistakes in the Mac-version ...

Feb 20, 2010 at 5:55 PM

Sounds indeed as something wrong in Word 2008. I don't have a Mac around but I do have some of the original stylesheets from the days I made BibWord platform independent. I checked them and the sorting is done in a similar way as BibWord does it. So this makes me wondering, does this mean that if you format your bibliography according to Chicago in Word 2008 (predefined style) it doesn't get sorted either?

Feb 21, 2010 at 5:34 AM

Unfortunately yes, same problem. Seems they implemented a different sorting algorithm. The question would be if there is a possibility to give the system a clue on what basis it should sort (in case the code is done the same way as the windows version)...


Feb 21, 2010 at 9:14 PM

The best solution I can think of is implementing sorting yourself in xslt. But that would be a major pain.

An alternative could be to generate the bibliography outside Word, using another XSLT processor. This is basically what the extender program does. You would then have to (manually) copy the bibliography html into place.

Feb 22, 2010 at 11:40 AM

I've been thinking about it some more. If common sorting (A-Z) works, you might want to extend on that by replacing unwanted characters by their wanted replacements.

In a previous post, I wrote about the create-sortkey template where you could move part of the name of the contributor out of the way (van, von, de, ...). In the same step, you could replace ö with o, ž with z, ... A simple translate function could do that for you.

Mar 25, 2012 at 3:40 AM
Edited Mar 25, 2012 at 4:34 AM

Regarding the name prefix thing, the type of solution Yves is suggesting seems to be that the algorithm would put the prefixes at the end, then sort. Wouldn't that mean that they would still be at the end in the final product? So not "von Fintel, Kai" but "Fintel, Kai von"? Apparently that particular German hates that.

I found a simple workaround though, for this problem at least: put the prefix in some other field you never use, like "Station", and list the author as if it had no prefix. Then, in the bibliography format, put {%Station% } before the author for ever field type. Word ignores the prefix, alphabetizing based on the last name of the author.

Of course, this means that such an author should only be listed this way when he or she is the author that will be alphabetized; non-first authors or editors should be listed with the prefix as part of the word, but that's ok, since the author is listed separately for every source anyway.

I don't suppose this has any bearing on the non-English letter issue though.

It also wouldn't allow you to automatically switch between this style and the (wrong) style where the name is listed as "von Fintel, Kai" and sorted by the "v", though it does allow you to create a style where the name is listed as "Fintel, Kai von", by just switching where "station" goes. That shouldn't be a problem, but I remember seeing a journal that actually advized the former.

I'm wrong. You can. You can simply put {%Station} as the first member of the sortkey for that sort of style.