I’m using the Touying package to develop course slides. I also like the tblr package a lot for helping me typesetting nice tables. However, both packages define a cols function. The former as an alternative to grid, the latter as a means to apply a function to all cells in a column of a table.
What is the best way to avoid these namespace clashes? Should I #import "@preview/tblr:0.5.0" as tblr and use everywhere the prefix tblr. when I want to call a function belonging to the tblr package? This gets cumbersome rather quickly…
Is there a way to tell Typst that in a certain context/code block/… I specifically want to use the namespace of tblr?
I abbreviate package names most of the time to just two letter labels:
lilaq is shortened to lq (as per the author’s use in the examples)
tiptoe to tt
fletcher to fl
pavemat to pm
etc.
This makes it much easier to write while avoiding conflicts and keeps the document clean enough for yourself-in-two-weeks to still understand what’s going on.
I wish there was a way in Typst to “open” a module or dictionary locally, importing all its names into scope. This would let us do things like:
#import "@preview/tblr:0.5.0" as tblr
#import "@preview/touying:0.7.4" as touying
#import themes.university: *
// names from touying are usable unqualified
open touying
{ // but here I am going to do a lot of table stuff,
// so prefer 'tblr' locally for names in common
open tblr
...
}
#import "@preview/tblr:0.5.0"
#import "@preview/touying:0.7.4"
// names from touying are usable unqualified
#import touying: *
#cols[a][b]
#[
// but here I am going to do a lot of table stuff,
// so prefer 'tblr' locally for names in common
#import tblr: *
#tblr(columns: 2, cols(0, fill: gray))[a][b]
]