#import "theme.typ": * /// 点阵底纹 #let tech-dots(width: 100%, height: 100%, step: 10pt) = box(width: width, height: height, clip: true)[ #for x in range(40) { for y in range(40) { place( left + top, dx: x * step, dy: y * step, circle(radius: 0.35pt, fill: color-grid), ) } } ] /// 条形码条 #let tech-barcode(width, height, bars: 28) = box(width: width, height: height, clip: true)[ #for i in range(bars) { let w = if calc.rem(i, 4) == 0 { 2.2pt } else if calc.rem(i, 2) == 0 { 1.4pt } else { 0.8pt } place( left + top, dx: i * (width / bars), box(width: w, height: 100%, fill: color-ink), ) } ] /// 等宽标签 #let tech-label(body, fill: color-ink, size: 7pt) = text( font: mono-font, size: size, fill: fill, tracking: 0.14em, )[#body] /// 章节编号 #let section-tech-id(..nums) = { let n = nums.pos() let id = if n.len() == 1 { let num = n.first() if num < 10 { "0" + str(num) } else { str(num) } } else if n.len() == 2 { str(n.at(0)) + "." + str(n.at(1)) } else { str(n.at(0)) + "." + str(n.at(1)) + "." + str(n.at(2)) } box(fill: color-neon, inset: (x: 5pt, y: 2pt))[ #text(font: mono-font, size: 7pt, weight: "bold", fill: color-ink)[#id] ] }