I am a LaTeX beginner and facing an issue that I can't seem to find the answer for... I am creating a table (using booktabs but my issue also occurs when not using the package), and whenever I remove the space on the edges of the table (with @{}) and try to colour individual rows at the same time, the space taken by the colour is wider than the table. See the following example:
\usepackage{array}
\usepackage{colortbl}
\usepackage[table,xcdraw]{xcolor}
% [...]
\fbox{\begin{tabular}{@{}ll@{}}
foo & bar\
\rowcolor[HTML]{BFBFBF} bar & foo
\end{tabular}}
Which results in the following:
Thanks in advance for any help/pointer!



\tabcolsep. The solution i found is to prepend>{\columncolor{white}[\tabcolsep][0pt]}to my first column and>{\columncolor{white}[0pt][\tabcolsep]}to my last column. I am aware it's a dirty hack but it seems to do the job (and my PhD thesis is due in a few weeks). If anybody wants to answer this to my question I'll accept it! – Laura Mar 18 '21 at 16:52