[Tex/LaTex] Oversized colored row in beamer block

beamercolortables

As a follow up to this question, I am trying to insert tables in my beamer presentation so that they have the same style as blocks. However, I want to avoid using rules in my tables, and I am trying to used colored rows (with package xcolor) to improve readability.

Here is an example of my code:

\PassOptionsToPackage{table}{xcolor}
\documentclass{beamer}

\usepackage{tabularx}

\definecolor{RowColorOdd}{rgb}{0.914,0.914,0.953}
\definecolor{RowColorEven}{rgb}{1,1,1}

\usetheme{Darmstadt}
\usecolortheme{seahorse}

\begin{document}

\begin{frame}[plain]
  \begin{block}{\centering\begin{tabularx}{1\textwidth}{@{}p{0.56\textwidth}@{}X@{}X@{}}\textcolor{white}{Header 1} & \textcolor{white}{Header 2} & \textcolor{white}{Header 3}\end{tabularx}}%
  \centering
    \rowcolors{1}{RowColorOdd}{RowColorEven}%
    \begin{tabularx}{1\textwidth}{@{}p{0.56\textwidth}@{}X@{}X@{}}%
      1.1 & 1.2 & 1.3 \\%
      2.1 & 2.2 & 2.3 \\%
      3.1 & 3.2 & 3.3 \\%
      4.1 & 4.2 & 4.3
    \end{tabularx}%
  \end{block}%
\end{frame}

\end{document}

However, this code results in the following table, where rows are oversized with respects to the block frame:
Result

Any idea how I can fix this ?

Best Answer

for both tabular use:

\begin{tabularx}{\dimexpr\textwidth-2\tabcolsep}{@{}p{0.56\textwidth}@{}X@{}X@{}}%

enter image description here

Related Question