4

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})?

4

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}
  • Here you are the packages used: \documentclass[a4paper,12pt]{report} \usepackage[english]{babel} \usepackage[latin1]{inputenc} \usepackage[pdftex]{graphicx} \usepackage{graphicx} \usepackage{wrapfig} \usepackage{float} \usepackage[small]{caption} \usepackage{color} \usepackage{fancyhdr} \pagestyle{fancy} \lhead{} \chead{} \rhead{} \lfoot{} \cfoot{\thepage} \addtolength{\oddsidemargin}{+1,3cm} \addtolength{\evensidemargin}{-1,3cm} \renewcommand{\familydefault}{\sfdefault} \begin{document} And here's the result of your code:link – n0n4m3 Apr 15 '13 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.