Sort Bibliography by Reference Type

2»
  • Sorry, @adamsmith. I'm not impressed with all this geekspeak. Nobody should have to create macros to shoehorn Zotero into doing something that the Zotero programming team could do.

    So ItemType isn't a good category to work from as a sort key. Then designate Extra, Rights, or some other "open" category for the user to create their own sort key: Book, Bookchpt, Journal, etc etc. The Zotero team doesn't have to anticipate all the possible bibliography categories that might be used at every university in the world.

    The important thing is for all the entries tagged for Category X to line up in bibliographic order with one another, and all the entries tagged for Category Y, and so on. From there, the user can split the blocks apart, move them around, title them as needed, and everyone will be happy.
  • This is hard to do well, which is why it's not yet implemented in a way that's user friendly. Everyone here realizes that and there is no need for your hostile tone.
    I pointed you here as an alternative to the extremely labor-intensive system - which requires users to modify their data in Zotero in what I find to be a problematic way - you suggested in your other thread.
  • Sure, you can do that. It's pretty much the same sort of interim workaround suggested by adamsmith, with a bit more flexibility, at the cost of extra typing and added clutter to the database that makes it harder to share entries, but it would work for someone in the short term.
  • edited March 19, 2012
    This is hard to do well, which is why it's not yet implemented in a way that's user friendly.
    Exactly. Sorting by types is a poor solution to the real problem, and it takes work to implement that solution well. See my posts above for totally practical reasons why this is the case.
  • Hi Guys,

    I'm looking for a solution to sort my bibliography with different key variables for different types of entries.

    Because there is no particular "type" for legal comments (a special type of literature in German legal science), I decided to use "entry-dictionary" in my style for this entries.

    This worked out quite well so far.

    But problems arise when it comes to bibliography because it's common to list all entries in alphabetical order based on the author's name.
    Only legal comments should be listed in the same bibliography but based on the editor's name.

    I tried the solutions proposed here in different modification but the results wasn't really satisfying. Best what I could get were two lists differentiated according to the type of entries, both ordered based on authors name...

    It would be great if somebody could provide any hints.
    Thanks in advance!
  • you should be able to create a macro sort-key with an if loop along the lines
    <if type="entry-dictionary">
    <names variable="editor">
    <name/>
    </names>
    </if>
    <else>
    <names variable="author">
    <name/>
    </names>
    </if>

    and sort by that.
    Depending on your exact needs and your style you could also call a macro from within the sort macro etc. (I did notice that your style code didn't use any macros at all - you probably need to change that to get this working correctly).
  • That worked out perfectly! I also corrected some minor mistakes in the style and now he is valid and seems to produce good results for my needs. I will test it a few days and then upload it to the repository. Thanks you very much for your support!
  • I am personally not particularly fond of a workaround as explained in the threat above, given that one idea behind Zotero is to alleviate researchers of the burden of manual reference work.

    Are there any plans for the near future to integrate multiple biographies, which can be sorted by source types (or other criteria) as an easy-to-use feature of Zotero?
  • edited March 19, 2014
    generally - yes. Near future - probably no.
  • Just in case it helps to bring this to a further point: I am absolutely interested in this feature as well. That it is missing makes me consider a return to BibTex. ;-)
  • I need a feature like this for Zotero. It was very useful in Endnote because I use a lot of books, journal articles, statutes and newspaper reports and like to have separate sections for statutes and newspaper reports.

    Any ideas when Zotero will include the feature?
  • Thanks all for the long lasting discussion and commitment about this feature.

    In case of a journal article, manual or script workaround could be suitable, but not so much when you write a dissertation (or book) and have many kinds of sources in dozens and dozens of pages. If Zotero would allow to sort by type, that would be fantastic. Otherwise if you have to revise the text (ie. for a second submission) you have to run the workaround again. This partially means to reduce the efficacy of Zotero and bring manual work back.

    I am in need of such function and I hope it will be available soon. Zotero is a great community and we shall get there.

    Thanks!
  • not sure I understand -- Zotero _is_ able to sort by type. It's just not able to sort by other rules that you'd define yourself (e.g. by tags, collections, or so).
  • To clarify: I need to divide the bibliography in sections such as Books, Journal Articles, Book sections, Newspaper Articles, Interviews and so on...

    From the discussion above I understood that this is possible trough scripts and manual editing, but that Zotero does not have a function for that as yet. Did I miss something and such function already exist?
  • what you see above are not scripts. Those are modification of existing citation styles to sort by item type in various ways.
    Since how citations are sorted is part of the citation style, if you want a custom sorting of citations, you do need to modify the citation style you want to use.
    This really isn't terribly hard to do, especially as you have the relevant bits above ready to copy&paste. If you run into specific problems, we're happy to help.
  • edited January 27, 2016
    An example I applied to APA 6th Edition:

    First: Download a new style from Zotero Repository (in my case APA 6th Edition).

    After that: Change the title and ID at the beginning of the downloaded style.

    Then before this line:


    <citation et-al-min="6" et-al-use-first="1" et-al-subsequent-min="3"
    et-al-subsequent-use-first="1" disambiguate-add-year-suffix="true"
    disambiguate-add-names="true" disambiguate-add-givenname="true"
    collapse="year" givenname-disambiguation-rule="primary-name">


    Add:


    <macro name="type-sorting">
    <choose>
    <if type="book bookSection chapter" match="any">
    <text value="1"/>
    </if>
    <else-if type="article-journal" match="any">
    <text value="2"/>
    </else-if>
    <else-if type="article-magazine" match="any">
    <text value="3"/>
    </else-if>
    <else-if type="article-newspaper" match="any">
    <text value="4"/>
    </else-if>
    <else-if type="thesis" match="any">
    <text value="5"/>
    </else-if>
    <else-if type="webpage" match="any">
    <text value="6"/>
    </else-if>
    <else-if type="report" match="any">
    <text value="7"/>
    </else-if>
    <else>
    <text value="8"/>
    </else>
    </choose>

    </macro>


    Then in the bibliography part add this as the first line

    <key macro="type-sorting"/>


    Add it to Zotero from the preference menu.

    It will warn you that it may not work, because is not a CSL 1.01, but it does.

    You MUST RESTART Zotero before changes take place.

    Cheers!!!
  • (you should not overwrite existing styles -- turn this into a new style with different name and ID. Using existing style IDs, your customizations will be overwritten on updates. https://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step )
  • Thanks!!!
    I forgot to mention that I made changes to a downloaded style from the repositories and then changed the Title and ID, to not overwrite the default style.
  • Is there any way with the new updates to sort bibliography according to tags? like you know primary literature and secondary literature?
  • Dears,
    I did the modification stated by AlpyBoy and it worked well. Now I just need to add the section name before each section, for example the word " Books: " before the cited books, and " Journals " before the Journal articles,...etc.

    Anyone can help with that?
  • That's not possible, sorry. I just do that at the end when I'm finished.
  • Hi,
    I'm trying to use a macro in a custom style (not yet in the repository) to generate a bibliogrphy ordered by types. My code is as follows:

    <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>
    >>>
    and
    <<<
    <sort>
    <key macro="sort-key"/>
    <key variable="issued" sort="ascending"/>
    <key variable="author"/>
    <key variable="title"/>
    </sort>


    It doesn't work. The style is valid. Could you help me?
    Thanks a lot
  • We'd want to see the whole style (post to pastebin.com or similar) the above should work in principle
  • Didn't look at your code, but from what I remember you need to give a text value by letter, not number. Then it sorts correctly.
  • No, numbers work just fine, as does this style. Using the test data from the visual CSL editor I get ( minus formatting and with section headings added.):

    Books and Chapter
    Borges 1999
    J. L. Borges, Selected non-fictions, Viking, New York, 3e éd., 1999, 559 p. [ISBN 0-670-84947-2].
    Mares 2001
    I. Mares, « Firms and the welfare state: When, why, and how does social policy matter to employers? », in P. A. Hall, D. Soskice (éd.), Varieties of capitalism. The institutional foundations of comparative advantage, Oxford University Press, New York, 2001, p. 184‑213.
    Hancké, Rhodes, Thatcher 2007
    B. Hancké, M. Rhodes, M. Thatcher (dir.), Beyond varieties of capitalism : Conflict, contradiction, and complementarities in the European economy, Oxford University Press, Oxford and New York, 2007, 200 p. [ISBN 978-0-19-920648-3].
    Dunnett, Kingsbury 2008
    N. Dunnett, N. Kingsbury, Planting green roofs and living walls, Timber Press, Portland, OR, 2e éd., 2008, 328 p. [ISBN 0-88192-911-5].
    McInnis, Nelson 2011
    M. D. McInnis, L. P. Nelson, Shaping the body politic: Art and political formation in early america, University of Virginia Press, Charlottesville, VA, 2011, 313 p. [ISBN 0-8139-3102-9].
    Isaacson 2011
    W. Isaacson, Steve Jobs, Simon & Schuster, New York, NY, 2011, 630 p. [ISBN 978-1-4516-4853-9].

    Journal and Magazine articles
    Einstein 1905
    A. Einstein, « On the electrodynamics of moving bodies », Ann. Phys., 17, 4, 1905, p. 1‑26.
    Watson, Crick 1953
    J. D. Watson, F. H. C. Crick, « Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid », Nature, 171, 4356, 1953, p. 737‑738.
    Campbell, Pedersen 2007
    J. L. Campbell, O. K. Pedersen, « The varieties of capitalism and hybrid success », Comp. Polit. Stud., 40, 3, 2007, p. 307‑332.
    Accadia et al. 2012
    T. Accadia, F. Acernese, M. Alshourbagy, P. Amico, F. Antonucci, S. Aoudia, N. Arnaud, C. Arnault, K. G. Arun, P. Astone, S Avino, D. Babusci, G. Ballardin, F. Barone, G. Barrand, L. Barsotti, M. Barsuglia, A. Basti, T. S. Bauer, F. Beauville, M. Bebronne, M. Bejger, M. G. Beker, F. Bellachia, A. Belletoile, J. L. Beney, M. Bernardini, S. Bigotta, R. Bilhaut, S. Birindelli, M. Bitossi, M. A. Bizouard, M. Blom, C. Boccara, D. Boget, F. Bondu, L. Bonelli, R. Bonnand, V. Boschi, L. Bosi, T. Bouedo, B. Bouhou, A. Bozzi, L. Bracci, S. Braccini, C. Bradaschia, M. Branchesi, T. Briant, A. Brillet, V. Brisson, L. Brocco, T. Bulik, H. J. Bulten, D. Buskulic, C. Buy, G. Cagnoli, G. Calamai, E. Calloni, E. Campagna, B. Canuel, F. Carbognani, L. Carbone, F. Cavalier, R. Cavalieri, R. Cecchi, G. Cella, E. Cesarini, E. Chassande-Mottin, S. Chatterji, R. Chiche, A. Chincarini, A. Chiummo, N. Christensen, A. C. Clapson, F. Cleva, E. Coccia, P.-F. Cohadon, C. N. Colacino, J. Colas, A. Colla, M. Colombini, G. Conforto, A. Corsi, S. Cortese, F. Cottone, J.-P. Coulon, E. Cuoco, S. D’Antonio, G. Daguin, A. Dari, V. Dattilo, P. Y. David, M. Davier, R. Day, G. Debreczeni, G. D. Carolis, M. Dehamme, R. D. Fabbro, W. D. Pozzo, M. del Prete, L. Derome, R. D. Rosa, R. DeSalvo, M. Dialinas, L. D. Fiore, A. D. Lieto, M. D. P. Emilio, A. D. Virgilio, A. Dietz, M. Doets, P. Dominici, A. Dominjon, M. Drago, C. Drezen, B. Dujardin, B. Dulach, C. Eder, A. Eleuteri, D. Enard, M. Evans, L. Fabbroni, V. Fafone, H. Fang, I. Ferrante, F. Fidecaro, I. Fiori, R. Flaminio, D. Forest, L. A. Forte, J.-D. Fournier, L. Fournier, J. Franc, O. Francois, S. Frasca, F. Frasconi, A. Freise, A. Gaddi, M. Galimberti, L. Gammaitoni, P. Ganau, C. Garnier, F. Garufi, M. E. Gáspár, G. Gemme, E. Genin, A. Gennai, G. Gennaro, L. Giacobone, A. Giazotto, G. Giordano, L. Giordano, C. Girard, R. Gouaty, A. Grado, M. Granata, V. Granata, X. Grave, C. Greverie, H. Groenstege, G. M. Guidi, S. Hamdani, J.-F. Hayau, S. Hebri, A. Heidmann, H. Heitmann, P. Hello, G. Hemming, E. Hennes, R. Hermel, P. Heusse, L. Holloway, D. Huet, M. Iannarelli, P. Jaranowski, D. Jehanno, L. Journet, S. Karkar, T. Ketel, H. Voet, J. Kovalik, I. Kowalska, S. Kreckelbergh, A. Krolak, J. C. Lacotte, B. Lagrange, P. L. Penna, M. Laval, J. C. L. Marec, N. Leroy, N. Letendre, T. G. F. Li, B. Lieunard, N. Liguori, O. Lodygensky, B. Lopez, M. Lorenzini, V. Loriette, G. Losurdo, M. Loupias, J. M. Mackowski, T. Maiani, E. Majorana, C. Magazzù, I. Maksimovic, V. Malvezzi, N. Man, S. Mancini, B. Mansoux, M. Mantovani, F. Marchesoni, F. Marion, P. Marin, J. Marque, F. Martelli, A. Masserot, L. Massonnet, G. Matone, L. Matone, M. Mazzoni, F. Menzinger, C. Michel, L. Milano, Y. Minenkov, S. Mitra, M. Mohan, J.-L. Montorio, R. Morand, F. Moreau, J. Moreau, N. Morgado, A. Morgia, S. Mosca, V. Moscatelli, B. Mours, P. Mugnier, F.-A. Mul, L. Naticchioni, I. Neri, F. Nocera, E. Pacaud, G. Pagliaroli, A. Pai, L. Palladino, C. Palomba, F. Paoletti, R. Paoletti, A. Paoli, S. Pardi, G. Parguez, M. Parisi, A. Pasqualetti, R. Passaquieti, D. Passuello, M. Perciballi, B. Perniola, G. Persichetti, S. Petit, M. Pichot, F. Piergiovanni, M. Pietka, R. Pignard, L. Pinard, R. Poggiani, P. Popolizio, T. Pradier, M. Prato, G. A. Prodi, M. Punturo, P. Puppo, K. Qipiani, O. Rabaste, D. S. Rabeling, I. Rácz, F. Raffaelli, P. Rapagnani, S. Rapisarda, V. Re, A. Reboux, T. Regimbau, V. Reita, A. Remilleux, F. Ricci, I. Ricciardi, F. Richard, M. Ripepe, F. Robinet, A. Rocchi, L. Rolland, R. Romano, D. Rosińska, P. Roudier, P. Ruggi, G. Russo, L. Salconi, V. Sannibale, B. Sassolas, D. Sentenac, S. Solimeno, R. Sottile, L. Sperandio, R. Stanga, R. Sturani, B. Swinkels, M. Tacca, R. Taddei, L. Taffarello, M. Tarallo, S. Tissot, A. Toncelli, M. Tonelli, O. Torre, E. Tournefier, F. Travasso, C. Tremola, E. Turri, G. Vajente, J. F. J. van den Brand, C. V. D. Broeck, S. van der Putten, M. Vasuth, M. Vavoulidis, G. Vedovato, D. Verkindt, F. Vetrano, O. Véziant, A. Viceré, J.-Y. Vinet, S. Vilalte, S. Vitale, H. Vocca, R. L. Ward, M. Was, K. Yamamoto, M. Yvert, J.-P. Zendri, Z. Zhang, « Virgo: a laser interferometer to detect gravitational waves », J. Instrum., 7, 03, 2012, p. P03012‑P03012.
    Fenner et al. 2019
    M. Fenner, M. Crosas, J. S. Grethe, D. Kennedy, H. Hermjakob, P. Rocca-Serra, G. Durand, R. Berjon, S. Karcher, M. Martone, T. Clark, « A data citation roadmap for scholarly data repositories », , 6, 1, 2019, p. 28.

    Everything else
    Hawking 1966
    S. Hawking, Properties of expanding universes, Doctoral thesis, University of Cambridge, Cambridge, UK, 1966,
    Ahlquist, Breunig 2009
    J. S. Ahlquist, C. Breunig, Country clustering in comparative political economy, MPIfG Discussion Paper, Max-Planck Institute for the Study of Societies, 2009,
    Van Dan Elzen 2011
    H. Van Dan Elzen, Yo-yo having a modifiable string gap,
    2012
    « CSL search by example », Citation Style Editor, mis en ligne en 2012, , http://editor.citationstyles.org/searchByExample/ [consulté le 15 décembre 2012].
    Foderaro 2012
    L. W. Foderaro, « Rooftop greenhouse will boost city farming », New York Times, 06/04/2012, p. A20.
    Zelle, Shaw, Dijken 2016
    R. M. Zelle, A. J. Shaw IV, J. P. van Dijken, Method for acetate consumption during ethanolic fermentation of cellulosic feedstocks,
Sign In or Register to comment.