# Tabular in frame: get rid of horizontal spacing

I'm trying to surround a tabular with a thick frame:

\setlength\fboxrule{2pt}
\setlength{\fboxsep}{0pt}
\fcolorbox{black}{gray}{
\begin{tabular}{@{}p{2cm}|p{2cm}@{}}
A & B \\ \hline
C & D \
\end{tabular}
}


Although I set \fboxsep to 0pt and use @{}, there is still some horizontal margin between the frame and the tabular:

I want the horizontal line to reach the frame at both ends. How can I achieve that?

-

You are a victim of end of line space. Put % as shown in the following code:

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\setlength\fboxrule{2pt}
\setlength{\fboxsep}{0pt}
\fcolorbox{black}{gray}{%    %% <------- here
\begin{tabular}{@{}p{2cm}|p{2cm}@{}}
A & B \\ \hline
C & D
\end{tabular}%   %% <------- here
}
\end{document}


For details on adding % at the end refer to This Q and its A.

-
It's copied from the OP but that \  after D looks wrong. –  David Carlisle Jan 30 '14 at 11:03
@DavidCarlisle You have very good eyes. Thanks and corrected. :) –  Harish Kumar Jan 30 '14 at 11:05