CSL Question: Different prefix and suffix of in-text citation based on item type?

Hi, I'd like to customize a style where I set the in-text citation of legal types (legal_case, bill, legislation, treaty) different from others, in that:

Legal types are cited as title only;
Other types are cited as (author, date).

I tried using a macro and then citing it in section:
<macro name="type-based-citation">
<choose>
<if type="legal_case bill legislation treaty" match="none">
<text macro="author-short" suffix=", "/>
<text macro="date"/>
</if>
<else>
<text variable="title" font-style="italic"/>
</else>
</choose>
</macro>
...
<citation>
<layout prefix="(" suffix=")" delimiter="; ">
<text macro="type-based-citation"/>
</layout>
</citation>


In this way the non-legal types are fine, but the legal types will be cited as (title), where the brackets are not needed. Is there any way to define different prefix and suffix for in-text citations based on item types? The delimiter doesn't matter because in my situation legal items are almost always cited as single ones (i.e. one citation contains only one cite).

Thank you very much.
  • edited February 4, 2022
    You would use ‘choose’ to differentiate item types in the layout section, then have a ‘group’ in the non-legal condition, where you would put the prefix and suffix. Remove the affixes from the ‘layout’ node.
  • Thanks. I adjust the layout section like this:

    <layout delimiter="; ">
    <choose>
    <if type="legal_case bill legislation treaty" match="none">
    <group prefix="(" suffix=")">
    <text macro="author-short" suffix=", "/>
    <text macro="date"/>
    </group>
    </if>
    <else>
    <text variable="title" font-style="italic"/>
    </else>
    </choose>
    </layout>


    In this case, the non-legal citation with more than one cite appear like this:
    (author1, date1); (author2, date2); (author3, date3)

    I'd like it to appear like this, as in my previous codes:
    (author1, date1; author2, date2; author3, date3)

    I think the catch here is that the affixes in "layout" apply to the whole citation, while the affixes in "group" apply only to the individual cites.

    Any suggestions? Thanks.
  • Sorry, can't be done; also unclear how this would actually work if you mix legal and non-legal citations.
  • OK, thanks anyway. I'm trying to accomodate the needs of the colleagues in the legal branch of my institution.
  • edited February 4, 2022
    As a workaround, could you not just leave out the brackets and add them manually when writing in the text?
    Also, that suffix after the author-short macro, ideally switch that to a delimiter=", " on the group level. More robust.
  • This might be possible with Jurism, but not sure.
  • @damnation , thanks a lot for the suggestion. Removing the brackets in the codes will in turn cause inconvenience for writers who seldom cite legal materials, so it's a trade-off. I think I'll ask what the colleagues prefer and decide.

    Thanks for noting the delimiter, I'll change that in final codes.
  • As a final workaround, one could leave the style as it was, cite the legal items manually in the text and then add them to the bibliography at the end using the "Edit bibliography" funcitonality.
Sign In or Register to comment.