latextabular

Latex - Uncomplete vertical line on tabular


I'm trying to make a bit tricky table in Latex using tabular, I wrote the following code :

\begin{tabular}{|c|c|c|c|c|}
        \hline
        n° structure & n° hexagone & valeur circuit & $R(K_i)$ & $E(B)$\\
        \hline
        \multirow{3}{*}{$K_1$} & $h_1$ & $R_1$ & \multirow{3}{*}{$2R_1 + R_2 = 1.984$} & \multirow{12}{*}{$\frac{6R_1 + 4R_2 + 2R_3}{4} = 1.5995$}\\
                           & $h_2$ & $R_1$ & \\
                           & $h_3$ & $R_2$ & \\
        \cline{1-4}
        \multirow{3}{*}{$K_2$} & $h_1$ & $R_1$ & \multirow{3}{*}{$R_1 + R_2 + R_3 = 1.215$} \\
                           & $h_2$ & $R_2$ & \\
                           & $h_3$ & $R_3$ & \\
        \cline{1-4}
        \multirow{3}{*}{$K_3$} & $h_1$ & $R_2$ & \multirow{3}{*}{$2R_1 + R_2 = 1.984$} \\
                           & $h_2$ & $R_1$ & \\
                           & $h_3$ & $R_1$ & \\
        \cline{1-4}
        \multirow{3}{*}{$K_4$} & $h_1$ & $R_3$ & \multirow{3}{*}{$R_1 + R_2 + R_3 = 1.215$} \\
                           & $h_2$ & $R_2$ & \\
                           & $h_3$ & $R_1$ & \\
        \hline
    \end{tabular}

And I got the following output, I really don't understand why the last vertical line isn't complete :

enter image description here

Does someone known the origin of the problem ? Cordialy.


Solution

  • Your table would look much more professional if you would not use vertical lines. See e.g. the documentation of the booktabs package for more information about creating good looking tables.

    If you insist on vertical lines, you must make sure that each row has the same number of cells:

    \documentclass{article}
    \usepackage{multirow}
    
    \begin{document}
    
    \begin{tabular}{|c|c|c|c|c|}
            \hline
            n° structure & n° hexagone & valeur circuit & $R(K_i)$ & $E(B)$\\
            \hline
            \multirow{3}{*}{$K_1$} & $h_1$ & $R_1$ & \multirow{3}{*}{$2R_1 + R_2 = 1.984$} & \multirow{12}{*}{$\frac{6R_1 + 4R_2 + 2R_3}{4} = 1.5995$}\\
                               & $h_2$ & $R_1$ & & \\
                               & $h_3$ & $R_2$ & & \\
            \cline{1-4}
            \multirow{3}{*}{$K_2$} & $h_1$ & $R_1$ & \multirow{3}{*}{$R_1 + R_2 + R_3 = 1.215$}  &\\
                               & $h_2$ & $R_2$ & & \\
                               & $h_3$ & $R_3$ & & \\
            \cline{1-4}
            \multirow{3}{*}{$K_3$} & $h_1$ & $R_2$ & \multirow{3}{*}{$2R_1 + R_2 = 1.984$}  &\\
                               & $h_2$ & $R_1$ & & \\
                               & $h_3$ & $R_1$ & & \\
            \cline{1-4}
            \multirow{3}{*}{$K_4$} & $h_1$ & $R_3$ & \multirow{3}{*}{$R_1 + R_2 + R_3 = 1.215$}  &\\
                               & $h_2$ & $R_2$ & & \\
                               & $h_3$ & $R_1$ & & \\
            \hline
        \end{tabular}
    
    \end{document}
    

    enter image description here