quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.98k stars 328 forks source link

Feature request: Custom start for arabic cross reference numbering scheme #11038

Open maptv opened 1 month ago

maptv commented 1 month ago

It would be great to add the ability to set the starting point for the arabic cross reference numbering scheme: https://quarto.org/docs/authoring/cross-reference-options.html#numbering

This is already possible for all of the other cross reference numbering schemes.

The two use cases for this would be to start a new document with zero-based numbering and to continue the numbers from an existing document in a subsequent document:

---
title: "New document with zero-based numbering"
crossref:
  labels: arabic 0
---
---
title: " Continuation to a document with X figures, Y tables, and Z code listings"
crossref:
  fig-labels: arabic X
  tbl-labels: arabic Y
  lst-labels: arabic Z
---

I can volunteer to work on a pull request if someone could direct me to the place where the cross reference numbering logic lives.

cscheid commented 1 month ago

@maptv Thanks for the offer, but you should be aware that this is a big project. The crossref system is pretty complicated, because it needs to work across a variety of formats. At the very least, we need to be able to support

Each of these is a different system, and although you might only need one of those formats, we don't want to add features that only work on a single format. I'm saying this so that your expectations are calibrated. We also need you to be willing to sign a contributor agreement, as described here.

maptv commented 1 month ago

@cscheid, Thanks for the quick response. I sent the contributor agreement to JJ.

I think it makes sense to start with html and then work down the checklist:

I see files like crossref.ts and list.ts. Where would I start working on this?

cscheid commented 1 month ago

(@maptv I moved this discussion to the relevant repo.)

You should start by installing the dev version of Quarto. The HTML crossref system is at least partly implemented in Lua in the Pandoc filters. Look at

https://github.com/quarto-dev/quarto-cli/blob/861e3dfb4f6c533f09a06f130a24015581a3e2ea/src/resources/filters/crossref/format.lua#L137-L222

That should get you a toehold.