1

enter image description hereThe following example shows the problem in my table. There is a unwanted white rule in the left. How can i fix that? Thanks for help!

\documentclass[dvipsnames,12pt]{article}  
\usepackage{xcolor,array,ragged2e,booktabs,colortbl} 
\usepackage{multicol,multirow} \usepackage{hhline} 
\begin{document} 
\newcolumntype{M}[1]{>{\hspace{0pt}\Centering $}p{#1}<{$}}
\renewcommand{\arraystretch}{1.5} 
\newcommand{\vlineTS}[1][1.2pt]{\color{gray!70}\vrule width #1} 
\setlength\arrayrulewidth{1.2pt}\arrayrulecolor{gray!70}% 
\begin{tabular}[t]{M{1.8cm}M{1.5cm}|*{2}{M{1.5cm}|}M{1.5cm}}\hhline{*{2}{~}*{2}{|-}|~}%
     &   & \multicolumn{2}{!{}>{\cellcolor{cyan!20}}c!{\vlineTS}}{Merkmal II} & \\\hhline{*{2}{~}*{3}{|-}|}
     &   & \cellcolor{cyan!30}F & \cellcolor{cyan!30}\overline{F} & 
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{Summe}\\\hline
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!30}}c!{}}{\multirow{2}*{\cellcolor{cyan!20}}} &  
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!30}}c!{\vlineTS}}{$G$}   & \cellcolor{gray!20} 0,04   &
     \cellcolor{gray!20} 0,12 & \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,16$} \\\hhline{*{1}{|~}*{4}{-}}
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!20}}c!{}}{\raisebox{0.43cm}[0.43cm]{Merkmal I}}   &
     \multicolumn{1}{!{\vlineTS}>{\columncolor{cyan!30}}c!{\vlineTS}}{$\overline{G}$} &\cellcolor{gray!20} 0,36   &
     \cellcolor{gray!20} 0,48 & \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,84$} \\\hline
     & \multicolumn{1}{!{\vlineTS}>{\columncolor{Green!30}}c!{\vlineTS}}{Summe} &
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,40$} & 
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,60$} &
     \multicolumn{1}{!{}>{\cellcolor{Green!50}}c!{\vlineTS}}{\color{black}$1$} \\\hhline{*{1}{~}*{4}{-}}
\end{tabular} 
\end{document}
2

enter image description here

\documentclass[dvipsnames,12pt]{article}  
\usepackage{xcolor,array,ragged2e,booktabs,colortbl} 
\usepackage{multicol,multirow} \usepackage{hhline} 
\begin{document} 
\newcolumntype{M}[1]{>{\hspace{0pt}\Centering $}p{#1}<{$}}
\renewcommand{\arraystretch}{1.5} 
\newcommand{\vlineTS}[1][1.2pt]{\color{gray!70}\vrule width #1} 
\setlength\arrayrulewidth{1.2pt}\arrayrulecolor{gray!70}% 
\begin{tabular}[t]{M{1.8cm}M{1.5cm}|*{2}{M{1.5cm}|}M{1.5cm}}\hhline{*{2}{~}*{2}{|-}|~}%
     &   & \multicolumn{2}{!{}>{\cellcolor{cyan!20}}c!{\vlineTS}}{Merkmal II} & \\\hhline{*{2}{~}*{3}{|-}|}
     &   & \cellcolor{cyan!30}F & \cellcolor{cyan!30}\overline{F} & 
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{Summe}\\\hline
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!30}}c!{}}{\multirow{2}*{\cellcolor{cyan!20}}} &  
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!30}}c!{\vlineTS}}{$G$}   & \cellcolor{gray!20} 0,04   &
     \cellcolor{gray!20} 0,12 & \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,16$} \\
\hhline{*{1}{|>{\arrayrulecolor{cyan!20}}-}>{\arrayrulecolor{gray!70}}*{4}{-}}
     \multicolumn{1}{!{\vlineTS}>{\cellcolor{cyan!20}}c!{}}{\raisebox{0.43cm}[0.43cm]{Merkmal I}}   &
     \multicolumn{1}{!{\vlineTS}>{\columncolor{cyan!30}}c!{\vlineTS}}{$\overline{G}$} &\cellcolor{gray!20} 0,36   &
     \cellcolor{gray!20} 0,48 & \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,84$} \\\hline
     & \multicolumn{1}{!{\vlineTS}>{\columncolor{Green!30}}c!{\vlineTS}}{Summe} &
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,40$} & 
     \multicolumn{1}{!{}>{\cellcolor{Green!30}}c!{\vlineTS}}{$0,60$} &
     \multicolumn{1}{!{}>{\cellcolor{Green!50}}c!{\vlineTS}}{\color{black}$1$} \\\hhline{*{1}{~}*{4}{-}}
\end{tabular} 
\end{document}
  • Thank you very much for your quick and fantastic solution @David – user139826 Jul 29 '17 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy