If I want consistent show and set rules across several templates, I have been trying to do so with a generic styling file, which is imported into each template. This guarantees the consistency, I would think, but in practice does not. E.g., in styling.typ
:
#set text( size: 10pt,
fill: blue,
font: ("Lato", "Noto Sans", "Fira Sans", ),
lang: "en",
ligatures: true,
discretionary-ligatures: true,
historical-ligatures: true)
#show math.equation: set text(font: ("Lete Sans Math", "Noto Sans Math", "Fira Math", ),
ligatures: true,
discretionary-ligatures: true,
historical-ligatures: true)
#show raw: set text(font: "Space Mono",
ligatures: true,
discretionary-ligatures: true,
historical-ligatures: true)
while in template.typ
:
#let exercise(title: "", date: none, body) = {
// Set the document's basic properties.
set document(author: "Me", title: title)
set page(
"a4",
margin: (top: auto, bottom: auto, left: 1cm, right: 1cm),
header: [
#set text(0.8em)
#parbreak()
#line(stroke: blue+1pt, length: 100%)
]
)
// Title row.
align(center)[
#block(
text(
weight: 700,
size: 1.75em,
//font: "IBM Plex Serif",
title
)
)
#v(1em, weak: true)
]
// Main body.
set par(justify: false, leading: 1em, linebreaks: "optimized")
include("styling.typ")
body
}
so that in main.typ
:
#import "template.typ": *
#show: exercise.with(
title: "Hello, World!",
authors: ((name: "Me", title: "", email: "", affiliation:""),),
date: "Now",
)
This is body text!
My ultimate goal is to have a set of generic show
and set
rules that can be used consistently in several different templates (slides, documents, etc) but I can not get it to work correctly. Is this the wrong way to achieve that goal?