ytseis's blog

Typstのメモ

#let kintou(body, width) = {
  box(width: width, body.clusters().join(h(1fr)))
}
#set math.equation(numbering: "(1)")
#show math.equation: it => {
  if it.block and not it.has("label") and it.numbering != none [
    #counter(math.equation).update(v => v - 1)
    #math.equation(it.body, block: true, numbering: none)
  ] else {
    it
  }
}
#import "@preview/cetz:0.4.2"

#let arrow(from, to, color, ..args) = cetz.draw.line(from, to, stroke: color, mark: (start: ">", end: ">"), ..args)

#cetz.canvas({
    import cetz.draw: *

    content((0,0), image("figure.png", width: 425pt), anchor: "south-west")
    grid((0,0), (15,10), stroke: (gray + .4pt), step: 1)
    grid((0,0), (15,10), stroke: (blue + .4pt), step: 2)

    content((1.5,-0.2), anchor: "north-west", text(size: .8em, [hoge]))

    arrow((3.1,3), (13,3), (blue + 3pt), name: "piyo")
    content(("piyo.start", 50%, "piyo.end"), anchor: "south", text(fill: blue)[Piyo])
}),
#import "@preview/unify:0.6.0": qtyrange as org-qtyrange
#import "@preview/unify:0.6.0": *
#let qtyrange(..args) = {
  let named = args.named()
  if "delimiter" not in named {
    named.insert("delimiter", "\"to\"")
  }
  org-qtyrange(..args.pos(), ..named)
}