The vertical line at the end of the cell where i used cell merge is missing.
[Tex/LaTex] Table cell vertical line missing
multirowtables
Related Solutions
As said in my comment it is better not to use vertical lines.
Please compare the following two tables. I used your MWE and added the second table. I deleted some code in your MWE not needed for your problem and I did some pretty printing ...
MWE:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{hyperref}
\begin{document}
\begin{longtable}{|l|p{80mm}|}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for
highly variable Grid, MLMMH.} \label{grid_mlmmh} \\
\hline \multicolumn{1}{|c|}{\textbf{Kommun}} & \multicolumn{1}{c|}{\textbf{Klimatanpassning}} \\ \hline
\endfirsthead
\multicolumn{2}{c}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Kommun}} &
\multicolumn{1}{c|}{\textbf{Klimatanpassning}} \\ \hline
\endhead
\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
Arboga & \vspace{-5mm}\begin{itemize}
\item daf
\item asdf
\vspace{-5mm}\end{itemize} \\ \hline
Fagersta & \vspace{-5mm}\begin{itemize}
\item ad
\item df
\vspace{-5mm}\end{itemize}.\\ \hline
\end{longtable}
compare with:
\rowcolors[]{2}{white}{blue!15}
\begin{longtable}{lp{80mm}}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for highly variable Grid, MLMMH.}%
\label{tab:test} \\
\toprule
\multicolumn{1}{c}{\textbf{Kommun}} & \multicolumn{1}{c}{\textbf{Klimatanpassning}} \\
\midrule
\endfirsthead
%\multicolumn{2}{c} {{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\multicolumn{1}{c}{\textbf{Kommun}} & \multicolumn{1}{c}{\textbf{Klimatanpassning}} \\
\midrule
\endhead
\midrule
\multicolumn{2}{r}{{Continued on next page}} \\
\bottomrule
\endfoot
\bottomrule
\endlastfoot
Arboga & \vspace{-5mm}
\begin{itemize}
\item daf
\item asdf
\vspace{-5mm}\end{itemize}
\\
Fagersta & \vspace{-5mm}
\begin{itemize}
\item ad
\item df
\vspace{-5mm}\end{itemize}.\\
Fagersta & \vspace{-5mm}
\begin{itemize}
\item ad
\item df
\vspace{-5mm}\end{itemize}.\\
Fagersta & \vspace{-5mm}
\begin{itemize}
\item ad
\item df
\vspace{-5mm}\end{itemize}.\\
Fagersta & \vspace{-5mm}
\begin{itemize}
\item ad
\item df
\vspace{-5mm}\end{itemize}.\\
\end{longtable}
\end{document}
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.
\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:
\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}
Best Answer
That's not the only problem with your example.
Please note the following examples: