Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consecutive citations use a wrong CSL position definition #286

Open
1 task done
brotz opened this issue Mar 1, 2025 · 0 comments
Open
1 task done

Consecutive citations use a wrong CSL position definition #286

brotz opened this issue Mar 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@brotz
Copy link

brotz commented Mar 1, 2025

Description

I've been trying out Typst for some time and it's such a pleasure to with! There's only been one problem so far:

Description

I'm using a "note" citation style, where citations are put into footnotes. The style should render the word "ibid" when the same citation appears for the second (third, etc.) time in a row (there is some text inbetween those citations, but no other citation). This is achieved using the position property in the CSL file, like so:

<citation>
  <layout delimiter="; ">
    <choose>
      <if position="ibid-with-locator">
        <!-- Same citation as the one before, with a supplement, e.g. #cite(<key>, supplement: "something") -->
      </if>
      <else-if position="ibid">
        <!-- Same citation as the one before, without supplement -->
      </else-if>
      <!-- Other cases... -->

Take this example Typst source using such CSL style:

I've said it before.@mykey

And I'll say it again.@mykey

Life moves fast.#cite(<mykey>, supplement: "p. 42")

This results in three footnotes, the first one containing the citation, the second one being incorrectly empty, and the third one correctly containing "ibid., p.42" as per my style.

When not specifying a supplement in the second citation, I would expect the position="ibid" to be used. Instead, position="ibid-with-locator" is used, but since the locator variable, where Typst normally puts the supplement, is not defined, the evaluation fails. Nothing gets printed out, and my footnote where the text "ibid" should be is instead empty.

Workaround

I have made a simple workaround by modifying my CSL file the following way:

<citation>
  <layout delimiter="; ">
    <choose>
      <if position="ibid-with-locator">
        <choose>
          <if variable="locator" match="any">
            <!-- Put the original contents of <if position="ibid-with-locator"> here.  -->
          </if>
          <else>
            <!-- Put the contents of <if position="ibid"> here.  -->
          </else>
        </choose>
      </if>
      <else-if position="ibid">
        <!-- This won't be used by Typst -->
      </else-if>
      <!-- Other cases... -->

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst
@brotz brotz added the bug Something isn't working label Mar 1, 2025
@laurmaedje laurmaedje transferred this issue from typst/typst Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant