A mini guide to Sort Bibliography by Reference Type
I have been trying to follow the post in which it is explained how to modify a code to sort the bibliography by reference type for days, but I have not been able to come out with any result.
http://forums.zotero.org/discussion/16531/sort-bibliography-by-reference-type/
What I need is to sort my bibliography based on Chicago manual of style (full note) by reference type. Thus, Is there some one that might write a step-by-step mini guide to to do that.
I have modified a couple of time my style, and so, although I am not quite a beginner in that, I ask to be as much clear as possible.
Thank you.
http://forums.zotero.org/discussion/16531/sort-bibliography-by-reference-type/
What I need is to sort my bibliography based on Chicago manual of style (full note) by reference type. Thus, Is there some one that might write a step-by-step mini guide to to do that.
I have modified a couple of time my style, and so, although I am not quite a beginner in that, I ask to be as much clear as possible.
Thank you.
http://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step
We first start by writing a sort macro.
Let's put this right above this line:
<citation et-al-min="4" et-al-use-first="1" disambiguate-add-names="true">
The basic form of this macro is this:
<macro name="sort-key">
<choose>
<if type="book chapter" match="any">
<text value="1"/>
</if>
<else-if type="article-journal article-magazine" match="any">
<text value="2"/>
</else-if>
<else>
<text value="3"/>
</else>
</choose>
</macro>
You can find a list of all the csl item types and how they map to Zotero item types here: aurimasv.github.io/z2csl/typeMap.xml and can use that to make as many sort distinction as you want. The macro assigns a number to every group of item types and you can then just sort by it.
Once you're done, find the sort section for the bibliography. It currently looks like this:
<sort>
<key macro="contributors-sort"/>
<key variable="title"/>
<key variable="genre"/>
<key variable="issued"/>
</sort>
and add
<key macro="sort-key"/>
as the first line, ie.d.<sort>
<key macro="sort-key"/>
<key macro="contributors-sort"/>
<key variable="title"/>
<key variable="genre"/>
<key variable="issued"/>
</sort>
I believe this will sort from 1 to 3 (or whatever the highest number is). You can reverse the sort order by adding sort="ascending" into the sort key, as in:
<key macro="sort-key" sort="ascending"/>
Any problems let me know.
Thanks a lot!
Thanks! Amanda
Let me know if you run into problems, feel free to e-mail me as needed.
For example, say you are referencing a thesis with a historic topic. Newspapers, books, etc, from the time (say, 1800-1900) are likely to be archival Primary Sources, whereas modern newspaper articles would be Secondary Sources.
Is there any way to adjust the sort-key macro to take date into account?
I think I might not be able to do this with Zotero then. Originally I was expecting that if it's possible to add something like a code that will make Zotero to ask me whether the source to be inserted into the bibliography is a primary source or secondary source. But you seem to be saying that at the first place there must be a way to distinguish the type of the source, which I don't think there is.
Take what I am doing now for example. Almost every item I use is either a book or a journal article. But then, say, if this book is John Milton's _Paradise Lost_, one of the most magisterial works ever of English literature, then it is definitely to be categorized as a primary source; and if it is a journal article or another book discussing _Paradise Lost_, then it is a secondary source. However, with my understanding of your question, I don't think I can do this in Zotero, right?
I would like to do the same thing that swhuang was wanting also "primary" and "secondary" in bibliography.
I am trying to get a biography that separates those documents and I cannot manage to do it, though I see that cases and statutes do appear separated from books journals and reports.
Thank you!
https://forums.zotero.org/discussion/comment/127355/#Comment_127355
Oscola already has some of this logic built in, that means you only have to adapt the sort-key macro to what you want.
Keyword: Category
I've entered keyword: primary and keyword: secondary into the Extra field and then
got a sort macro doing this, but with it called first for my bibliography, I'm not getting the sort order I want. Any ideas?
<macro name="sort-key">
<choose>
<if keyword="primary">
<text value="1"/>
</if>
<else-if keyword="secondary">
<text value="2"/>
</else-if>
<else>
<text value="3"/>
</else>
</choose>
</macro>
In the "Extra" field install a new item type: "type: PERSINTERVIEW"
then in Adam Smiths code replace the type in the sort macro with type="PERSINTERVIEW" (or whatever you name it).
That way I was able to distinguish between general bibliography, interviews which I have done, and archival records