I have tried a few different solutions for automatic line breaks within tables in LaTeX. Below is an example of a tabular list using my most elaborate method so far. It looks alright in PDF, but it still throws several warnings. One or two entries may still be so long that they're escaping the specified text width, which means that line breaks aren't working as intended. How can I get proper and reliable automatic line breaks within tables in LaTeX?
\begin{center}
\begin{tabular*}{\columnwidth}{ @{\extracolsep{\fill}} p{0.5\columnwidth}p{0.5\columnwidth}}
Matrikel-Nr: & 1234567\\
E-Mail: & xxxxxxxx.xxxxxxxx@xxx-xxxxxxxxx.xx\\
& \\
{\bf Seminar} & {\bf Dozent:in}\\
123456 Einführung in die Statistik mit R & Dr. Xxxxxx Xxxxxxxxx\\
123456 Einführung experimentelle Methoden & Dr. Xxxxxx Xxxxxxxxx\\
123456 Aufbaukurs quan\-ti\-ta\-ti\-ve Methoden & Dr. Xxxxxx Xx\-xxxx\-xxxxxxx\\
& \\
Xxxxxxxxx, \today & \\
\end{tabular*}
\end{center}
The warnings I get when compiling this are the following:
Underfull \hbox (badness 10000) in paragraph at lines 66--67
Underfull \hbox (badness 1122) in paragraph at lines 69--69
Underfull \hbox (badness 2582) in paragraph at lines 70--70
Overfull \hbox (17.99998pt too wide) in alignment at lines 64--74
(The segment above corresponds to lines 63--75 in my file)
Preamble:
\documentclass[twoside,openright,12pt]{report}
\usepackage{latexsym}
\usepackage[dvips]{graphics}
\usepackage{pgf}
\usepackage{multicol}
\usepackage[german]{babel}
\usepackage{linguex}
\usepackage{hyperref}
\usepackage{fontspec}
\usepackage{tabularx}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}
\usepackage{makecell}
\setmainfont[BoldFont={Gentium Basic Bold},ItalicFont={Gentium Plus Italic}, BoldItalicFont={Gentium Basic Bold Italic}]{Gentium Plus}
\usepackage[scaled]{helvet}
\usepackage{apacite}
\usepackage{fancyhdr}
% set up page size.
\sloppy
\setlength{\textwidth}{15cm}
\setlength{\oddsidemargin}{42pt}
\setlength{\evensidemargin}{-22pt}
\setlength{\headheight}{15pt}
\bf
with\bfseries
. For some background information, see also: “Correct” way to bold/italicize text? – leandriis Feb 19 at 18:16\begin{tabular}{@{}p{\dimexpr 0.5\linewidth-\tabcolsep}p{\dimexpr 0.5\linewidth-\tabcolsep}@{}}
or\begin{tabularx}{\linewidth}{@{}XX@{}}
(needs thetabularx
package) should work without warnings. – leandriis Feb 19 at 18:19