[5751#8] How to factorise show rules for some text?

Hello,

I am writing my first Typst document. And here is what I have in my main.typ:

[...]
#let cas_limite_font = "Linux Biolinum O"
#show "impossible de gagner": set text(font: cas_limite_font)
#show "déjà gagné": set text(font: cas_limite_font)
[...]

The document then compiles to (excerpt):

How can I “factorise” set text(...) for a specific list of texts ?

  • Is there a kind of a match?
  • Shall I use a regex?
     #show regex("impossible de gagner|déjà gagné"): set text(font: "Linux Biolinum O")
    

Best regards,

@ensko wrote a great post about this topic here:

Using that post as a guide, something like this should work for your case:

#let words = ("ipsum", "sit")
#show regex(words.join("|")): set text(red)//Change font here

#lorem(10)
3 Likes