diff --git a/template.typ b/template.typ
index b0371157c931e3b9d4831293157b20b095839f7b..16c7d778720dbd982db745b3bc3bd3eeb6ed95fa 100644
--- a/template.typ
+++ b/template.typ
@@ -24,22 +24,33 @@ codly()
 
 show table.header: strong
 
+show raw.where(block: false): r => {
+  let e = 0.25em
+  let f = "DejaVu Sans Mono" // I think this is the default mono font. See https://github.com/typst/typst/issues/2870
+  // highlight(fill: gray, radius: 3pt, extent: e, {
+  //   h(e)
+  //   text(font: f, r)
+  //   h(e)
+  // })
+  box(inset: (x: e, y: e), fill: gray, radius: 3pt, baseline: e, text(font: f, r))
+}
+
 show figure.caption: it => block({
-  let content = align(left, {
-          strong[#it.supplement #context(it.counter.display(it.numbering))#it.separator]
-          it.body
+  layout(size => {
+    // Add borders, so the caption is better distinguishable from the below paragraph.
+    grid(columns: (0.02 * size.width, auto, 0.02 * size.width),
+      [],
+      align(center, {
+        block({
+          align(left, {
+            strong[#it.supplement #context(it.counter.display(it.numbering))#it.separator]
+            it.body
+          })
         })
-  let size = measure(content)
-  // Add borders, so the caption is better distinguishable from the below paragraph.
-  grid(columns: (0.02 * size.width, auto, 0.02 * size.width),
-    [],
-    align(center, {
-      block({
-        content
-      })
-    }),
-    [],
-  )
+      }),
+      [],
+    )
+  })
 })
 
 set text(lang: lang)