1

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!

Fio
  • 45
  • 5

3 Answers3

2

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">
adam.smith
  • 808
  • 4
  • 9
  • Thank you very much! That indeed fixed the problem. However, the period at the end of the citation is now in a new line (meaning I now have three lines instead of two). Is there any way to prevent this, or, to keep the period between citation and annotation? – Fio Jan 15 '21 at 13:57
  • I think if you remove the `suffix="."` from `` that might be enough. You could then add it to the group that goes from the beginning to right before the note variable and/or you could add it to the line with ` – adam.smith Jan 15 '21 at 18:19
  • That did the trick! I added `suffix=". "` to certain spots within where I thought they would be good to have ( ). Thank you for all your help! – Fio Jan 25 '21 at 18:08
0

Ok, I was now able to fix this by replacing the line I added with

<text variable="note" prefix=""/>

There is no error message anymore and the citations look great! I will leave this question up, in case anyone is or will be struggling with the same problem.

Fio
  • 45
  • 5
0

I haven't tested this, but I think the problem is that you only used display="block" on a single element under <layout/>. Per https://docs.citationstyles.org/en/1.0.1/specification.html#display, "The display attribute ... may be used to structure individual bibliographic entries into one or more text blocks. If used, all rendering elements should be under the control of a display attribute."

If you want the annotations to appear on a new line, I'd try introducing a new <group display="block">...</group> that encompasses the original content of <layout/> in the bibliography section, followed by <text variable="note" display="block"/>.

Rintze Zelle
  • 1,654
  • 1
  • 14
  • 30
  • This isn't actually a problem -- e.g. the APA annotated style on the CSL repository has display set on only one element and works fine. Especially with `display="block"` that's also often the only way to get the desired behavior. This is in practice; you're right about the specifications, of course, and we should likely revisit that bit. – adam.smith Dec 27 '20 at 04:18