# Better table code and coloring table

First thing, I got a table, which looks fine in PDF, but sort of "ugly" in code, and I would like to present as below,

\documentclass{article}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.5in, bottom=0.5in, left=1.55in, right=1.55in]{geometry}
\usepackage[norule]{footmisc}
\usepackage{color, colortbl}
\usepackage{xcolor}
\usepackage{multicol}

\begin{document}

\begin{table}[ht]
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\multicolumn{5}{c}{\textbf{NET ENTITLEMENT FISH OIL MARKETS}}\\
\multicolumn{5}{c}{\textbf{AS OF DECEMBER 31, 2019}}\\\hline
%\rowcolor{Cyan}
\multicolumn{1}{|c|}{\multirow{2}{*}{Country}}&\multicolumn{1}{c|}{\multirow{2}{*}{Company}}&Proved Cooked&Proved Uncooked&Total Proved\\
%\rowcolor{Cyan}
\multicolumn{1}{|c|}{}&\multicolumn{1}{c|}{}&(T)&(T)&\cellcolor{blue!25}(T)\\\hline
ChUAN&  &51,574&31,202&82,776\\\hline
IraW-West POINT &  & 9,656 &57,981&67,637\\\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{KAZSLSKDE}}& PKKR& 32,129 &5,174& 37,304 \\\cline{2-5}
\multicolumn{1}{|c|}{}&KOLKOL&9,718&3,447&13,165\\\cline{2-5}
\multicolumn{1}{|c|}{}&PKPK&424&0&424\\\hline
TOTAL CNNNO & & 103,501 & 97,804 & 201,306\\\hline
\end{tabular}
\end{center}
\label{tab:multicol}
\end{table}

\end{document}


Is there any way could improve this ugly code, for example I don't want any {c|c|c|c|c} in the codes.

Secondly, I'm confused how to coloring the table, for the two rows to be specifically. I tried and the the second row color would block first row's text. Is there any way could prevent this.

Regards,

• {c|c|c|c|c} can be reduced to {*{4}{c|}c}, but it's not shorter, actually. – user31729 Jun 19 '15 at 16:05
• Not sure what you mean about the second row color blocking the first row text. Do you mean the Total Proved text is covered? – James Jun 19 '15 at 16:43
• You could definitely omit all \multicolumn{1}{|c|}{} directives. – Mico Jun 19 '15 at 16:46
• @James, when you try to color row 2, which is the (T) row, the blue(or purple) color bar would block bottom of "Country" and "Company". BTW, I need the table to be look exactly as I created, but with different code. – Cheng Zhang Jun 19 '15 at 18:48

I'm not sure what you mean by "ugly code", but you could certainly start by getting rid of all \multicolumn{1}{|c|}{} directives: they do absolutely nothing -- except create code clutter.

Your table currently has a moderately gaudy look. Assuming that's not intentional, you may want to tone down the impression a bit, e.g., by using a simple, normal-looking caption instead of the two-line bold-face hit-me-smack-between-the-eyes thing. You may also want to strive for a more open look, say, by getting rid of all vertical rules and most horizontal rules, and using the rule-drawing macros of the booktabs package for the remaining ones. Finally, to help your readers take in (and hopefully comprehend) the numbers you're showing, you may want to choose a somewhat more sophisticated column type than c.

\documentclass{article}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, vmargin=0.5in, hmargin=1.55in]{geometry}
\usepackage[norule]{footmisc}
\usepackage[table]{xcolor}
\usepackage{multicol}
\usepackage{booktabs,siunitx}
\sisetup{group-minimum-digits=4,group-separator={,}}
\begin{document}

\begin{table}[ht]
\centering
\caption{Net entitlement fish oil markets as of 31 December  2019} \label{tab:multicol}
\begin{tabular}{@{}ll *{3}{S[table-format=6.0]} @{}}
\toprule
Country&Company&{Proved Cooked}&{Proved Uncooked}&{Total Proved}\\
& &{(T)}&{(T)}&{\color{blue!85}(T)}\\
\midrule
ChUAN&  &51574&31202&82776\\
IraW-West POINT &  & 9656 &57981&67637\\
KAZSLSKDE& PKKR& 32129 &5174& 37304 \\
&KOLKOL&9718&3447&13165\\
&PKPK&424&0&424\\
TOTAL CNNNO & & 103501 & 97804 & 201306\\
\bottomrule
\end{tabular}

\end{table}

\end{document}

• If it wasn't for you, i would have posted an answer with decimal commas/points. I decided to add a bit of spacing between the blocks. – Johannes_B Jun 19 '15 at 17:30

My table would be pretty similar, only difference really is the spacing. Micos advice are very good, i cannot add anything to it.

\documentclass{article}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.5in, bottom=0.5in, left=1.55in, right=1.55in]{geometry}
\usepackage{caption}
\captionsetup[table]{position=above}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{group-separator={\,}}

\begin{document}

\begin{table}[ht]
\caption{Net entitlement fish oil markets as of december 31, 2019}
\begin{tabular}{ccS[table-format=6.0]
S[table-format=6.0]
S[table-format=6.0]
}
\toprule
Country         & Company & {Proved Cooked} & {Proved Uncooked} & {Total Proved}  \\
&         & {(T)}           & {(T)}             & {(T)}\\
\midrule
ChUAN           &         & 51574           & 31202             & 82776\\\addlinespace
IraW-West POINT &         & 9656            & 57981             & 67637\\\addlinespace
& PKKR    & 32129           & 5174              & 37304 \\
KAZSLSKDE       & KOLKOL  & 9718            & 3447              & 13165\\
& PKPK    & 424             & 0                 & 424\\\addlinespace
TOTAL CNNNO     &         & 103501          & 97804             & 201306\\
\bottomrule
\end{tabular}
\label{tab:multicol}
\end{table}

\end{document}