5

I am having trouble with generating a proper latex table. I am currently using the following code:

\begin{tabular}{|c|c|c|c|}
\hline
Application and Activity Name                                                                & Original \textbackslash Faulted & Activity Classified as:          & \multicolumn{1}{c|}{Functional Bugs Discovered}                                                                                                                                                                                                                                                                                       \\ \hline
\multirow{6}{*}{\begin{tabular}[c]{@{}c@{}}K-9Mail:\\ MessageList\end{tabular}}              & Original                        & \multirow{5}{*}{Mail Activity}   & \begin{tabular}[c]{@{}l@{}}1 bug has been found:\\ \# Sending an email with invalid\\             recipient address - Failed\end{tabular}                                                                                                                                                                                                      \\ \cline{2-2} \cline{4-4} 
                                                                                             & \multirow{5}{*}{Faulted}        &                                  & \multirow{5}{*}{\begin{tabular}[c]{@{}l@{}}4 bugs have been found:\\ \# Opening an email from the inbox\\    mails list - Failed\\ \# Sending an email without\\    recipient address - Failed\\ \# Sending an email with invalid\\    recipient address - Failed\\ \# Sending and receiving a valid\\    mail - Failed\end{tabular}} \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                 \\ \\ \\ \\ \\ \hline 
\multirow{6}{*}{\begin{tabular}[c]{@{}c@{}}K-9Mail:\\ setup.AccountSetupBasics\end{tabular}} & Original                        & \multirow{6}{*}{Login Activity}  & No bugs have been found                                                                                                                                                                                                                                                                                                               \\ \cline{2-2} \cline{4-4} 
                                                                                             & \multirow{5}{*}{Faulted}        &                                  & \multirow{5}{*}{\begin{tabular}[c]{@{}l@{}}3 bugs have been found:\\ \# Login without username and\\    password - Failed\\ \# Login with wrong username\\    and password - Failed\\ \# Login with valid username\\    and password - Failed\end{tabular}}                                                                           \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\ \\ \\ \hline
\multirow{6}{*}{\begin{tabular}[c]{@{}c@{}}CrimeTalk:\\ MainActivity\end{tabular}}           & Original                        & \multirow{6}{*}{Portal Activity} & No bugs have been found                                                                                                                                                                                                                                                                                                               \\ \cline{2-2} \cline{4-4} 
                                                                                             & \multirow{5}{*}{Faulted}        &                                  & \multirow{5}{*}{\begin{tabular}[c]{@{}l@{}}3 bugs have been found:\\ \# Browsing through the portal's\\    sections by swiping it left \\    and right - Failed\\ \# Switching between the portal's\\    tabs - Failed\\ \# Opening an article - Failed\end{tabular}}                                                                 \\ 
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\
                                                                                             &                                 &                                  &                                                                                                                                                                                                                                                                                                                                       \\ \\ \\ \hline
\end{tabular}

However, the table which I am getting is this one: enter image description here

As can be seen, this table has missing border in some of its places. Can someone please correct my code to fix this problem? I have tried hours to solve it without any luck.

Any help will be much appreciated.

Thanks in advance, Orel.

5

Here's a solution that operates with a dedicated, compact itemize-like environment for the items in the fourth column.

enter image description here

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably

\usepackage{multirow}

\usepackage{tabularx,ragged2e}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\setlength\extrarowheight{2pt}

\usepackage{enumitem}
%% Setup a compact ittemize-like env.
\newlist{mylist}{itemize}{1}
\setlist[mylist]{label=\#,
                 nosep, wide, leftmargin=*,
                 before=\vspace{-0.57\baselineskip},
                 after =\vspace{-0.85\baselineskip}}

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{|c|c|c|Y|}
\hline
Application and Activity Name                                                                & Original\slash Faulted 
& Activity Classified as:
& Functional Bugs Discovered \\ 
\hline
\multirow{6}{*}{%
    \begin{tabular}[c]{@{}c@{}}
    K-9Mail:\\ 
    MessageList
    \end{tabular}}
& Original
& \multirow{5}{*}{Mail Activity}   
& \begin{tabular}[c]{@{}Y@{}}
  1 bug was found:\\
  \begin{mylist}
  \item Sending an email with invalid recipient address~-- Failed
  \end{mylist}
\end{tabular} \\ 
\cline{2-2} \cline{4-4} 
& \multirow{5}{*}{Faulted} 
&
& \begin{tabular}[c]{@{}Y@{}}
  4 bugs were found:\\
  \begin{mylist}
  \item Opening an email from the inbox mails list~-- Failed
  \item Sending an email without recipient address~-- Failed
  \item Sending an email with invalid recipient address~-- Failed
  \item Sending and receiving a valid mail~-- Failed
  \end{mylist}
\end{tabular} \\ 
\hline 
\multirow{6}{*}{%
   \begin{tabular}[c]{@{}c@{}}
   K-9Mail:\\ 
   setup.AccountSetupBasics
   \end{tabular}} 
& Original
& \multirow{6}{*}{Login Activity}  
& No bugs were found                                                                                                                                                                                                                                                                                                               \\ 
\cline{2-2} \cline{4-4}
& \multirow{5}{*}{Faulted}
&
& \begin{tabular}[c]{@{}Y@{}}
  3 bugs were found:\\ 
  \begin{mylist}
  \item Login without username and password~-- Failed
  \item Login with wrong username and password~-- Failed
  \item Login with valid username and password~-- Failed
  \end{mylist}
\end{tabular} \\
\hline
\multirow{6}{*}{\begin{tabular}[c]{@{}c@{}}
    CrimeTalk:\\ 
    MainActivity
    \end{tabular}}
& Original
& \multirow{6}{*}{Portal Activity} 
& No bugs were found                                                                                                                                                                                                                                                                                                               \\ 
\cline{2-2} \cline{4-4}
& \multirow{5}{*}{Faulted}
&
& \begin{tabular}[c]{@{}Y@{}}
  3 bugs were found:\\
  \begin{mylist}
  \item Browsing through the portal's sections by swiping it left and right~-- Failed
  \item Switching between the portal's tabs~-- Failed
  \item Opening an article~-- Failed
  \end{mylist}
\end{tabular} \\ 
\hline
\end{tabularx}
\end{document}
  • Thank you very much, this is exactly what I wanted. Much appreciated. – Orel Mar 19 '18 at 12:09
3

The missing lines seem to be caused by your usage of \multirow in combination with all the empty rows. A corrected code of the first third of your table would be the following:

\documentclass{report}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|c|c|c|c|}
\hline
Application and Activity Name                                                                & Original \textbackslash Faulted & Activity Classified as:          & \multicolumn{1}{c|}{Functional Bugs Discovered}                                                                                                                                                                                                                                                                                       \\ \hline
\multirow{10}{*}{\begin{tabular}[c]{@{}c@{}}K-9Mail:\\ MessageList\end{tabular} }             & Original                        & \multirow{10}{*}{Mail Activity}   & \begin{tabular}[c]{@{}l@{}}1 bug has been found:\\ \# Sending an email with invalid\\             recipient address - Failed\end{tabular}                                                                                                                                                                                                      \\ \cline{2-2} \cline{4-4} 
                                                                                             & \multirow{2}{*}{Faulted}        &                                  & \begin{tabular}[c]{@{}l@{}}4 bugs have been found:\\ \# Opening an email from the inbox\\    mails list - Failed\\ \# Sending an email without\\    recipient address - Failed\\ \# Sending an email with invalid\\    recipient address - Failed\\ \# Sending and receiving a valid\\    mail - Failed\end{tabular} \\
\hline 
\end{tabular}
\end{document}

enter image description here

Nevertheless, the table still does not fit onto a portrait page and looks somewhat cramped due to all the vertical and horizontal lines. A redesign could look like the following:

enter image description here

\documentclass{report}
\usepackage{array}
\usepackage{tabularx}
\usepackage{booktabs}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{L{2.5cm}L{2cm}L{2cm}>{\raggedright\arraybackslash}X}
\toprule
Application and Activity Name   & Activity Classified as:   & Original \textbackslash Faulted & Functional Bugs Discovered \\
\midrule
K-9Mail: \newline MessageList  &  Mail \newline Activity   &Original  & 1 bug has been found:\newline \# Sending an email with invalid recipient address - Failed \\
\cmidrule{3-4}
 &  & Faulted   & 4 bugs have been found:\newline \# Opening an email from the inbox mails list - Failed\newline  \# Sending an email without recipient address - Failed\newline  \# Sending an email with invalid recipient address - Failed\newline  \# Sending and receiving a valid mail - Failed \\
\bottomrule
\end{tabularx}
\end{document}
  • Thank you very much, it does look better. Much appreciated. – Orel Mar 19 '18 at 12:11
2

Another solution, also based on tabularx and enumitem, with no nested tabular, but using makecell instead, since it allows for linebreaks in standard cells:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{float}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{tabularx, multirow, makecell}
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{label=\#, noitemsep, topsep=2pt, wide=0pt, after=\vspace*{\dimexpr\topsep + \partopsep-\baselineskip}}

\begin{document}

\noindent\setlength{\extrarowheight}{3pt}
\begin{tabularx}{\linewidth}{|c|c|c| >{\arraybackslash}X|}
\hline
\makecell{Application and\\ Activity Name} & \makecell{Original\\ \textbackslash Faulted} & \makecell{Activity\\ Classified as:} & \multicolumn{1}{c|}{Functional Bugs Discovered} \\
\hline
\multirowcell{11}{K-9Mail:\\ MessageList} & Original & \multirowcell{11}{Mail Activity} & 1 bug has been found:\begin{tabitemize}\item Sending an email with invalid recipient address – Failed \end{tabitemize}\\
\cline{2-2} \cline{4-4}
 & \multirowcell{5}{Faulted} &
 & 4 bugs have been found:\begin{tabitemize}
 \item Opening an email from the inbox mails list – Failed
 \item Sending an email without recipient address – Failed
 \item Sending an email with invalid recipient address – Failed
 \item Sending and receiving a valid mail – Failed
\end{tabitemize}
 \\ \hline
\multirowcell{7.5}{K-9Mail:\\ setup.AccountSetupBasics} & Original & \multirowcell{7.5}{Login Activity} & No bugs have been found \\ \cline{2-2} \cline{4-4}
 & \multirowcell{5.5}{Faulted} & & 3 bugs have been found: \begin{tabitemize}
 \item Login without username and password – Failed
 \item Login with wrong username and password – Failed
 \item Login with valid username and password – Failed
 \end{tabitemize}
\\ \hline
\multirowcell{7.5}{CrimeTalk:\\ MainActivity} & Original & \multirowcell{7.5}{Portal Activity} & No bugs have been found \\
\cline{2-2} \cline{4-4}
 & \multirowcell{5.5}{Faulted} & & 3 bugs have been found: \begin{tabitemize}
 \item Browsing through the portal's sections by swiping it left and right – Failed
 \item Switching between the portal's tabs – Failed
 \item Opening an article – Failed
 \end{tabitemize}
 \\ \hline
\end{tabularx}

\end{document}

enter image description here

  • Adding another upvote.+1. – Sebastiano Mar 18 '18 at 22:15

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.