Skip to content

Greater customization for references #92

Description

@Simre1

Hello!

I want to customize the references for line numbers, however, it is somewhat limited.

Problem

#figure(```
  line1
  line2
  ```)
<example>

@example:1

@example:1 renders as:
Listing 1-1

Instead, I want it to render as:
Line 1

I can modify the rendering of references with reference-sep and reference-number-format. However, it is not possible to modify the first part, I cannot remove "Listing 1".

Possible Solution

I am not really familiar with typst functions. I hope everything is still clear.

In order to make the whole rendering of the reference modifiable, one could add a setting reference-line-format (and similarly for item). This setting would be a function for rendering the reference and subsumes both reference-sep and reference-number-format.

It would look like this:

reference-line-format: (listing, line)  => ...content

The default behavior would be:

reference-line-format: (listing, line)  => [#listing-#line]
// or similar to the following if you need backwards compatability
reference-line-format: (listing, line)  => [#listing #reference-sep #reference-number-format(line)]

My customized behavior could then be configured like so:

reference-line-format: (listing, line)  => [Line #line]

Thanks for taking a look at this!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions