[Tex/LaTex] Tabular and itemize

itemizeliststables

I'm having a big problem…I am trying to make a nice table which in the left side has just text and in the right part it may contain some itemized elements. This is how i'm doing it:

\documentclass[a4paper,12pt]{report}
...
\begin{tabular}{r| p{5cm}}
  {\bf Text} &
  Data \\ \hline
  {\bf Itemization} &
  \begin{itemize}
    \item{item1}
    \item{item2}
  \end{tabular}
  \\ \hline
\end{tabular}

But like this the \hline will be 5cm long. Is there a way of making it as long as the top bar (the one who comes from \documentclass{report})?

Best Answer

Please always provide complete documents showing packages used (the report class doesn't use a ruled headline by default for example). Also \bf shouldn't be used unless you are aiming fro LaTeX2.09 compatibility.

You just need to make the table full width using tabular* for example:

enter image description here

\documentclass[a4paper,12pt]{report}
\usepackage{array}
\setlength\extrarowheight{2pt}
\begin{document}

\hrule

\bigskip

xx x x x x

\bigskip


\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}r| p{5cm}@{}}
  \textbf{Text} &
  Data \\ \hline
  \textbf{Itemization} &
  \mbox{}\par\vspace{\dimexpr-\baselineskip-\topsep-\partopsep\relax}
  \begin{itemize}
    \item item1
    \item item2
    \end{itemize}
    \par\vspace{\dimexpr-\baselineskip-\topsep-\partopsep\relax}
    \mbox{}\\ \hline
\end{tabular*}

\end{document}