How can I make Tinymist recognize labels from the theoretic package?

Hello @isabeldahlgren,

Welcome to the forum.

If I understand correctly, you get this in Tinymist:


while using some code like:

#import "@preview/theoretic:0.3.1"
#import theoretic.presets.basic: *
#show ref: theoretic.show-ref
#theorem(<no-label-in-tinymist>)[Title][Body]

TL;DR

  • Tinymist seems to only list labels that are referenceable and not standalone.
  • The theoretic package uses a trick to create referenceable labels with metadata.
  • Tinymist does not seem to catch that and does not display the label in the LABEL box.
  • The package theorion supports referenceable labels (through custom figures I presume).
More in Depth Explanation

More in Depth Explanation

Here is a MWE that I believe will reproduce what you are explaining:

#import "@preview/theoretic:0.3.1"
#import theoretic.presets.basic: *
#show ref: theoretic.show-ref
#theorem(<label>)[Title][Body]
As per @label ... or @label[!] or @label[--]

Note that the theoretic package documentation explains the way that labels are handled and the various options the user has to display the references. Worth citing:

NB: Simply putting a <label> after the #theorem[] does not work for referencing

If you try it, Tinymist will display the label in the LABEL box it but the reference won’t work (Typst will raise cannot reference sequence).

#theorem(<no-theoretic>)[Title][Body]<yes-but-broken>

Without digging into the theoretic package code, it seems that label is handled internally using a trick to reference labels with metadata:

Regarding Tinymist, it seems to include only labels that are referenceable as per the typst documentation.

This other example represents the situation:

#import "@preview/theoretic:0.3.1"
#import theoretic.presets.basic: *
#show ref: theoretic.show-ref

#set heading(numbering: "1")
#set math.equation(numbering: "1")

= Heading <yes-heading> 

#figure(rect(), caption: [My Figure])<yes-figure>

$x+y$<yes-equation>

#footnote([Footnote])<yes-footnote>

*Strong* #label("no-standalone") 

#theorem(<no-theoretic>)[Title][Body]

#show ref: it => {
  if it != none and it.element.func() != metadata { return it; }
  link(it.element.location(), quote(it.element.value))
}

#let my-block(title: [], label: none, body) = [#metadata(title)#label] + block({
  strong(title)
  h(1em, weak: true)
  body
})

#my-block(title: [Foo], label: <no-metadata>, lorem(20))

One solution I could see for theoretic would be to use a custom figure instead of metadata, but I really haven’t looked at the code so this is more like a supposition.

Perhaps this Tinymist LABEL section should be named REFERENCE instead?

In any case, you could contact the respective authors @nleanba or @Myriad-Dreamin for more information, to report an issue or to request a new feature.

2 Likes