I've ran into a problem while creating a CSL style. For in-text citations I have to create an author-date element with the following conditions:
- when there're 1-3 authors, show [Author 1, Author 2, Author 3, Year]
- when there're more than 3 authors, show [Title, Year]
I've tried suppress-max but none helped it me in figuring out
Examples: 1 author [Doe, 2022]
2 authors [Doe, Gogh, 2022]
3 authors [Doe, Gogh, Johnson, 2022]
4 authors [Climate change impacts, 2022]
<macro name="author_short"> <names variable="author"> <name form="short" name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/> <substitute> <text variable="title"/> </substitute> </names> </macro>
The way to do this is to use the et al settings and then set the term for et al to an empty string. So change your
author-shortmacro to(If you want to submit the style to the CSL repository, it's recommended to set et al on
<citation>and not in the author macro)And then define an empty et al term in a locale section at the beginning of the style, right below the `:
Edit: If you do need the et-al term otherwise, you can define and call the term for
and otherslike so:and then in the macro use