tests/testthat/test-tablecalcs.R

test_that("table calculations are okay", {
  latex <- kableExtra::kbl(mtcars[1:2, 1:2], format = "latex")
  parsed <- parseLatex(latex)
  table <- parsed[[find_tabular(parsed)]]
  expect_identical(tableNrow(table), 3L)
  expect_identical(tableNcol(table), 3L)
  expect_identical(tableDim(table), c(3L,3L))
  table <- prepare_table(table)
  expect_identical(tableNrow(table), 3L)
  expect_identical(tableNcol(table), 3L)
  expect_identical(tableDim(table), c(3L,3L))
})

Try the parseLatex package in your browser

Any scripts or data that you put into this service are public.

parseLatex documentation built on June 8, 2025, 10:19 a.m.