typst-theorems
typst-theorems copied to clipboard
Theorem and picture side by side
I would like to display text and a picture side by side inside the theorem's box, like this:
Is there an easy way to achieve this?
The following code produces an unnecessary line break after "Theorem 0.1":
#import "@preview/ctheorems:1.1.2": *
#show: thmrules
#set page(width: 11cm, height: 4cm, margin: 0pt)
#let theorem = thmbox("theorem", "Theorem", fill: blue.lighten(90%))
#theorem[
#grid(columns: (1fr, auto), gutter: 1em,
lorem(20),
box(stroke: 1pt+black, width: 2cm, height: 2cm)[#align(center + horizon)[Picture]]
)
]
(Same if you use the wrap-it package instead of directly using
grid
.)
What do you think about adding a parameter blockfmt: x => x
to boxfmt
that transforms the entire block as blockfmt([#title#name#separator#body])
? One could then use:
#import "ctheorems.typ": *
#show: thmrules
#set page(width: 11cm, height: 3cm, margin: 0pt)
#let theorem = thmbox("theorem", "Theorem", fill: blue.lighten(90%))
#theorem(
blockfmt: it =>
grid(columns: (1fr, auto), gutter: 1em,
it,
box(stroke: 1pt+black, width: 2cm, height: 2cm)[#align(center + horizon)[Picture]]
)
)[
#lorem(20)
]