[Tex/LaTex] Automatic line-breaks in tables

line-breakingtables

I'm writing a short tabular CV that I have to add to my thesis. I thought a quick way would be to use a table for that purpose:

\begin{tabular}{ll}
2009-present           & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\
2009  & Masters\\
2006  & Bachelors\\
\end{tabular}

Unfortunately, LaTeX does not break the lines at the spaces. The only solutions I found so far, are

  • "adding additional rows to the table"
  • "use fixed table size + \newline".

Manually adjusting texts is not very efficient.

Is there also a way to automate this (e.g. by define a cell/column as "text-cell/column")?

\begin{tabular}{lp{12cm}}
2009-present           & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\
2009  & Masters\\
2006  & Bachelors\\
\end{tabular}

Could be a solution, but the right column does not automatically reach the right "border" of the page.

Best Answer

As requested, an answer with tabularx. I also added a solution with listliketab. I still prefer a description list because of the vertical alignment.

Code

\documentclass{article}
\usepackage{tabularx}
\usepackage{listliketab}
\usepackage{lipsum} % only for this example
\begin{document}
\lipsum[2]
\medskip

\noindent
\begin{tabularx}{\linewidth}{@{}>{\bfseries}l@{\hspace{.5em}}X@{}}
    2009--present & very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10 \\
    2009          & Masters                                                                                                                                                                              \\
    2006          & Bachelors
\end{tabularx}

\medskip
\lipsum[2]
\begin{description}
    \item[2009--present] very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10
    \item[2009]          Masters
    \item[2006]          Bachelors
\end{description}

\lipsum[2]
\storestyleof{description}
\begin{listliketab}
  \begin{tabularx}{\linewidth}{@{}>{\bfseries}l @{\hspace{.5em}} XR}
    2009--present & very long text 1, very long text 2, very long text 3, very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10 \\
    2009          & Masters                                                                                                                                                                              \\
    2006          & Bachelors
  \end{tabularx}
\end{listliketab}

\lipsum[2]
\end{document}

Output

enter image description here

Related Question