Is there a reliable way to determine the number of cited sources with a query or any other way which lets me put that number into a variable? Another way of phrasing the question would be: can I get the count of Bibliography entries?
I can’t directly count them from the BibTeX or YAML files since not all entries in there might be actually cited within the document and the number absolutely has to be accurate in all cases.
I’m aware of the following workaround for getting the amount of sources cited via the @-syntax:
#context query(ref.where(element:none)).len()
but this does not work for sources cited using #cite(). And since #cite() is not locateable I can’t query them.
But there must be a counter which is used for displaying the bibliography entries, but I haven’t found a way to access it from within Typst. (This is where a list of all available elements for counters might help), or is this currently not possible?
This should give you all unique bibliography’s references. If you add a final length, it should give you the count of unique citations in the document, i.e.,
Ah indeed, my bad I think I misread your initial post. As you rightly say so, cite is not locatable. I can’t think of any way to do that entirely in Typst however, that wouldn’t involved using a global show rule and parsing the entire AST.