From 085f45879e4407eb1f740bc417953ba9f621c0e9 Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Thu, 25 Jan 2024 23:16:57 -0500 Subject: [PATCH] typst template --- inst/templates/typst.typ | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/inst/templates/typst.typ b/inst/templates/typst.typ index d32c29a2..b231d800 100644 --- a/inst/templates/typst.typ +++ b/inst/templates/typst.typ @@ -1,32 +1,61 @@ -#import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx +#import "@preview/tablex:0.0.8": tablex, hlinex, vlinex +#let nrows = 6; +#let nhead = 1; #tablex( columns: 4, align: left + horizon, - auto-vlines: false, + auto-lines: false, header-rows: 1, + // lines + hlinex(y: 0, stroke: black + .1em), + hlinex(y: nhead, stroke: black + .05em), + hlinex(y: nrows, stroke: black + .1em), + hlinex(y: 6, stroke: black + .1em), + hlinex(start: 0, end: 3, y: 4, stroke: rgb("#239dad") + .2em), + vlinex(x: 2, stroke: yellow + .5em), + map-cells: cell => { + // align let j = (1,); if (j.contains(cell.x)) { cell.align = center }; + // background let i = (2,4); let j = (1,); - if (i.contains(cell.y) and j.contains(cell.x)) { cell.fill = black }; + if (i.contains(cell.y) and j.contains(cell.x)) { cell.fill = olive }; + // color let i = (2,4); let j = (1,); if (i.contains(cell.y) and j.contains(cell.x)) { cell.content = { set text(white); cell.content } } + // italic let i = (0,); if (i.contains(cell.y)) { cell.content = { emph(cell.content) } } + // underline + let i = (3,4,); + let j = (3,); + if (i.contains(cell.y) and j.contains(cell.x)) { cell.content = { underline(cell.content) } } + + // underline + let i = (3,4,); + let j = (3,); + if (i.contains(cell.y) and j.contains(cell.x)) { cell.content = { strike(cell.content) } } + + // bold let i = (1,); if (i.contains(cell.y)) { cell.content = { strong(cell.content) } } + + + return cell; + },