image
in typst(raster/vector.Support: PNG, JPEG, GIF & SVG.
Params:
image(
str,
format: autostr,
width: autorelative,
height: autorelative,
alt: nonestr,
fit: str, // opts- cover(default),contain, stretch
)
Eg:
#image("molecular.jpg", width: 80%)
#figure(
image("molecular.jpg", width: 80%),
caption: [
A step in the molecular testing
pipeline of our lab.
],
)
Eg of a function (sparkles & text color):
//Create
#let amazed(term, color: blue) = {
text(color, box[✨ #term ✨])
}
//Use
You are #amazed[beautiful]!
I am #amazed(color: purple)[amazed]!
Set and Show Rules Embedded:
//create
#let template(doc) = [
#set text(font: "Inria Serif")
#show "something cool": [Typst]
#doc
]
//use
#show: template
I am learning something cool today.
It's going great so far!
//Create Function
#let conf(title, doc) = {
set page(paper: "us-letter", header: align(right + horizon, title))
set par(justify: true)
set text(font: "Linux Libertine", size: 11pt)
columns(2, doc)
}
//Use
#show: doc => conf([Paper title], doc)
= Introduction
#lorem(90)
> conf.typ
#let conf(title: none, authors: (), abstract: [], doc) = {
set align(center)
text(17pt, title)
grid(columns: (1fr,) * calc.min(authors.len(), 3), row-gutter: 24pt, ..authors.map(author => [#author.name \ #author.affiliation \ #link("mailto:" + author.email)]))
par(justify: false)[*Abstract* \ #abstract]
set align(left)
columns(2, doc)
}
Importing and Using:
#import "conf.typ": conf
#show: doc => conf(
title: [Towards Improved Modelling],
authors: (
(
name: "Theresa Tungsten",
affiliation: "Artos Institute",
email: "tung@artos.edu",
),
(
name: "Eugene Deklan",
affiliation: "Honduras State",
email: "e.deklan@hstate.hn",
),
),
abstract: lorem(80),
doc,
)
= Introduction
#lorem(90)