TransWikia.com

Issue with vertical line in multiline table

TeX - LaTeX Asked by Kosta on November 28, 2020

I am facing issue with vertical line. It seems that the vertical line on the seccond level is thinner than the line on the first level. Below you will find a latex code and screenshot.
I appreciate your help!

begin{table}[h]
centering

begin{tabular}{r|c|c|c|c|c}
multicolumn{1}{c|}{multirow{2}{*}{textbf{Number}}} & multicolumn{2}{|c|}{textbf{Object 1}} & multicolumn{2}{|c|}{textbf{Object 2}} & multicolumn{1}{|c}{textbf{Object 3}}
textbf{} & textbf{ 1 } & textbf{ 2 } & textbf{ 1 } & textbf{ 2 } & textbf{ 1 }  
hline
 1 & 39 & 4 & 18 & 1 & cellcolor{tableGreen}0 
 10 & 40 & 4 & 12 & cellcolor{tableGreen}2 & 4 
 100 & 49 & 5 & 13 & cellcolor{tableGreen}2 & 33 
 1000 & 15 & cellcolor{tableGreen}12 & 174 & 12 & 211 

end{tabular}
caption{Messergebnisse für S1 zwischen Neo4j, Oracle und PostgreSQL in ms}
label{Table_Selektion_S1}
end{table}

enter image description here

2 Answers

Here is a MWE. You are repeating vertical lines.

documentclass{article}
usepackage[table]{xcolor}
usepackage{multirow}


begin{document}

begin{tabular}{r|c|c|c|c|c}
multicolumn{1}{c|}{multirow{2}{*}{textbf{Number}}} & multicolumn{2}{c|}{textbf{Object 1}} & multicolumn{2}{c|}{textbf{Object 2}} & multicolumn{1}{c}{textbf{Object 3}}
textbf{} & textbf{ 1 } & textbf{ 2 } & textbf{ 1 } & textbf{ 2 } & textbf{ 1 }  
hline
 1 & 39 & 4 & 18 & 1 & cellcolor{green}0 
 10 & 40 & 4 & 12 & cellcolor{green}2 & 4 
 100 & 49 & 5 & 13 & cellcolor{green}2 & 33 
 1000 & 15 & cellcolor{green}12 & 174 & 12 & 211 

end{tabular}
end{document}

Correct answer by azetina on November 28, 2020

You do not need all multicolumn in your table, also textbf{} is meaningless. In needed multicolumn you need vertical bar only on the right side of cells:

documentclass{article}
usepackage{multirow}
usepackage[table, dvipsnames]{xcolor}

begin{document}
    begin{table}[h]
    centering
begin{tabular}{r|c|c|c|c|c}
multirow{2}{*}{textbf{Number}} 
        &   multicolumn{2}{c|}{textbf{Object 1}}      % <---
            &   multicolumn{2}{c|}{textbf{Object 2}}  % <---
                    &   textbf{Object 3}             % <---
    &   textbf{ 1 }                                    % <---
        &   textbf{ 2 } 
            &   textbf{ 1 } 
                &   textbf{ 2 } 
                    & textbf{ 1 }  
hline
 1      & 39 & 4 & 18 & 1 & cellcolor{Green}0 
 10     & 40 & 4 & 12 & cellcolor{Green}2 & 4 
 100    & 49 & 5 & 13 & cellcolor{Green}2 & 33 
1000    & 15 & cellcolor{Green}12 & 174 & 12 & 211 
end{tabular}
caption{Messergebnisse für S1 zwischen Neo4j, Oracle und PostgreSQL in ms}
label{Table_Selektion_S1}
    end{table}
end{document}

enter image description here

Note: in above MWE is not used your color tableGreen since it is not known, how is defined. Please always provide small but complete document example, which reproduce your problem.

Answered by Zarko on November 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP