[Tex/LaTex] Missing vertical line in multirow table

multirowtables

I'm trying to make a table, but some vertical lines are missing. Could someone help me to see the mistake?

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{dsfont}
\parindent0em
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{multirow}


\begin{document}

\begin{tabular}{c|c|c|c|c|c|c|c|} 
\cline{2-8} & \multicolumn{1}{c|}{Generacion} & Nombre & Simbolo & Masa(eV) & Espin & Carga($e$) & Color \\ \cline{1-8} 

\multicolumn{1}{ |c| }{\multirow{3}{*}{Quarks} } & \multirow{2}{*}{1a} & UP & 2 & 0 & 1 &5& 5\\
& \multicolumn{1}{ |c| }{} & UP & 2 & 0 & 1 &5& 5\\ \cline{2-8}
\multicolumn{1}{ |c| }{}& \multirow{2}{*}{2a} & UP & 2 & 0 & 1 &5& 5\\  
&\multicolumn{1}{ |c| }{} & UP & 2 & 0 & 1 &5& 5\\ \cline{2-8} 
\multicolumn{1}{ |c| }{} & \multirow{2}{*}{3a} & UP & 2 & 0 & 1 &5& 5\\  
&\multicolumn{1}{ |c| }{} & UP & 2 & 0 & 1 &5& 5\\ \cline{1-8} 
\cline{1-8} 

\multicolumn{1}{ |c| }{\multirow{3}{*}{Leptones} } & \multirow{2}{*}{1a} & UP & 2 & 0 & 1 &5& 5\\
& & UP & 2 & 0 & 1 &5& 5\\ \cline{2-8}
\multicolumn{1}{ |c| }{} & \multirow{2}{*}{2a} & UP & 2 & 0 & 1 &5& 5\\  
& & UP & 2 & 0 & 1 &5& 5\\ \cline{2-8} 
\multicolumn{1}{ |c| }{} & \multirow{2}{*}{3a} & UP & 2 & 0 & 1 &5& 5\\  
& & UP & 2 & 0 & 1 &5& 5\\ \cline{1-8} 
\cline{1-8} 


\multicolumn{2}{|c|}{\multirow{5}{*}{Bosones}} & UP & 2 & 0 & 1 &5& 5\\ 
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\          
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ 
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ \cline{3-8}
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ \cline{3-8}
\cline{1-8} 

\end{tabular}

\end{document}

This is how the table looks

Thanks

Best Answer

An important issue not mentioned in your posting is that the table is too wide to fit inside the text block. This may be remedied by (i) placing the units in two of the header cells in a separate row and (ii) reducing the value of \tabcolsep, the parameter that governs the amount of intercolumn whitespace, by a third (from 6pt to 4pt.

The table code is, I hope you don't mind the criticism, rather cluttered. It may be simplified considerably by (a) setting the structure via

\begin{tabular}{|*{8}{c|}}

and (b) getting rid of the multitude of \multicolumn{1}{ |c| }{} directives. Do also replace all \cline{1-8} directives with \hline and drop the three redundant \cline instructions.

enter image description here

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{dsfont}
\parindent0em
\usepackage{multirow,array}
\begin{document}

\setlength\tabcolsep{4pt} % default value: 6pt

\begin{tabular}{|*{8}{c|}} 
\cline{2-8} 
\multicolumn{1}{c|}{}& Generacion & Nombre & Simbolo & Masa & Espin & Carga  & Color \\ 
\multicolumn{1}{c|}{}& & & & (eV) & ($e$) &  & \\
\hline 
\multirow{3}{*}{Quarks} & \multirow{2}{*}{1a} 
                       & UP & 2 & 0 & 1 &5& 5\\
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\cline{2-8}
& \multirow{2}{*}{2a}  & UP & 2 & 0 & 1 &5& 5\\  
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\cline{2-8} 
& \multirow{2}{*}{3a}  & UP & 2 & 0 & 1 &5& 5\\  
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\hline 
\multirow{3}{*}{Leptones} & \multirow{2}{*}{1a} 
                       & UP & 2 & 0 & 1 &5& 5\\
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\cline{2-8}
& \multirow{2}{*}{2a}  & UP & 2 & 0 & 1 &5& 5\\  
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\cline{2-8} 
& \multirow{2}{*}{3a}  & UP & 2 & 0 & 1 &5& 5\\  
&                      & UP & 2 & 0 & 1 &5& 5\\ 
\hline  
\multicolumn{2}{|c|}{\multirow{5}{*}{Bosones}} 
                       & UP & 2 & 0 & 1 &5& 5\\ 
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\          
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ 
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ 
\cline{3-8}
\multicolumn{2}{|c|}{} & UP & 2 & 0 & 1 &5& 5\\ 
\hline 

\end{tabular}
\end{document}

Optional: All these vertical and horizontal lines do not contribute to the table's legibility and intelligibility; I would assume that these two criteria are important to your work. Dropping all vertical lines, replacing the \cline instructions with a bit of (vertical) whitespace, and using the rule-drawing macros (\toprule, \midrule, and \bottomrule) of the booktabs package gives you the following look -- I hope you will agree that it looks at least as good as the table above:

enter image description here

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{dsfont}
\parindent0em
\usepackage{multirow,array,booktabs}
\begin{document}
\setlength\tabcolsep{4pt}

\begin{tabular}{@{}l*{7}{c}@{}} 
\toprule 
& Generacion & Nombre & Simbolo & Masa & Espin & Carga  & Color \\ 
& & & & (eV) & ($e$) &  & \\
\midrule 
\multirow{3}{*}{Quarks}  & \multirow{2}{*}{1a} & UP & 2 & 0 & 1 &5& 5\\
& & UP & 2 & 0 & 1 &5& 5\\ \addlinespace
& \multirow{2}{*}{2a} & UP & 2 & 0 & 1 &5& 5\\  
& & UP & 2 & 0 & 1 &5& 5\\ \addlinespace 
& \multirow{2}{*}{3a} & UP & 2 & 0 & 1 &5& 5\\  
&{} & UP & 2 & 0 & 1 &5& 5\\ 
\midrule 
\multirow{3}{*}{Leptones}  & \multirow{2}{*}{1a} & UP & 2 & 0 & 1 &5& 5\\
& & UP & 2 & 0 & 1 &5& 5\\ 
\addlinespace
& \multirow{2}{*}{2a} & UP & 2 & 0 & 1 &5& 5\\  
& & UP & 2 & 0 & 1 &5& 5\\ 
\addlinespace 
 & \multirow{2}{*}{3a} & UP & 2 & 0 & 1 &5& 5\\  
& & UP & 2 & 0 & 1 &5& 5\\ 
\midrule  
\multicolumn{2}{c}{\multirow{5}{*}{Bosones}} & UP & 2 & 0 & 1 &5& 5\\ 
&  & UP & 2 & 0 & 1 &5& 5\\          
&  & UP & 2 & 0 & 1 &5& 5\\ 
&  & UP & 2 & 0 & 1 &5& 5\\ 
\addlinespace
&  & UP & 2 & 0 & 1 &5& 5\\ 
\bottomrule 
\end{tabular}

\end{document}