# hline in nested table

I have a really complex table in my opinion which is why im running into some Problems here. I used a nested table because I had Problems when using the \multirow and \cellcolor / \rowcolor command. However the Problem now is that the \hline is not reaching to either the left and right side of the outer table. The Picture below Shows the Problem:

How can i solve this Problem? Does someone has a better solution for this Kind of table?

This is the code:

\documentclass{article}

\usepackage{colortbl}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{booktabs}

\definecolor{Beige}{RGB}{219,212,192}
\definecolor{Table}{RGB}{246,244,239}

\begin{document}
\begin{table}
\centering
\begin{tabular}{|p{0.4cm}|p{6.7cm}|p{1cm}|p{1cm}|p{1cm}|p{2cm}|}
\hline
\rowcolor{Beige}
\multicolumn{6}{|l|}{\textbf{B1 Eingabefelder}} \\ \hline
\rowcolor{Table}
Nr. & Beschreibung & \multicolumn{4}{l|}{
\begin{tabular}{@{}>{\centering\arraybackslash}m{1cm}|>{\centering\arraybackslash}m{1cm}|>{\centering\arraybackslash}m{1cm}|>{\centering\arraybackslash}m{2cm}@{}}
\multicolumn{4}{l}{Kommentare / Verhaltensweisen} \\ \hline
H & A & B & Schweregrad \\
\end{tabular}
} \\ \hline
~ & ~ & \multicolumn{4}{l|}{} \\ \hline
\end{tabular}
\end{table}
\end{document}

• Please always post complete test documents so people can test their answers. However your \bgroup, \egroup around the nested table is not doing anything replace it by \kern-\tabcolsep\begin{tabular.....\end{tabular}\kern-\tabcolsep to counteract the padding in the outer table cell – David Carlisle Jan 10 '14 at 11:52
• or simpler use \multicolumn{4}{@{}l@{}|}{ – David Carlisle Jan 10 '14 at 11:59
• edit your code example so it starts with \documentclass and ends with \end{document} then it's far more likely that people will test their answers. It should have worked, did you leave a space (or newline) before the second kern, if so, don't:-) – David Carlisle Jan 10 '14 at 12:15
• Your example still can not be run through latex without error: don't make people have to reverse engineer the list of required packages. Please always post complete documents. – David Carlisle Jan 10 '14 at 12:21
• No you miss the point: we don't want to see your thesis, it is just that you rather than everyone trying to help should add the 2 or 3 or 6 lines it takes so that that example runs. You are using commands from unspecified packages (some of which I recognise as mine, but still I shouldn't have to guess, and neither should anyone else) Or better remove any commands from packages unrelated to the problem and make a simper test file that still shows the effect. – David Carlisle Jan 10 '14 at 12:27

In addition to working on the contents of the table, I've had to make some informed guesses as to the likely contents of the preamble. The code below may or may not conform to your document's requirements.

Regarding the tabular environment, the changes I've applied can be summarized as follows:

• comment out some unneeded instructions

• add some @{} directives here and there

There were some instructions, such as \phantom{.}, whose purpose I couldn't fathom but didn't comment out since they seem to do no harm.

\documentclass[a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[table,svgnames]{xcolor}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|p{0.4cm}|p{6.7cm}|p{1cm}|p{1cm}|p{1cm}|p{2cm}|}
\hline
\rowcolor{Beige}
\multicolumn{6}{|l|}{\textbf{B1 Eingabefelder}} \\
\hline
%\rowcolor{Table}
Nr. & Beschreibung & \multicolumn{4}{@{}l@{}|}{
%\bgroup
\begin{tabular}{@{}>{\centering\arraybackslash}m{1cm}|
>{\centering\arraybackslash}m{1cm}|
>{\centering\arraybackslash}m{1cm}|
>{\centering\arraybackslash}m{2.5cm}@{}}
\multicolumn{4}{@{}c@{}}{Kommentare / Verhaltensweisen} \\
\hline
H & A & B & Schweregrad \\
\end{tabular}
%\egroup
} \\
\hline
\hiderowcolors
\multirow{7}{0.4cm}{ 1} &
\multirow{7}{6.7cm}{Der vordefinierte Text <Pflichtfeld> behindert die Nutzer bei der Eingabe von erforderlichen Daten wie z.B. Name, Kurzeichen und UserID beim Anlegen von Personen im System. Der Inhalt der betroffenen Eingabefelder wird nicht automatisch beim Fokussieren gelöscht. Dies wird durch den Nutzer z.B. durch Markieren manuell erledigt.} & \multicolumn{4}{l|}{\multirow{5}{5cm}{„Ich ärgere mich jedes Mal, dass da <Pflichtfeld> vorbelegt ist.“
\newline\newline
„Ganz blöd ist, dass ich das jetzt erst alles markieren muss.“ \phantom{.}}} \\
& &  \multicolumn{4}{l|}{} \\
& &  \multicolumn{4}{l|}{} \\
& &  \multicolumn{4}{l|}{} \\
& &  \multicolumn{4}{l|}{} \\
& &  \multicolumn{4}{l|}{} \\ \cline{3-6}
& &  \centering 6 & \centering 2 & \centering 3 & \centering\arraybackslash 6,57 \\
\hline
\showrowcolors
\end{tabular}
\end{table}
\end{document}

• +1 (you're kinder than I am, testing the result before the full MWE was posted:-) – David Carlisle Jan 10 '14 at 12:56
• So the rowcolor does not work right? Is there a way i can still Color the second row? – LordTribual Jan 10 '14 at 12:58
• @LordTribual rowcolour should colour behind the \multicolumn as long as you have a recent \colortbl (from last year rather than last century) Note that Mico wrote this before you had posted a document that defined the colour Table, which is probably why he commented it out) – David Carlisle Jan 10 '14 at 13:42
• @LordTribual - I posted this answer before you provided information on how the color "Table" was defined, so I had to comment out the instruction \rowcolor{Table}. If you add the instruction \definecolor{Table}{RGB}{246,244,239} to the preamble, you can also reinstate \rowcolor{Table}. – Mico Jan 10 '14 at 15:01