xmlcitationscsl

author-date citation problem: how to print out title or author


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:

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>


Solution

  • 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-short macro to

    <macro name="author_short">
      <names variable="author">
        <name et-al-min="4" et-al-use-first="1" form="short" name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
        <substitute> 
          <text variable="title"/> 
        </substitute> 
      </names>
    </macro>
    

    (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 `:

    <locale>
      <terms>
        <term name="et-al"></term>
      </term>
    </locale>
    

    Edit: If you do need the et-al term otherwise, you can define and call the term for and others like so:

        <locale>
          <terms>
            <term name="and others"></term>
          </term>
        </locale>
    

    and then in the macro use

    <macro name="author_short">
      <names variable="author">
        <name et-al-min="4" et-al-use-first="1" form="short" name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
      <et-al term="and others"/>
        <substitute> 
          <text variable="title"/> 
        </substitute> 
      </names>
    </macro>