Search code examples
citationsbibliographycsl

Trying to make annotated citation style, getting "Error generating citations and bibliography"


I have a question on some csl code.

I am trying to convert the "nature" style which is available through Zotero to an annotated style which gets the annotation by citing the "Extra" field (similar to APA 7th edition annotated).

I am not familiar with coding in csl so I found out thanks to google that all I had to do is add the line <text variable="note" display="block"/> before </layout> (found this info here: https://forums.zotero.org/discussion/19552/annotated-bibliography-in-mla-or-chicago-style)

I did so and now I am getting the following error when generating the style in Zotero's style editor:

Error generating citations and bibliography: citeproc-js error: Level mismatch error: wanted bib_first but found bib_other

I already checked my code with the CSL style and locale editor (https://validator.citationstyles.org/) and it gives me no errors. Googling this error message does't give any good results. I am trying to use this style in Microsoft Word once it works.

Here are the last couple of lines of the code (if the line <text variable="note" display="block"/> is removed, then the error is gone):

        <text macro="editor"/>
        <text macro="volume"/>
        <text variable="page"/>
        <text macro="issuance"/>
        <text macro="access"/>
      </group>
      <text variable="note" display="block"/> 
    </layout>
  </bibliography>
</style>

I would really appreciate if anyone could help with this. Thanks!


Solution

  • I don't think this is in the specifications, but you can't mix second-field-align in the bibliography settings with display set on individual elements (because they're doing the same type of things, so the CSL processor doesn't know what you actually want to do).

    I see you found a solution, but that'll not print the annotations on a new line. If you still want that, go back to

    <text variable="note" display="block"/>
    

    But then remove the second-field-align from bibliography, i.e. for Nature, turn it into

    <bibliography et-al-min="6" et-al-use-first="1"  entry-spacing="0" line-spacing="2">