3

I am relatively new with Pandoc and I am trying to generate an HTML file with my publications to put up on my website. I'd like to have the publication list numbered and organized by year first, with the most recent first and the oldest last.

I can get the numbering fine with the proper csl file, but I can't get the year sorting. The problem is that I'm not first author in all my publications, so what ends up happening is that they are organized alphabetically first and then by date, which is not what I want.

I can get the result I want when generating a PDF by using biblatex with the option sorting=ydnt (Year (Descending), Name, Title), but since Pandoc doesn't use biblatex to generate a list of references to HTML, I can't use this tactic here.

The only way I can see how to possibly solving this is to get a citation style in the Zotero style repo that does what I want, but I haven't been able to find one. So I'm trying to modify one to do it, but without success.

This answer teaches a way to change the sorting style, so I'm trying to manually change the sorting style of the Proceedings of the Royal Society B style. Specifically I'm changing

    <sort>
      <key variable="citation-number"/>
    </sort>

to

    <sort>
      <key macro="issued" sort="descending"/>
      <key macro="author"/>
    </sort>

But that doesn't work (probably because that only changes the sorting of the text citations, not the reference list). I've tried a couple of other things, but I can't find something that works!

This doesn't matter much I guess, but I'm using Pandoc 2.7.3, citeproc version 0.16.2 and the file that I'm running on is:

---
bibliography: selectedpubs.bib
nocite: '@*'
linestretch: 1.5
fontsize: 12pt
output:
  html:
    output: pubpage.html
    filter: pandoc-citeproc
    csl: prsb2.csl
...

The file prsb2.csl is just the Proceedings of the Royal Society B csl.

TomCho
  • 3,204
  • 6
  • 32
  • 83
  • You should probably post the `prsb2.csl` file? – mb21 Nov 17 '19 at 08:43
  • @mb21 I mean, not sure if it makes much difference because nothing I tried caused any difference in the output. But I included the information anyway, – TomCho Nov 18 '19 at 02:49

1 Answers1

2

You have the right idea, but misunderstood the linked thread. Instead of changing the sort keys for the citation, you'll want to add sorting to the bibliography, i.e.

<bibliography second-field-align="flush" et-al-min="11" et-al-use-first="10">
   <sort>
      <key macro="issued" sort="descending"/>
      <key macro="author"/>
    </sort>
<layout>

Instead of modifying a style, you could also use the APA-CV style that already exsits on the repository

adam.smith
  • 808
  • 4
  • 9
  • Worked like a charm. The APA-CV is good too and I wasn't aware of that, but I'd rather modify the other one, since I also want a numbering to appear in front of each citation. – TomCho Nov 18 '19 at 15:52