1

`

Hello guys. Im getting these strange borders. Could you explain what I have to do to have a nice table? Thanks!

\documentclass[a4paper,12pt]{report}
\usepackage{graphicx}
\usepackage[table,xcdraw]{xcolor}
\usepackage{textcomp}
\begin{document}
\begin{table}
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\rowcolor[HTML]{C0C0C0} 
{\color[HTML]{000000} Material} & {\color[HTML]{000000} Quenching} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Tempering\\ temp. {[}°C{]}\end{tabular}} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Surface\\ hardness \\ {[}HRC{]}\end{tabular}} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Core \\ hardness\\ {[}HRC{]}\end{tabular}} & {\color[HTML]{000000} \begin{tabular}[c]{@{}c@{}}Density\\ {[}g/cc{]}\end{tabular}} \\ \hline
\cellcolor[HTML]{C6E3F9}BS S82 & oil & 170 & 61.8 & 42.7 & 7.86 \\ \hline
\cellcolor[HTML]{C6E3F9}FNDW & gas & 300 & 60.8 & 44.5 & 7.8 \\ \hline
\cellcolor[HTML]{C6E3F9}Pyrowear 675 & oil & 316 & 62 & 39-41 & 7.76 \\ \hline
\cellcolor[HTML]{C6E3F9}XD15NW & HF & 650 (TBC) & 58-60 & 59.2 & 7.7 \\ \hline
\cellcolor[HTML]{C6E3F9}CX13VDW & gas or oil & 250 & 63.9 & 39.2 & 7.8 \\ \hline
\cellcolor[HTML]{C6E3F9}GKHW & oil & 625 & 72.5 & 95 HRB & 7.8 \\ \hline
\rowcolor[HTML]{C0C0C0} 
Surface treatment & Process & \begin{tabular}[c]{@{}c@{}}Process \\ temp. {[}°C{]}\end{tabular} & \begin{tabular}[c]{@{}c@{}}Corrosion\\ resistance {[}hours SST{]}\end{tabular} & Hardness & \begin{tabular}[c]{@{}c@{}}Wear \\ resistance\end{tabular} \\ \hline
\cellcolor[HTML]{C6E3F9}\begin{tabular}[c]{@{}c@{}}Manganese\\ phosphating\end{tabular} & spraying & 150 & 100 & na & - - \\ \hline
\cellcolor[HTML]{C6E3F9}Ni-P + PTFE & chemical & 140 - 300 & 500 - 1,000 & 550 HV & + \\ \hline
\cellcolor[HTML]{C6E3F9}CrN + DLC & PVD-CVD & \textgreater 200 & ++ & 1,500 - 6,000 HV & ++ \\ \hline
\cellcolor[HTML]{C6E3F9}CrN + WC/C & PVD-CVD & 180 - 250 & ++ & 2,000 - 2,500 HV & - \\ \hline
\cellcolor[HTML]{C6E3F9}Micronite & PVD + other & 400 (TBC) & +++ & 3,500 - 4,000 HK & +++ \\ \hline
\end{tabular}%
}
\caption{Materials and surface treatments investigated by Sonaca}
\label{table:sonaca_trials}
\end{table}
\end{document}
  • That looks like a rendering problem of the pdf viewer. By zooming in you should see that everything is fine. Unrelated: For value ranges you should better use an en dash, which can be obtained by typing --, e.g. 58--60. (I'd add a wee bit of spacing but that's debatable.) – campa Dec 19 '19 at 10:14
  • 1
    Unrelated, but don't use resizebox on a table since it will lead to inconsistent font sizes. – leandriis Dec 19 '19 at 10:17
2

In sumatra the lines are quite visible:

enter image description here

For writing multi line cells' contents in your table i define new command:

\newcommand\mrc[1]{\begin{tabular}{@{} c @{}} #1 \end{tabular}}

For writing of units the package siunitx is added. In table are also removed all cellcolor (which are superfluous):

\documentclass[a4paper,12pt]{report}
\usepackage{graphicx}
\usepackage[table,xcdraw]{xcolor}
\usepackage{textcomp}
\usepackage{array}
\newcommand\mrc[1]{\begin{tabular}{@{} c @{}} #1 \end{tabular}}
\usepackage{siunitx}

\begin{document}
\begin{table}
\centering
%\setlength\arrayrulewidth{0.8pt} % use when better visibility of lines are needed
\setlength\tabcolsep{3pt}
\begin{tabular}{|>{\columncolor[HTML]{C6E3F9}}c|c|c|c|c|c|}
\hline
\rowcolor[HTML]{C0C0C0}
Material & Quenching    & \mrc{Tempering\\ temp. {[\si{\celsius}]}}
                            & \mrc{Surface\\ hardness \\ {[HRC]}}
                                & \mrc{Core\\ hardness\\ {[HRC]}}
                                    & \mrc{Density\\ {[g/cc]}} \\
    \hline
BS S82          & oil           & 170       & 61.8  & 42.7      & 7.86  \\ \hline
FNDW            & gas           & 300       & 60.8  & 44.5      & 7.8   \\ \hline
Pyrowear 675    & oil           & 316       & 62    & 39-41     & 7.76  \\ \hline
XD15NW          & HF            & 650 (TBC) & 58-60 & 59.2      & 7.7   \\ \hline
CX13VDW         & gas or oil    & 250       & 63.9  & 39.2      & 7.8   \\ \hline
GKHW            & oil           & 625       & 72.5  & 95 HRB    & 7.8   \\ \hline
\rowcolor[HTML]{C0C0C0}
\mrc{Surface\\ 
     treatment} & Process & \mrc{Process \\ temp. {[\si{\celsius}]}}
                                & \mrc{Corrosion\\ resistance\\
                                            {[hours SST]}}
                                    & Hardness
                                        & \mrc{Wear\\ resistance}          \\ \hline
\mrc{Manganese\\ phosphating}
                & spraying      & 150       & 100   & na                & --    \\  \hline
Ni-P + PTFE     & chemical      & 140 - 300 & 500 - 1,000
                                                    & 550 HV            & +     \\ \hline
CrN + DLC       & PVD-CVD       & $>200$    & ++    & 1,500 - 6,000 HV  & ++    \\ \hline
CrN + WC/C      & PVD-CVD       & 180 - 250 & ++    & 2,000 - 2,500 HV  & -     \\ \hline
Micronite       & PVD + other   & 400 (TBC) & +++   & 3,500 - 4,000 HK  & +++   \\ \hline
\end{tabular}%

\caption{Materials and surface treatments investigated by Sonaca}
\label{table:sonaca_trials}
\end{table}
\end{document}
0

Not a solution to the actual problem but maybe helpful regarding "what [...] to do to have a nice table":

enter image description here

\documentclass[a4paper,12pt]{report}

\usepackage{booktabs}
\usepackage{makecell}
\usepackage{siunitx}


\begin{document}
\begin{table}
\caption{Materials and surface treatments investigated by Sonaca}
\label{table:sonaca_trials}
\centering
\small
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lccccc}
\toprule
\thead{Material} 
      & \thead{Quenching}    
            & \thead{Tempering\\ temp. {[\si{\celsius}]}}
                  & \thead{Surface\\ hardness \\ {[HRC]}}
                        & \thead{Core\\ hardness\\ {[HRC]}}
                              & \thead{Density\\ {[g/cc]}} \\
\midrule
BS S82          & oil           & 170       & 61.8  & 42.7      & 7.86  \\ 
FNDW            & gas           & 300       & 60.8  & 44.5      & 7.8   \\ 
Pyrowear 675    & oil           & 316       & 62    & 39-41     & 7.76  \\ 
XD15NW          & HF            & 650 (TBC) & 58-60 & 59.2      & 7.7   \\ 
CX13VDW         & gas or oil    & 250       & 63.9  & 39.2      & 7.8   \\ 
GKHW            & oil           & 625       & 72.5  & 95 HRB    & 7.8   \\ 
\bottomrule
\end{tabular*}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lccccc}
\thead{Surface\\ treatment} 
      & Process 
           & \thead{Process \\ temp. {[\si{\celsius}]}}
                 & \thead{Corrosion\\ resistance\\ {[hours SST]}}
                       & \thead{Hardness}
                             & \thead{Wear\\ resistance}          \\ 
\midrule
\makecell[l]{Manganese\\ phosphating}
                & spraying      & 150       & 100   & na                & --    \\  
Ni-P + PTFE     & chemical      & 140 - 300 & 500 - 1,000
                                                    & 550 HV            & +     \\ 
CrN + DLC       & PVD-CVD       & $>200$    & ++    & 1,500 - 6,000 HV  & ++    \\ 
CrN + WC/C      & PVD-CVD       & 180 - 250 & ++    & 2,000 - 2,500 HV  & -     \\ 
Micronite       & PVD + other   & 400 (TBC) & +++   & 3,500 - 4,000 HK  & +++   \\ \bottomrule
\end{tabular*}%
\end{table}
\end{document}

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.