Here’s the step by step from regular configuration to a template/style function
// in the document
#set text(size: 12pt)
// rest of document here
// in the document
#show: doc => {
set text(size: 12pt)
doc
}
// rest of document here
// in the document
#let my-template(doc) = {
set text(size: 12pt)
doc
}
#show: my-template
// rest of document here
- Move the function to a different file
template.typ
#let my-template(doc) = {
set text(size: 12pt)
doc
}
main.typ
#import "template.typ": my-template
#show: my-template
// rest of document here
It’s no wonder it’s confusing for those not used to it (and I wasn’t used to it until using it for a while…) it sort of turns function calling inside out doesn’t it? That’s why it’s not invoked using regular function call syntax, but you use show
. show
is “take all the following document and give as a parameter to the function”.