Skip to contents

Adds a vertical line at a specific position in the table.

Usage

tt_vline(table, x, start = NULL, end = NULL, stroke = TRUE)

Arguments

table

A typst_table object.

x

Position of the line (0 = before first column, 1 = after first column, etc.).

start

Starting row for partial line (0-indexed, inclusive, 0 = header).

end

Ending row for partial line (0-indexed, inclusive).

stroke

Line style: TRUE for default, color name, full stroke spec, or FALSE to explicitly remove a line.

Value

The modified typst_table object.

Examples

# Add line after first column
tt(mtcars[1:5, 1:3]) |>
  tt_vline(1)
#> #table(
#>   columns: (auto, auto, auto),
#>   stroke: none,
#>   table.vline(x: 1),
#>   table.header(
#>     table.hline(stroke: 1pt),
#>     [mpg], [cyl], [disp],
#>     table.hline(stroke: 0.5pt)
#>   ),
#>   [21], [6], [160],
#>   [21], [6], [160],
#>   [22.8], [4], [108],
#>   [21.4], [6], [258],
#>   [18.7], [8], [360],
#>   table.hline(stroke: 1pt)
#> ) 

# Add partial vertical line (data rows only)
tt(mtcars[1:5, 1:3]) |>
  tt_vline(1, start = 1)
#> #table(
#>   columns: (auto, auto, auto),
#>   stroke: none,
#>   table.vline(x: 1, start: 1),
#>   table.header(
#>     table.hline(stroke: 1pt),
#>     [mpg], [cyl], [disp],
#>     table.hline(stroke: 0.5pt)
#>   ),
#>   [21], [6], [160],
#>   [21], [6], [160],
#>   [22.8], [4], [108],
#>   [21.4], [6], [258],
#>   [18.7], [8], [360],
#>   table.hline(stroke: 1pt)
#> )