8

How can I re-show each line in the following table after coloring the row?

 \documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{hhline}

\usepackage[font=normalsize,labelfont=bf,justification=centering]{caption}
\begin{document}

\begin{table}[htb]
\begin{adjustwidth}{-1cm}{}
\resizebox{0.6\textwidth}{!}{
\begin{minipage}{\linewidth}
\def\arraystretch{1.5}%

\begin{tabular}{ | c | c | c | c | c |  c |  c |  c | c |  c |  c |  }
\cline{2-11}
\multicolumn{1}{c|}{} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} \\

\hline
  \textbf{LOC} & 5 & 5 & 6 & 5 & - & 5 & 6 & 5 & 6 & 5  \\
\hline
\rowcolor{gray!40}  \textbf{VS} & 8 & 5 & 9 & 8 & 9 & 8 & 9 & 8 & 9 & 8 \\
\hline

\end{tabular}
\end{minipage} 
}
\end{adjustwidth}
%% put caption outside here
\caption{\label{fig:text}text experiment experiment experiment experiment experiment experiment experiment}
\end{table}
\end{document}

enter image description here

9
  • Can you elaborate your question please? What do you mean by re-showing the lines?
    – user11232
    Mar 30, 2014 at 22:33
  • 1
    As image indicates, some vertical and horizontal lines do not show after making \rowcolor in one row. I clearly want to display these missing parts again.
    – Hakan
    Mar 30, 2014 at 22:38
  • 2
    It is an issue with the pdf viewer. If you print them, they should be visible. If you magnify then you will see the difference.
    – user11232
    Mar 30, 2014 at 22:42
  • If you can sacrifice vertical lines (which you should if you want a good table) then you can use booktabs where these are distinctly visible. If you want I will provide some code.
    – user11232
    Mar 30, 2014 at 22:43
  • hmm after mignifying around %400 in FoxitReader and Adobe still I can not see properly vertical lines :/. Could you show an alternative way for this?
    – Hakan
    Mar 30, 2014 at 22:45

1 Answer 1

7

One way is to increase the width of the lines by

\setlength\arrayrulewidth{1pt}

Code:

 \documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{hhline}

\usepackage[font=normalsize,labelfont=bf,justification=centering]{caption}
\begin{document}

\begin{table}[htb]
\setlength\arrayrulewidth{1pt}        %% put it inside table environment so that change is local
\begin{adjustwidth}{-1cm}{}
\resizebox{0.6\textwidth}{!}{
\begin{minipage}{\linewidth}
\def\arraystretch{1.5}%

\begin{tabular}{ | c | c | c | c | c |  c |  c |  c | c |  c |  c |  }
\cline{2-11}
\multicolumn{1}{c|}{} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} \\

\hline
  \textbf{LOC} & 5 & 5 & 6 & 5 & - & 5 & 6 & 5 & 6 & 5  \\
\hline
\rowcolor{gray!40}  \textbf{VS} & 8 & 5 & 9 & 8 & 9 & 8 & 9 & 8 & 9 & 8 \\
\hline

\end{tabular}
\end{minipage}
}
\end{adjustwidth}
%% put caption outside here
\caption{\label{fig:text}text experiment experiment experiment experiment experiment experiment experiment}
\end{table}
\end{document}

enter image description here

Your tables become more readable and beautiful if you get rid of vertical lines and some of the horizontal lines (you need only three of them, two at the top and one at the bottom). We do this with booktabs package (whose documentation explains some good practices about writing tables)

 \documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{hhline}
\usepackage{booktabs}

\usepackage[font=normalsize,labelfont=bf,justification=centering]{caption}
\begin{document}

\begin{table}[htb]
\begin{adjustwidth}{-1cm}{}
\resizebox{0.6\textwidth}{!}{
\begin{minipage}{\linewidth}
\def\arraystretch{1.5}%

\begin{tabular}{ *{11}{c}}
\\\toprule
                    & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} \\

\midrule
  \textbf{LOC} & 5 & 5 & 6 & 5 & - & 5 & 6 & 5 & 6 & 5  \\
\rowcolor{gray!40}  \textbf{VS} & 8 & 5 & 9 & 8 & 9 & 8 & 9 & 8 & 9 & 8 \\
\bottomrule

\end{tabular}
\end{minipage}
}
\end{adjustwidth}
%% put caption outside here
\caption{\label{fig:text}text experiment experiment experiment experiment experiment experiment experiment}
\end{table}
\end{document}

enter image description here

3
  • Thanks!, can I also adjust with '\arrayruleheight' for height?
    – Hakan
    Mar 30, 2014 at 22:58
  • @Hakan What do you mean? But the command \arrayruleheight doesn't exist. I think \arrayrulewidth is enough. Change the value appropriately.
    – user11232
    Mar 30, 2014 at 23:00
  • Thank you very much!, I now see your edited post. Second option is more flexible and cool :)
    – Hakan
    Mar 30, 2014 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .