Hi!
It's really hard to summarize what I want in one sentence, so bear with me please ( :
I'd like to have the project structure like this:
main.typ
notes/
├── lec1.typ
└── lec2.typ
And imageine we have a magic funtion #f().
Here's semi-pseudo-code of the desired result I want:
// def. of f:
#let f() = {
if /*inside main.typ*/ {
// do it this way
<root>
} else if /*inside lecN.typ*/ {
// display it differently
<in_sub_file>
}
}
// code of lec1.typ:
#f()
// render of lec1.typ:
<in_sub_file>
// code of main.typ
#include "notes/lec1.typ"
// render of main.typ
<root>
How do I implement that?
With .with?
I imagine we could (if #set was available for user-defined functions), do it like this:
// def of f somewhere
#let f(magic: none) = {...}
// main.typ
#set f(magic: "root")
#include /**/
// lec1.typ
#set f(magic: "sub_file")
Maybe realistically it might be possible with some fancy show rule inside main.typ .... idk
Any help is highly appreciated