rowcolors fill whole row and not just the table row

Ok so i wrote this simple code (shown below) to create an alternate colour table using \rowcolors, yet instead of just colouring the rows of the table it colours the whole row (even more than textwidth). Any help how to fix this?

begin[ht] \scriptsize \begin \rowcolors \caption \begin | p> Filename & Contents \\ \hline \hline A & B \\ C & F \\ \end \end \end

enter image description here

ASantosRibeiro asked Dec 14, 2014 at 17:51 ASantosRibeiro ASantosRibeiro 1,257 9 9 silver badges 16 16 bronze badges

1 Answer 1

While 0.45\textwidth + 0.55\textwidth would seem to fit within \textwidth , each of your p -columns have an extra column separation. on both sides. To that end, you should remove them in order to make it fit within the text block boundary:

enter image description here

\documentclass \usepackage[table] \usepackage \begin \begin[ht] \scriptsize\centering \rowcolors \caption \begin < p| p> Filename & Contents \\ \hline \hline A & B \\ C & F \end \end \lipsum[1] \end