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:
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.
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.
<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.
Also, that suffix after the author-short macro, ideally switch that to a delimiter=", " on the group level. More robust.
Thanks for noting the delimiter, I'll change that in final codes.