Skip to content

Commit

Permalink
Updated tests for kable() in LaTeX mode typesetting numeric columns i…
Browse files Browse the repository at this point in the history
…n math mode. Improves #1709.
  • Loading branch information
krivit committed Feb 4, 2021
1 parent 09a4f82 commit 7324f89
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions tests/testit/test-table.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,22 @@ assert('kable() does not add extra spaces to character columns', {
\\hline
x & y\\\\
\\hline
1.20 & fooooo\\\\
\\(1.20\\) & fooooo\\\\
\\hline
4.87 & bar\\\\
\\(4.87\\) & bar\\\\
\\hline
\\end{tabular}'
})

assert('kable() in LaTeX mode formats minus signs and decimal and thousands separators correctly', {
kable2(data.frame(x = c(-1111, 2222), y = c(1111, -0.5), z = c('text,comma', '-0.5')), 'latex', format.arg=list(big.mark = ',')) %==% '
\\begin{tabular}{r|r|l}
\\hline
x & y & z\\\\
\\hline
\\(-1{,}111\\) & \\(1{,}111.0\\) & text,comma\\\\
\\hline
\\(2{,}222\\) & \\(-0.5\\) & -0.5\\\\
\\hline
\\end{tabular}'
})
Expand Down Expand Up @@ -86,11 +99,11 @@ assert('kable(format = "latex", linesep = ...) works', {
\\hline
x\\\\
\\hline
1\\\\
2\\\\
3\\\\
\\(1\\)\\\\
\\(2\\)\\\\
\\(3\\)\\\\
\\midrule
4\\\\
\\(4\\)\\\\
\\hline
\\end{tabular}"
})
Expand Down

0 comments on commit 7324f89

Please sign in to comment.