Figures and images
Integrate images, diagrams, and illustrations into your NovaType documents.
Simple image
#image("photo.png")
Image with size
// Fixed width
#image("photo.png", width: 10cm)
// Proportional width
#image("photo.png", width: 50%)
// Fixed height
#image("photo.png", height: 5cm)
// Both (may distort)
#image("photo.png", width: 10cm, height: 5cm)
Figure with caption
#figure(
image("results.png", width: 80%),
caption: [Evolution of results over 12 months],
) <fig:results>
As illustrated in @fig:results, we observe...
Placement and alignment
// Centered (default for figure)
#figure(
image("photo.png", width: 50%),
caption: [My photo],
)
// Floating image on the right
#align(right)[
#image("logo.png", width: 3cm)
]
// Inline image
Here is an icon #image("icon.svg", height: 1em) in the text.
Supported formats
| Format | Extension | Recommendation |
|---|---|---|
| PNG | .png |
Images with transparency, screenshots |
| JPEG | .jpg, .jpeg |
Photos, complex images |
| SVG | .svg |
Vector graphics, logos, diagrams |
| GIF | .gif |
Simple images (first frame only) |
Recommendation
Prefer the SVG format for graphics and diagrams. It stays sharp at all sizes.
Image grid
#figure(
grid(
columns: 2,
gutter: 1em,
image("img1.png"),
image("img2.png"),
image("img3.png"),
image("img4.png"),
),
caption: [Comparison of the four methods],
) <fig:comparison>
Sub-figures
#figure(
grid(
columns: 2,
gutter: 1em,
[
#image("before.png")
(a) Before processing
],
[
#image("after.png")
(b) After processing
],
),
caption: [Image processing results],
)
Image with frame
#figure(
box(
stroke: 1pt + gray,
radius: 4pt,
clip: true,
image("screenshot.png", width: 100%)
),
caption: [Screenshot of the interface],
)
Figure numbering
// Default numbering (1, 2, 3...)
#set figure(numbering: "1")
// Numbering by chapter (1.1, 1.2...)
#set figure(numbering: "1.1")
// Customize the prefix
#set figure.caption(separator: " -- ")
Automatic placement
// Floating figure (automatic placement)
#figure(
image("graph.png", width: 80%),
caption: [Data chart],
placement: auto, // or top, bottom
)
Drawings and shapes
// Rectangle
#rect(width: 2cm, height: 1cm, fill: blue)
// Circle
#circle(radius: 1cm, fill: red)
// Ellipse
#ellipse(width: 2cm, height: 1cm, fill: green)
// Line
#line(start: (0pt, 0pt), end: (2cm, 1cm), stroke: 2pt)
// Polygon
#polygon(
fill: orange,
(0pt, 0pt),
(2cm, 0pt),
(1cm, 1.5cm),
)
Simple diagram
#figure(
grid(
columns: 3,
gutter: 1em,
align: center + horizon,
rect(fill: rgb("#e0f2fe"), inset: 1em)[Input],
text(size: 24pt)[->],
rect(fill: rgb("#2563eb"), inset: 1em)[
#text(fill: white)[Processing]
],
[],
text(size: 24pt)[->],
[],
[],
rect(fill: rgb("#dcfce7"), inset: 1em)[Output],
[],
),
caption: [Process diagram],
)