# minipage wrapping tabularx overfull box

1. The line Zur Erläuterung der... should introduce the following list. This produces an underfull hbox and I just can't get rid of it.

2. To keep the content together on one page I found the solution in some post to wrap everything into a minipage.Is this the right procedure? Because this causes overfull boxes of about 104pt.

3. The same for the tabular inside. It actually looks like expected, but the warnings drive me crazy...

I noticed the problem with the minipages a few times in my doc already. And I try to work with linewidth always... One thing to add before: I globally set no indent in my preamble already. Here's my code:

\documentclass[
paper=a4,
parskip=half*   %vertikaler Abstand nach Absätzen
]{scrreprt}

\tolerance=2000
\emergencystretch=1em
\hfuzz=2pt
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tabularx}

\begin{document}
\noindent\begin{minipage}{\linewidth}
Zur Erläuterung der Vorgehensweise definiert Bechmann die folgenden Variablen:

\begin{tabularx}{\linewidth}{p{.35\linewidth}X}
$K_1,K_2,\dots,K_n$ & die n Kriterien, bezüglich der bewertet werden soll.\\
$A_1,A_2,\dots,A_m$ & die m verschiedenen Alternativen, die bewertet werden sollen.\\
$g_1,g_2,\dots,g_n$ & Gewichte der Kriterien\\
$k_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielertrag des i-ten Kriteriums bezüglich der j-ten Alternative\\
$e_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielerfüllungsgrad des i-ten Kriteriums\\
$N_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Teilnutzwert des i-ten Kriteriums bezüglich der j-ten Alternative\\
$N_j$ $j=1,\dots,m$ & Nutzwert der j-ten Alternative\\
\end{tabularx}

\vskip .5em
es gilt dabei $N_{ij}=g_i*e_{ij}$ \\ und $N_j=N_{1j}+N_{2j}+\dots+N_{nj}=\displaystyle\sum_{i=1}^{n}N_{ij}$
\end{minipage}
\end{document}


BTW: in case of any relevance: I use TexStudio 2.10.6 and MikTeX 2.9

• why do you use \\ before tabularx ? – touhami Feb 7 '16 at 21:29
• @Eric: You should provide the document around this table, i.e. at least the compilable version that has this table. – user31729 Feb 7 '16 at 21:41
• If add before \begin{minipage} command \noindent, the overfull mesage will disappear. – Zarko Feb 7 '16 at 21:42
• using \displaystyle in the middle of an equation is very weird, it means the lhs is set as inline math and the whole of the right hand side is set as display, – David Carlisle Feb 7 '16 at 22:59
• note that your first sentence has the correct solution. this is a list and would be better set as such and not use tabular (and definitely not tabularx) at all here, – David Carlisle Feb 7 '16 at 23:01

As I said in my comment, you have problem with \parindent. Your minipage widt with of \textwidth doesn't start at left text border bit after parindent and consequently for its amount protrude right text border caused warning Overfull \hbox (15.0pt too wide) in paragraph at lines 9--31. I f you add before begin{minipage}˛ a command \noindent or set \parindent to zero, this warning disappear:

\documentclass{article}
\usepackage{tabularx}
%\setlength{\parindent}{0pt}

\usepackage[showframe]{geometry}

\begin{document}
\noindent
\begin{minipage}{\textwidth}
Zur Erläuterung der Vorgehensweise definiert Bechmann die folgenden Variablen:

\vspace{\baselineskip}
\begin{tabularx}{\linewidth}{lX}
$K_1,K_2,\dots,K_n$ & die $n$ Kriterien, bezüglich der bewertet werden soll.\\
$A_1,A_2,\dots,A_m$ & die $m$ verschiedenen Alternativen, die bewertet werden sollen.\\
$g_1,g_2,\dots,g_n$ & Gewichte der Kriterien\\
$k_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$
& Zielertrag des $i$-ten Kriteriums bezüglich der j-ten Alternative\\
$e_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$
& Zielerfüllungsgrad des $i$-ten Kriteriums\\
$N_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$
& Teilnutzwert des $i$-ten Kriteriums bezüglich der $j$-ten Alternative\\
$N_j$ $j=1,\dots,m$ & Nutzwert der $j$-ten Alternative\\
\end{tabularx}

\vskip .5\baselineskip
es gilt dabei $N_{ij}=g_i*e_{ij}$

und $N_j=N_{1j}+N_{2j}+\dots+N_{nj}=\displaystyle\sum_{i=1}^{n}N_{ij}$
\end{minipage}
\end{document}


Edit: I corrected some typing error in given MWE. Also let be noted: if you like to start the table content of the first column at left border of mini page, than you should do the following

\begin{tabularx}{\linewidth}{@{}lX}


Proposed solution also works with your document class (added at completing of your MWE: \documentclass[paper=a4,parskip=half*]{scrreprt}

Edit (2): Here is image of your minipage generated with your MWE.

I also add missing part of your example (I'm sorry for this)

• also this code still produces overfull boxes... – Eric Feb 7 '16 at 22:12
• No. I didn't find anything in .log file. For test erase old .aux and .log file and then compile my code again. You will not find any warning. – Zarko Feb 7 '16 at 22:32
• I updated my code into a MWE and noticed that it is attributed to the parskip=half* setting. But is there a solution to keep the setting and fix the prob? – Eric Feb 7 '16 at 22:35
• I compile your MWE. It doesn't give any warning about overfull boxes. However, I get warning about babel (in my system since I haven't installed babel for "ngerman"), but his is not a question, isn't it? – Zarko Feb 7 '16 at 22:42
• this is weired... I deleted my log and aux files and compiled it again with an overfull box. Watch the picture I inserted above. – Eric Feb 7 '16 at 22:52

1) \noindent\begin{minipage}

2) no need to \\ befor tabularx if necessary

\makebox[\linewidth]{Zur Erläuterung der Vorgehensweise definiert Bechmann die folgenden Variablen:}

3) p{.3\linewidth}

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent\begin{minipage}{\linewidth}
\makebox[\linewidth]{Zur Erläuterung der Vorgehensweise definiert Bechmann die folgenden Variablen:}
\begin{tabularx}{\linewidth}{p{.3\linewidth}X}
$K_1,K_2,\dots,K_n$ & die n Kriterien, bezüglich der bewertet werden soll.\\
$A_1,A_2,\dots,A_m$ & die m verschiedenen Alternativen, die bewertet werden sollen.\\
$g_1,g_2,\dots,g_n$ & Gewichte der Kriterien\\
$k_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielertrag des i-ten Kriteriums bezüglich der j-ten Alternative\\
$e_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielerfüllungsgrad des i-ten Kriteriums\\
$N_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Teilnutzwert des i-ten Kriteriums bezüglich der j-ten Alternative\\
$N_j$ $j=1,\dots,m$ & Nutzwert der j-ten Alternative\\
\end{tabularx}

\vskip .5em
es gilt dabei $N_{ij}=g_i*e_{ij}$ \\ und $N_j=N_{1j}+N_{2j}+\dots+N_{nj}=\displaystyle\sum_{i=1}^{n}N_{ij}$
\end{minipage}
\end{document}

• thx, but this code still produces overfull boxes for me – Eric Feb 7 '16 at 22:11
• I updated my code above and still having trouble with the overfull boxes... – Eric Feb 7 '16 at 22:22

Please include full minimal working examples including the relevant packages you use.

Your code produces both an underfull and overfull box. I don't think creating a minipage is really helping here. I can recommend wrapping the \tabularx{} environment into a \table{} environment which in your example doesn't produce any overfull boxes. Also the geometry package helps if you want to change the width of your page.

  \documentclass{article}
\usepackage[top=4cm, bottom=3cm, left=3cm, right=4cm]{geometry}
\usepackage{tabularx}
\begin{document}
\begin{table}
Zur Erläuterung der Vorgehensweise definiert Bechmann die folgenden Variablen: \\[0.5cm]
\begin{tabularx}{\linewidth}{p{.35\linewidth}X}
$K_1,K_2,\dots,K_n$ & die n Kriterien, bezüglich der bewertet werden soll.\\
$A_1,A_2,\dots,A_m$ & die m verschiedenen Alternativen, die bewertet werden sollen.\\
$g_1,g_2,\dots,g_n$ & Gewichte der Kriterien\\
$k_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielertrag des i-ten Kriteriums bezüglich der j-ten Alternative\\
$e_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Zielerfüllungsgrad des i-ten Kriteriums\\
$N_{ij}$ $i=1,\dots,n$ $j=1,\dots,m$ & Teilnutzwert des i-ten Kriteriums bezüglich der j-ten Alternative\\
$N_j$ $j=1,\dots,m$ & Nutzwert der j-ten Alternative\\
\end{tabularx}
\vskip .5em
es gilt dabei $N_{ij}=g_i*e_{ij}$ und $N_j=N_{1j}+N_{2j}+\dots+N_{nj}=\displaystyle\sum_{i=1}^{n}N_{ij}$
\end{table}
\end{document}


Edit: Turns out the \table{} wrap doesn't really fix the overfull hbox. Rather the geometry package fixed it by broaden the sitewidth which might not be a suitable solution. However overfull hboxs could usually be fixed by forced hypothenation using \- in the first sentence of the given example.

• when I add a table environment for some reason the overfull-box warning disappears... why this doesn't really fix the problem? – Eric Feb 7 '16 at 22:09
• It does fix it by using the package mentioned in my answer. The answers from the other guys are more suitable, check them out. – Octopus Feb 7 '16 at 22:13

Often the described symptoms are caused by the parskip indent. In this obvious case it can easily be solved by setting either locally \noindent before the respective paragraph or in a general manner as global definition by \setlength{\parindent}{0pt}.

In my specific case the issue was produced by the document class option parskip=half* of the KOMA-Script. I noticed this as I commented the parksip=half* out and found the solution on page 71 of the KOMA-Script manual.

half*

half a line vertical space between paragraphs; there must be at least a quarter of a line free space at the end of a paragraph

The problem was the second condition: "at least a quarter of a line free space at the end of a pargraph".

half-

one line vertical space between paragraphs

Therefore I switched to the half- command to keep the vertical space and get rid of the overfull boxes.

I hope this helps others with the same problem.