0

I want to color the last row of my table and I have been able to do so using \rowColor, however I lose all of the borders of my table when doing that for the last row. My last row looks like this which I don't want as I want to keep the borders

b

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}
\begin{document}
\begin{table*}[htb]
\caption{Precision/Recall and Completeness of the requirement-to-method 
Traces Output by our approach}
\label{Results}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
    \hline
    \multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}1-\\ 
 Program\end{tabular}}} & \multirow{2}{*}{\textbf{\begin{tabular}[c] 
 {@{}c@{}}2-\\ Step\end{tabular}}} & \multicolumn{3}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Cumulative\\ Predictions\end{tabular}}} & \multicolumn{3}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Cumulative \\ Output\\ Completeness\end{tabular}}} & \multicolumn{5}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Cumulative Precision and \\ Recall\end{tabular}}} & \multicolumn{2}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Cumulative \\ Output \\ Precision\end{tabular}}} & \multicolumn{2}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Cumulative\\  Output \\ Recall\end{tabular}}} \\ \cline{3-17} 
    &  & \textbf{\begin{tabular}[c]{@{}c@{}}3-\\ T\textsubscript{p}(\#)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}4-\\ N\textsubscript{p}(\#)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}5-\\ E\textsubscript{p}(\#)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}6-\\ T(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}7-\\ N(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}8-\\ E(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}9-\\ TP\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}10-\\ TN\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}11-\\ FP\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}12-\\ FN\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}13-\\ E\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}14-\\ T(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}15-\\ N(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}16-\\ T(\%)\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}17-\\ N(\%)\end{tabular}} \\ \hline
    \multirow{4}{*}{\textbf{Chess}} & \textbf{1} & 0 & 2063 & 3953 & 0 & 34.29 & 65.71 & 0 & 1612 & 0 & 0 & 4404 & NA & 1 & NA & 1 \\ \cline{2-17} 
    & \textbf{2} & 0 & 3227 & 2789 & 0 & 53.64 & 46.36 & 0 & 1841 & 0 & 49 & 4126 & NA & 97.41 & 0 & 1 \\ \cline{2-17} 
    & \textbf{3} & 908 & 3227 & 1881 & 15.09 & 53.64 & 31.27 & 415 & 1841 & 378 & 49 & 3333 & 52.33 & 97.41 & 89.44 & 82.97 \\ \cline{2-17} 
    & \textbf{4} & \textbf{1464} & \textbf{3227} & \textbf{1325} & \textbf{24.34} & \textbf{53.64} & \textbf{22.02} & \textbf{471} & \textbf{1841} & \textbf{438} & \textbf{49} & \textbf{3217} & \textbf{51.82} & \textbf{97.41} & \textbf{90.58} & \textbf{80.78} \\ \hline
    \multirow{4}{*}{\textbf{Gantt}} & \textbf{1} & 0 & 55535 & 34699 & 0 & 61.55 & 38.45 & 0 & 22365 & 0 & 0 & 33341 & NA & 1 & NA & 1 \\ \cline{2-17} 
    & \textbf{2} & 0 & 69880 & 20354 & 0 & 77.44 & 22.56 & 0 & 22707 & 0 & 94 & 32905 & NA & 99.59 & 0 & 1 \\ \cline{2-17} 
    & \textbf{3} & 677 & 69880 & 19677 & 75.02 & 77.44 & 21.81 & 84 & 22707 & 85 & 94 & 32736 & 49.70 & 99.59 & 47.19 & 99.63 \\ \cline{2-17} 
    & \textbf{4} & \textbf{1143} & \textbf{69880} & \textbf{19211} & \textbf{12.67} & \textbf{77.44} & \textbf{21.29} & \textbf{136} & \textbf{22707} & \textbf{136} & \textbf{94} & \textbf{32633} & \textbf{50.00} & \textbf{99.59} & \textbf{59.13} & \textbf{99.40} \\ \hline
    \multirow{4}{*}{\textbf{iTrust}} & \textbf{1} & 0 & 17573 & 149265 & 0 & 10.53 & 89.47 & 0 & 6572 & 0 & 0 & 160266 & NA & 1 & \#DIV/0! & 1 \\ \cline{2-17} 
    & \textbf{2} & 0 & 28660 & 138178 & 0 & 17.18 & 82.82 & 0 & 6685 & 0 & 9 & 160144 & NA & 99.87 & 0 & 1 \\ \cline{2-17} 
    & \textbf{3} & 290 & 28660 & 137888 & 0.17 & 17.18 & 82.65 & 81 & 6685 & 27 & 9 & 160036 & 75 & 99.87 & 90 & 99.60 \\ \cline{2-17} 
    & \textbf{4} & \textbf{1074} & \textbf{28660} & \textbf{137104} & \textbf{0.64} & \textbf{17.18} & \textbf{82.18} & \textbf{93} & \textbf{6685} & \textbf{28} & \textbf{9} & \textbf{160023} & \textbf{76.86} & \textbf{99.87} & \textbf{91.18} & \textbf{99.58} \\ \hline
    \multirow{4}{*}{\textbf{JHotDraw}} & \textbf{1} & 0 & 116787 & 20133 & 0 & 85.30 & 14.70 & 0 & 12178 & 0 & 0 & 17744 & NA & 1 & NA & 1 \\ \cline{2-17} 
    & \textbf{2} & 0 & 128756 & 8164 & 0 & 94.04 & 5.96 & 0 & 12247 & 0 & 37 & 17638 & NA & 98.31 & 0 & 1 \\ \cline{2-17} 
    & \textbf{3} & 1279 & 128756 & 6885 & 0.93 & 94.04 & 5.03 & 5 & 12247 & 7 & 37 & 17626 & 75.90 & 98.31 & 23.25 & 99.84 \\ \cline{2-17} 
    & \textbf{4} & \textbf{2000} & \textbf{128756} & \textbf{6164} & \textbf{1.46} & \textbf{94.04} & \textbf{4.50} & \textbf{9} & \textbf{12247} & \textbf{15} & \textbf{37} & \textbf{17614} & \textbf{74.80} & \textbf{98.31} & \textbf{31.35} & \textbf{99.74} \\ \hline


\textbf{Average} & \textbf{4} & \textbf{1420} & \textbf{57631} & \textbf{40951} & \textbf{9.78} & \textbf{60.58} & \textbf{32.50} & \textbf{177} & \textbf{10870} & \textbf{154} & \textbf{47} & \textbf{53372} & \textbf{63.37} & \textbf{98.80} & \textbf{68.06} & \textbf{94.88} \\ \hline


\end{tabular}
\end{table*}
 \end{document}
  • 2
    This is probably just a visual error due to limitation of your screen. Increase the viewers zoom to 350% and you will most likely see the lines. Or take a printout. Or have a look at this answer is the problem still is there: tex.stackexchange.com/a/65235/9632 – Sveinung May 7 at 8:41
  • This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6730 64-bit) (preloaded format=pdflatex 2018.8.3) 7 MAY 2019 10:55 entering extended mode – user3406764 May 7 at 8:57
1
  • in your mwe you havent any row colored
  • after adding \rowcolor{gray!10 before last row, i obtain expected result: visible are all lines (in Sumatra as well in Adobe Reader, if I magnify viewers zoom)

off-topic: i suggest you the followings

  • for numbers in columns 2 -- 17 use S columns from the siunitx package
  • for column headers use \thead macro from the makecell package
  • for boldface numbers use detect-weight options for S column type and define new robust command, with which i will designate cells with bold numbers
  • remove the most of the \clines:

    \documentclass[conference]{IEEEtran}
    \IEEEoverridecommandlockouts
    
    \usepackage[table]{xcolor}              % changed
    \usepackage{array,makecell, multirow}   % new
    \renewcommand\theadfont{\small\bfseries}
    \renewcommand\theadgape{}
    \usepackage{siunitx}
    \usepackage{etoolbox}
    
    \begin{document}
        \begin{table*}[htb]
        \robustify\bfseries             % <--- new
        \newrobustcmd{\B}{\bfseries}    % <--- new
    \caption{Precision/Recall and Completeness of the requirement-to-method
    Traces Output by our approach}
    \label{Results}
        \setlength\tabcolsep{4.5pt}
        \sisetup{detect-weight,
                 mode=text,
                 group-four-digits}
        \centering
    \begin{tabular}{%
                |>{\bfseries}c|>{\bfseries}c|
                             S[table-format=4.0]|
                             S[table-format=6.0]|
                             S[table-format=6.0]|
                            %
                        *{3}{S[table-format=2.2]|}
                            %
                             S[table-format=3.0]|
                             S[table-format=5.0]|
                             S[table-format=3.0]|
                             S[table-format=2.0]|
                             S[table-format=6.0]|
                            %%
                        *{4}{S[table-format=2.2]|}
                    }
        \hline
    \multirow{4}{*}{\thead{1-\\Program}}
        &   \multirow{4}{*}{\thead{2-\\ Step}}
            &   \multicolumn{3}{c|}{\thead{Cumulative\\ Predictions}}
                &   \multicolumn{3}{c|}{\thead{Cumulative Output\\ Completeness}}
                    &   \multicolumn{5}{c|}{\thead{Cumulative Precision and \\ Recall}}
                        & \multicolumn{2}{c|}{\thead{Cumulative \\ Output \\ Precision}}
                            &   \multicolumn{2}{c|}{\thead{Cumulative\\  Output \\ Recall}} \\
        \cline{3-17}
        &   &   {\thead{3-\\ T\textsubscript{p}(\#)}}
                &   {\thead{4-\\ N\textsubscript{p}(\#)}}
                    &   {\thead{5-\\ E\textsubscript{p}(\#)}}
                        &   {\thead{6-\\ T(\%)}}
                            &   {\thead{7-\\ N(\%)}}
                                &   {\thead{8-\\ E(\%)}}
                                    &   {\thead{9-\\ TP}}
                                        &   {\thead{10-\\ TN}}
                                            &   {\thead{11-\\ FP}}
                                                &   {\thead{12-\\ FN}}
                                                    &   {\thead{13-\\ E}}
                                                        &   {\thead{14-\\ T(\%)}}
                                                            &   {\thead{15-\\ N(\%)}}
                                                                &   {\thead{16-\\ T(\%)}}
                                                                    &   {\thead{17-\\ N(\%)}}\\
        \hline
    \multirow{4}{*}{Chess}
        & 1       & 0      & 2063    & 3953    & 0         & 34.29   & 65.71      & 0
        & 1612    & 0      & 0       & 4404    & {NA}      & 1       & {NA}       & 1       \\
        &  2      & 0      & 3227    & 2789    & 0         & 53.64   & 46.36      & 0
        & 1841    & 0      & 49       & 4126   & {NA}      & 97.41   & 0          & 1       \\
        & 3       & 908    & 3227     & 1881   & 15.09     & 53.64   & 31.27      & 415
        & 1841    & 378    & 49       & 3333   & 52.33     & 97.41   & 89.44      & 82.97   \\
        & 4       &\B 1464 &\B3227    &\B 1325 &\B 24.34   &\B 53.64 &\B 22.02    &\B 471
        &\B 1841  &\B 438  &\B 49     &\B 3217 &\B 51.82   &\B 97.41 &\B 90.58    &\B 80.78 \\
        \hline
    \multirow{4}{*}{Gantt}
        & 1       & 0      & 55535    & 34699    & 0       & 61.55   & 38.45      & 0
        & 22365   & 0      & 0        & 33341    & {NA}    & 1       & {NA}       & 1       \\
        & 2       & 0      & 69880    & 20354    & 0       & 77.44   & 22.56      & 0
        & 22707   & 0      & 94       & 32905    & NA      & 99.59   & 0          & 1       \\
        & 3       & 677    & 69880    & 19677    & 75.02   & 77.44   & 21.81      & 84
        & 22707   & 85     & 94       & 32736    & 49.70   & 99.59   & 47.19      & 99.63   \\
        & 4       &\B 1143 &\B 69880  &\B 19211  &\B 12.67 &\B 77.44 &\B 21.29    &\B 136
        &\B 22707 &\B 136  &\B 94     &\B 32633  &\B 50.00 &\B 99.59 &\B 59.13    &\B 99.40 \\
        \hline
    \multirow{4}{*}{iTrust}
        & 1       & 0      & 17573    & 149265   & 0       & 10.53   & 89.47      & 0
        & 6572    & 0      & 0        & 160266   & {NA}    & 1       & {\#DIV/0!} & 1       \\
        & 2       & 0      & 28660    & 138178   & 0       & 17.18   & 82.82      & 0
        & 6685    & 0      & 9        & 160144   & NA      & 99.87   & 0          & 1       \\
        & 3       & 290    & 28660    & 137888   & 0.17    & 17.18   & 82.65      & 81
        & 6685    & 27     & 9        & 160036   & 75      & 99.87   & 90         & 99.60   \\
        & 4       &\B 1074 &\B 28660  &\B 137104 &\B 0.64  &\B 17.18 &\B 82.18    &\B 93
        &\B 6685  &\B 28   &\B 9      &\B 160023 &\B 76.86 &\B 99.87 &\B 91.18    &\B 99.58 \\ \hline
    \multirow{4}{*}{JHotDraw}
        & 1       & 0      & 116787   & 20133    & 0       & 85.30   & 14.70      & 0
        & 12178   & 0      & 0        & 17744    & {NA}    & 1       & {NA}       & 1       \\
        & 2       & 0      & 128756   & 8164     & 0       & 94.04   & 5.96       & 0
    & 12247   & 0      & 37       & 17638    & {NA}    & 98.31   & 0          & 1       \\
    & 3       & 1279   & 128756   & 6885     & 0.93    & 94.04   & 5.03       & 5
    & 12247   & 7      & 37       & 17626    & 75.90   & 98.31   & 23.25      & 99.84   \\
    & 4       &\B 2000 &\B 128756 &\B 6164   &\B 1.46  &\B 94.04 &\B 4.50     &\B 9
    &\B 12247 &\B 15   &\B 37     &\B 17614  &\B 74.80 &\B 98.31 &\B 31.35    &\B 99.74 \\ \hline
    \rowcolor{gray!10}
    Average
    &4        &\B 1420 &\B 57631  &\B 40951  &\B 9.78  &\B 60.58 &\B 32.50   &\B 177
    &\B 10870 &\B 154  &\B 47     &\B 53372  &\B 63.37 &\B 98.80 &\B 68.06   &\B 94.88  \\ \hline
    \end{tabular}
        \end{table*}
    \end{document}
    

enter image description here

  • to my taste the better look of the table is without vertical lines, with horsintal rules defined in the booktabs package and without colored last row:

    \documentclass[conference]{IEEEtran}
    \IEEEoverridecommandlockouts
    
    \usepackage{xcolor}                      % changed
    \usepackage{array, booktabs, makecell, multirow}% new
    \renewcommand\theadfont{\small\bfseries}
    \renewcommand\theadgape{}
    \usepackage{siunitx}
    \usepackage{etoolbox}
    
    \begin{document}
        \begin{table*}[htb]
        \robustify\bfseries             % <--- new
        \newrobustcmd{\B}{\bfseries}    % <--- new
    \caption{Precision/Recall and Completeness of the requirement-to-method
    Traces Output by our approach}
    \label{Results}
        \setlength\tabcolsep{4.5pt}
        \sisetup{detect-weight,
                 mode=text}
        \centering
    \begin{tabular}{%
                 >{\bfseries}c 
                 >{\bfseries}c
                             S[table-format=4.0] 
                             S[table-format=6.0] 
                             S[table-format=6.0] 
                            %
                        *{3}{S[table-format=2.2]}
                            %
                             S[table-format=3.0]
                             S[table-format=5.0]
                             S[table-format=3.0]
                             S[table-format=2.0]
                             S[table-format=6.0]
                            %%
                        *{4}{S[table-format=2.2]}
                    }
        \toprule
    \multirow{4}{*}{\thead[b]{1-\\Program}}
        &   \multirow{4}{*}{\thead[b]{2-\\ Step}}
            &   \multicolumn{3}{c}{\thead[b]{Cumulative\\ Predictions}}
                &   \multicolumn{3}{c}{\thead[b]{Cumulative Output\\ Completeness}}
                    &   \multicolumn{5}{c}{\thead[b]{Cumulative Precision and \\ Recall}}
                        & \multicolumn{2}{c}{\thead[b]{Cumulative \\ Output \\ Precision}}
                            &   \multicolumn{2}{c}{\thead[b]{Cumulative\\  Output \\ Recall}} \\
        \cmidrule(lr){3-5}
        \cmidrule(lr){6-8}
        \cmidrule(lr){9-13}
        \cmidrule(lr){14-13}
        \cmidrule(lr){14-15}
        \cmidrule(lr){16-17}
        &   &   {\thead[b]{3-\\ T\textsubscript{p}(\#)}}
                &   {\thead[b]{4-\\ N\textsubscript{p}(\#)}}
                    &   {\thead[b]{5-\\ E\textsubscript{p}(\#)}}
                        &   {\thead[b]{6-\\ T(\%)}}
                            &   {\thead[b]{7-\\ N(\%)}}
                                &   {\thead[b]{8-\\ E(\%)}}
                                    &   {\thead[b]{9-\\ TP}}
                                        &   {\thead[b]{10-\\ TN}}
                                            &   {\thead[b]{11-\\ FP}}
                                                &   {\thead[b]{12-\\ FN}}
                                                    &   {\thead[b]{13-\\ E}}
                                                        &   {\thead[b]{14-\\ T(\%)}}
                                                            &   {\thead[b]{15-\\ N(\%)}}
                                                                &   {\thead[b]{16-\\ T(\%)}}
                                                                    &   {\thead[b]{17-\\ N(\%)}}\\
        \midrule
    \multirow{4}{*}{Chess}
        & 1       & 0      & 2063    & 3953    & 0         & 34.29   & 65.71      & 0
        & 1612    & 0      & 0       & 4404    & {NA}      & 1       & {NA}       & 1       \\
        &  2      & 0      & 3227    & 2789    & 0         & 53.64   & 46.36      & 0
        & 1841    & 0      & 49       & 4126   & {NA}      & 97.41   & 0          & 1       \\
        & 3       & 908    & 3227     & 1881   & 15.09     & 53.64   & 31.27      & 415
        & 1841    & 378    & 49       & 3333   & 52.33     & 97.41   & 89.44      & 82.97   \\
        & 4       &\B 1464 &\B3227    &\B 1325 &\B 24.34   &\B 53.64 &\B 22.02    &\B 471
        &\B 1841  &\B 438  &\B 49     &\B 3217 &\B 51.82   &\B 97.41 &\B 90.58    &\B 80.78 \\
        \midrule
    \multirow{4}{*}{Gantt}
        & 1       & 0      & 55535    & 34699    & 0       & 61.55   & 38.45      & 0
        & 22365   & 0      & 0        & 33341    & {NA}    & 1       & {NA}       & 1       \\
        & 2       & 0      & 69880    & 20354    & 0       & 77.44   & 22.56      & 0
        & 22707   & 0      & 94       & 32905    & NA      & 99.59   & 0          & 1       \\
        & 3       & 677    & 69880    & 19677    & 75.02   & 77.44   & 21.81      & 84
        & 22707   & 85     & 94       & 32736    & 49.70   & 99.59   & 47.19      & 99.63   \\
        & 4       &\B 1143 &\B 69880  &\B 19211  &\B 12.67 &\B 77.44 &\B 21.29    &\B 136
        &\B 22707 &\B 136  &\B 94     &\B 32633  &\B 50.00 &\B 99.59 &\B 59.13    &\B 99.40 \\
        \midrule
    \multirow{4}{*}{iTrust}
        & 1       & 0      & 17573    & 149265   & 0       & 10.53   & 89.47      & 0
        & 6572    & 0      & 0        & 160266   & {NA}    & 1       & {\#DIV/0!} & 1       \\
        & 2       & 0      & 28660    & 138178   & 0       & 17.18   & 82.82      & 0
        & 6685    & 0      & 9        & 160144   & NA      & 99.87   & 0          & 1       \\
        & 3       & 290    & 28660    & 137888   & 0.17    & 17.18   & 82.65      & 81
        & 6685    & 27     & 9        & 160036   & 75      & 99.87   & 90         & 99.60   \\
        & 4       &\B 1074 &\B 28660  &\B 137104 &\B 0.64  &\B 17.18 &\B 82.18    &\B 93
        &\B 6685  &\B 28   &\B 9      &\B 160023 &\B 76.86 &\B 99.87 &\B 91.18    &\B 99.58 \\ 
        \midrule
    \multirow{4}{*}{JHotDraw}
        & 1       & 0      & 116787   & 20133    & 0       & 85.30   & 14.70      & 0
        & 12178   & 0      & 0        & 17744    & {NA}    & 1       & {NA}       & 1       \\
        & 2       & 0      & 128756   & 8164     & 0       & 94.04   & 5.96       & 0
    & 12247   & 0      & 37       & 17638    & {NA}    & 98.31   & 0          & 1       \\
    & 3       & 1279   & 128756   & 6885     & 0.93    & 94.04   & 5.03       & 5
    & 12247   & 7      & 37       & 17626    & 75.90   & 98.31   & 23.25      & 99.84   \\
    & 4       &\B 2000 &\B 128756 &\B 6164   &\B 1.46  &\B 94.04 &\B 4.50     &\B 9
    &\B 12247 &\B 15   &\B 37     &\B 17614  &\B 74.80 &\B 98.31 &\B 31.35    &\B 99.74 \\ 
    \midrule
    Average
        &4        &\B 1420 &\B 57631  &\B 40951  &\B 9.78  &\B 60.58 &\B 32.50   &\B 177
        &\B 10870 &\B 154  &\B 47     &\B 53372  &\B 63.37 &\B 98.80 &\B 68.06   &\B 94.88  \\
        \bottomrule
    \end{tabular}
        \end{table*}
    \end{document}
    

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.