Using the institution name as a substitute author name
I recently learned the basics of customizing CSL styles. Is it possible to use the institution name (which is one of the available fields for a report in Zotero) as a substitute author name? The problem is that institution is not one of the available name variables.
Is there a workaround?
Thank you!
Is there a workaround?
Thank you!
I'd guess institution is mapped to publisher in your case.
https://aurimasv.github.io/z2csl/typeMap.xml
Note however that you can also put the name of the body into the author field using single-field mode. Maybe that solved your issue without editing the style. It depends.
Yes, I've been managing this issue by pasting in the name of the institution into the author field, but I'm wondering if there's a way to directly use the Institution field in Zotero.
And no, "Institution" will never be a name variable. But you can set a substitute with normal variables also.
E.g. line 39 here: view-source:https://www.zotero.org/styles/advanced-pharmaceutical-bulletin?source=1
It could be a variable or a macro like in this case.
I want to set a substitute author name in the bibliography to the institution name.
<names variable="author">
<name text="and" name-as-sort-order="first"/>
<label form="short" prefix=", "/>
<substitute>
<choose>
<if type="report">
<text variable="publisher"/>
</if>
<else>
<names variable="editor"/>
</else>
</choose>
</substitute>
</names>
<macro name="contributors-short">
<names variable="author">
<name form="short" and="text" delimiter=", " initialize-with=". "/>
<substitute>
<choose>
<if type="report">
<text variable="publisher"/>
</if>
<else>
<names variable="editor"/>
</else>
</choose>
<text macro="substitute-title"/>
<text macro="title"/>
</substitute>
</names>
</macro>
Unfortunately, it's not working. I tried it on an entry in Zotero that has "SBTi" in the Institution field. This is the bibliographic entry generated:
“From Ambition to Impact: How Companies Are Cutting Emissions at Scale with Science-Based Targets.” 2020. SBTi. https://sciencebasedtargets.org/sbti-progress-report-2020.
I want SBTi to be in front of the entry as the author.
What could the problem be?
But if you get the title, then there is obviously a title substitute set before it can print out the institution. Either remove (not recommended) or change the order or build in a conditional somehow.
This is magical! What should a newbie to CSL know (the prerequisites) to be able to write code snippets like this? Any suggestions regarding resources/tutorials/books would be helpful. I'm not a programmer, though I've dabbled with it in an amateurish way. I've begun watching your 6 May 2020 webinar, which should help.
A big thank you to everyone who contributed to this thread.
https://zoteromusings.wordpress.com/2013/10/28/writing-csl-features-and-best-practices/
Has some best practices.
I had first tried to implement the code snippet you suggested in the visual editor, but had no idea how to begin. So I pasted the code into the code editor instead.
But after watching a few of the nifty things you did in the visual editor at the start of the webinar, I felt like taking another stab at it. This time I was able to enter the code through the visual editor (I checked this by examining the code editor). But how to test it with my example bibliography item? I eventually figured out how to do this. I exported the item in CSL JSON format and pasted it into the Advanced citation window of the visual editor to pull it in.
Disappointment! The institution was not getting printed as the author. I then recalled something you showed in the webinar: conditionals can be moved up and down the tree. So I moved my conditionals up, just below the Substitute node. That did the trick! It's working now. I suppose this little experiment was an example of the webinar-plus-trial-and-error approach.
Thanks for the linked musings page. Very useful.