#importing the preamble with a prefix with some exceptions

20 messages · Page 1 of 1 (latest)

devout perch
#

Hi everyone!

I have my preamble imported with the prefix p as follows:

#import "preamble.typ" as p
#show: doc => p.preamble(doc)

And I want to define, say,

#let int = $integral$

inside my preamble (and potentially other stuff as well), so that in the main.typ I could just do $ int $ instead of $ #p.int $

One proposed solution was to import in this way:

#import "preamble.typ": int

But the issue with that, is I want the "list of things I want without a prefix" to be kind of flexible. Maybe to have some env. inside my preamble.typ where I can put all the stuff I want to import without a prefix, without any changes required to be made to the main.typ

Yet another proposed solution #import "preamble.typ": * doesn't work for me either, since I still want to import things with a prefix by default, unless specified otherwise.

gilded basalt
#

note that #import "preamble.typ" as p: int should also work

#

but either way

#

it sounds like you're looking for a separate module then, not preamble itself

#

e.g. #import "math-preamble.typ": *

#

and you can then import that inside preamble too

#

if you need

devout perch
gilded basalt
#

i mean

#

it's pretty much exactly what you're looking for if i understood correctly

#

the only other possible way would be to create a module inline within preamble.typ instead of in a separate file

#

but at the moment that is not possible

devout perch
devout perch
#

okay then, thank you! 😊

#

/closed/

gilded basalt
#

we can keep it open so people can still search for it :p

#

i added a ✅ though

#

should be helpful

gilded basalt