How to use `glossy` package in `georges-yetyp` template?

Hi everyone, I’m using typst for quite a while now, but I’m having trouble including a glossary (from the glossy package) into the georges-yetyp template (in the glossaire definition). I changed

if glossaire != none {
  heading(numbering: none, outlined: false, level: 2, [Glossaire])
  glossaire
}

to

if glossaire != none {
  show: init-glossary.with(glossaire)
  glossary()
}

When I then return to my main.typ to call

glossaire: myGlossary

(when defining myGlossary in my main just after all the imports) it doesn’t work. The error message I get is:

Cannot reference metadata

Could somebody help me please? Thank you :)

Here’s the complete code for the conf.typ file (just copy pasted the github of georges-yetyp template and fixing a mispelling error at ecole/école)

#import "@preview/glossy:0.8.0": *

#let rapport(
  nom: none,
  entreprise: (
    nom: none,
    adresse: none,
    téléphone: none,
    logo: none,
  ),
  école: (
    logo: none,
  ),
  filière: "INFO",
  année: 5,
  titre: none,
  référent: none,
  responsable: none,
  tuteur: none,
  période: [25 Mars 2024 -- 25 Août 2024],
  résumé: none,
  fonte: "New Computer Modern",
  glossaire: none,
  lang: "fr",
  body
) = {
  set text(lang: lang, font: fonte, size: 12pt)
  set par(justify: true, leading: 0.8em)
  set heading(numbering: "I.1 -")
  show heading: block.with(spacing: 1.5em)

  if nom == none {
    panic("`nom` doit être une chaîne de caractère (avec votre nom et prénom)")
  }

  if titre == none {
    panic("`titre` doit être une chaîne de caractère (avec le titre du rapport)")
  }

  if type(entreprise) !=  dictionary {
    panic("`entreprise` doit être un dictionnaire contenant `nom`, `adresse` et éventuellemenent `téléphone` et `logo`")    
  }

  if entreprise.nom == none {
    panic("`entreprise.nom` doit être une chaîne de caractères ou un bloc de contenu")
  }

  let entreprise-text-info = align(horizon + right, {
    text(size: 14pt, entreprise.nom)
    linebreak()
    entreprise.adresse
  })
  let entreprise-info = if "logo" in entreprise and entreprise.logo != none {
    (
      align(
        right + horizon,
        entreprise.logo
      ),
      [],
      entreprise-text-info
    )
  } else {
    (entreprise-text-info,)
  }
  
  grid(
    columns: (1fr, 1fr),
    column-gutter: 5em,
    row-gutter: 1em,
    align(horizon, école.logo),
    ..entreprise-info
  )

  v(1fr)

  align(center, [
    #set text(size: 16pt)
    #nom \
    #filière \
    Rapport de stage de #année#super[ème] année

    #v(1fr)

    #smallcaps(text(size: 20pt, titre))

    #v(1fr)
    
    Tome principal \ & \ Annexes

    #v(1fr)

    #let year = datetime.today().year()

    Année universitaire #{year - 1}--#{year} \
    #période
  ])


  pagebreak()
  {
    set page(header: context {
      let headings-after = query(
        selector(heading.where(outlined: true)).after(here())
      )
      let heading = if headings-after.len() == 0 {
        query(
          selector(heading.where(outlined: true)).before(here())
        ).last()
      } else {
        headings-after.first()
      }
      grid(
        columns: (1fr, auto),
        emph(titre),
        emph(heading.body)
      )
    }, numbering: "1")

    show figure: it => align(center, block(spacing: 3em, it))
    
    show raw.where(block: true): it => {
      set text(font: "Fira Code")
      block(
        width: 110%,
        stroke: 1pt + gray,
        radius: 0.2em,
        inset: (y: 1em, x: 5%),
        align(left, it)
      )
    }

    {
      set page(header: none)
      v(1fr)
      align(center, heading(outlined: false, numbering: none, [Résumé]))
      align(center, block(width: 80%, align(left, résumé)))
      v(1fr)
  
      pagebreak()
  
      outline(indent: auto)
    }
    
    body 

    pagebreak()

    set page(header: none)

    heading(numbering: none, outlined: false, [Annexes])

    if glossaire != none {
      
      glossary()
    }
    
    heading(numbering: none, outlined: false, level: 2, [Table des figures])

    outline(target: figure, title: none)
  }

  pagebreak()

  show strong: it => text(size: 10pt, [#it \ ])
  set table.cell(colspan: 2)
  table(
    columns: (1fr, 1fr),
    gutter: 1em,
    stroke: none,
    table.cell(colspan: 1, [*Étudiant⋅e* #nom]),
    table.cell(colspan: 1, align(right, [*Année d'étude dans la spécialité* #année#super[ème] année])),
    [
      *Entreprise* #entreprise.nom \
      *Adresse* #entreprise.adresse \
      #if "téléphone" in entreprise [
        *Téléphone* #entreprise.téléphone
      ]
    ],
    [
      *Responsable administratif⋅ve* #responsable.nom, #responsable.fonction \
      #responsable.téléphone \
      #responsable.email
    ],
    [
      *Tuteur⋅ice de stage* #tuteur.nom \
      #tuteur.téléphone \
      #tuteur.email
    ],
    [
      *Enseignant⋅e référent⋅e* #référent.nom \
      #référent.téléphone \
      #référent.email
    ],
    [*Titre* #titre],
    [*Résumé* #résumé]
  )
}

And here’s my main.typ file:

#import "conf.typ": rapport
#import "@preview/glossy:0.8.0": *

#let glossaire = (
    tES: (
      short: "tES",
      long: "transcranial Electrical Stimulation",
      description: "Stimulations faite à partir de courant éléctrique à travers le crâne",
      group: "Stimulation"
    )
)

#show: rapport.with(
  nom: "Me",
  titre: "",
  filière: "",
  entreprise: (
    nom: "",
    adresse: [
      Here, \
      Nowhere, \
      
    ],
    logo: image("Logo.png", height: 4em),
  ),
  école: (
    logo: image("logo.png", height: 4em)
  ),
  tuteur: (
    nom: "",
    fonction: "",
    téléphone: "",
    email: ""
  ),
  responsable: (
    nom: "John",
    fonction: "",
    téléphone: "",
    email: "john.lennon@beatles.com"
  ),
  période: [],
  référent: (
    nom: "Bob",
    téléphone: "",
    email: "bob.dylan@gmail.com"
  ),
  glossaire: glossaire,
  résumé: []
)

Hi @Gabriel_LENZ and welcome to the Forum!

It would be much appreciated if you follow the guidance on posting code while asking for some assistance. This will help us read your code better in order to help you.

Please read through How to post in the Questions category and update your post:

1 Like

Give all the code is better, such as the code about importing package