Row color issue with NiceTabular in R Markdown

36 Views Asked by At

I am preparing a Markdown document which will then be converted to pdf through the engine 'pdflatex'.

I basically want to print 2 tables, which have the same structure (only a number inside changing actually).

I want to get a clean table, with only the borders and the header line highlighted in a customized color named funGreen.

Here's the code of the table:

cat("\\begin{table}[ht]\n")
cat("\\centering\n")
cat("\\arrayrulecolor{funGreen}\n")
cat("\\setlength{\\extrarowheight}{2.5ex}\n")
cat("\\begin{NiceTabular}{|>{\\fontsize{14}{14}\\selectfont}l>{\\fontsize{14}{14}\\selectfont}p{5cm}|>{\\fontsize{14}{14}\\selectfont}r|}[colortbl-like]\n")
cat("\\hline\n")
cat("\\rowcolor{funGreen} \\makecell{\\textbf{Remediation Status}} & \\makecell{\\textbf{Count}} \\\\\n")
cat("\\hline\n")
cat("\\makecell{Open} & \\makecell{" , nrow(sca_vuln), "} \\\\\n")
cat("\\makecell{Proposed Mitigations} & \\makecell{0} \\\\\n")
cat("\\hline\n")
cat("\\end{NiceTabular}\n")
cat("\\caption{Total SCA Vulnerabilities and Mitigations}\n")
cat("\\label{tab:mytable}\n")
cat("\\end{table}\n")

The issue I get is that if I print only one of them, everything is fine. If I print both, the resulting pdf has 2 non-sense vertical boxes in the left margin of the pages with the 2 tables.

What is happening?

0

There are 0 best solutions below