diff options
Diffstat (limited to 'docs/typ/style.typ')
| -rw-r--r-- | docs/typ/style.typ | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/docs/typ/style.typ b/docs/typ/style.typ index 9e98838d..e1bab27d 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -187,18 +187,26 @@ } } +/// How roomy #pairs tables are: "roomy" (the book, the HTML) or "tight" +/// (the A4 sheet sets it). +#let pairs-density = state("pairs-density", "roomy") + /// Pairs: a thing and what it means, as a two-column table, key column /// first, rows on alternating tints. `split: 2` sets the rows as that many /// tables side by side (on paper; HTML gets one table). #let pairs(split: 1, ..cells) = { let rows = cells.pos().chunks(2) - let one(rows) = table( - columns: (auto, 1fr), stroke: none, inset: (x: 2pt, y: 1.6pt), - fill: (_, y) => if calc.even(y) { palette.tag-bg.transparentize(35%) }, - ..rows.flatten(), - ) - context if html-out() or split == 1 { one(rows) } else { - let n = calc.ceil(rows.len() / split) - grid(columns: (1fr,) * split, column-gutter: 2pt, ..rows.chunks(n).map(one)) + context { + let tight = pairs-density.get() == "tight" + let one(rows) = table( + columns: (auto, 1fr), stroke: none, + inset: if tight { (x: 2pt, y: 1.6pt) } else { (x: 7pt, y: 4pt) }, + fill: (_, y) => if calc.even(y) { palette.tag-bg.transparentize(35%) }, + ..rows.flatten(), + ) + if html-out() or split == 1 { one(rows) } else { + let n = calc.ceil(rows.len() / split) + grid(columns: (1fr,) * split, column-gutter: if tight { 2pt } else { 10pt }, ..rows.chunks(n).map(one)) + } } } |
