0

First thing first, my code,

\documentclass{article}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.5in, bottom=0.5in, left=1.55in, right=1.55in]{geometry}
\usepackage{multirow,array,varwidth,spreadtab,caption}
\usepackage[norule]{footmisc}
\usepackage{pythontex}
\usepackage{siunitx,booktabs,caption}
\usepackage{ragged2e}
\usepackage{layout}
\usepackage{xtab}
\usepackage{float}
\usepackage{gensymb}
\usepackage{hyperref}
\usepackage[some,bottom]{background}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage{color, colortbl}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{indentfirst}
\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\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{LightCyan}
    \multicolumn{1}{|c|}{\multirow{2}{*}{Country}}&\multicolumn{1}{c|}{\multirow{2}{*}{Company}}&Proved Cooked&Proved Uncooked&Total Proved\\
    \rowcolor{LightCyan}
    \multicolumn{1}{|c|}{}&\multicolumn{1}{c|}{}&(T)&(T)&(T)\\\hline
    ChUAN& \pyc{print("{}".format(row[0]))} &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}

And what I got is like below, Unwanted color table

The second row coloring obviously block not only the "Country" and "Company" but also the "|" in the first two rows.

How could I get rid off this problem? Appreciated on any comments and help.

Regards, Cheng

1
  • Move the \multirows from row 1 to row 2 with negative first argument: \rowcolor{LightCyan} & &Proved Cooked&Proved Uncooked&Total Proved\\ \rowcolor{LightCyan} \multicolumn{1}{|c|}{\multirow{-2}{*}{Country}}&\multicolumn{1}{c|}{\multirow{-2}{*}{Company}}&(T)&(T)&(T)\\\hline Jun 24 '15 at 19:31
1

Tables are constructed from row to row. \multirow{2} puts the stuff in the current and the next row. But the next row is not yet drawn and will overprint the text that sticks into this row.

The better way is to use \multirow{-2} in the row below to print in the current row and the row above, which is already set.

\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{LightCyan}
    &&Proved
    Cooked&Proved Uncooked&Total Proved\\
    \rowcolor{LightCyan}
    \multicolumn{1}{|c|}{\multirow{-2}{*}{Country}}
    &\multicolumn{1}{c|}{\multirow{-2}{*}{Company}}
    &(T)&(T)&(T)\\\hline
    ChUAN& \pyc{print("{}".format(row[0]))} &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}

Result

Remarks:

  • \centering in table avoids additional vertical space, which is set by environment center.

  • ...

3
  • I copy and paste the code to my script, the text block issue was gone but the | between column 3,4 and 4,5 are still missing/blocking. Jun 24 '15 at 19:39
  • @ChengZhang Most probably a viewer issue. Try zooming in/out at different levels and you'll see them (if you print your document you'll see them too). Jun 24 '15 at 19:41
  • @Heiko That's called experience, right? Thanks a lot, I print it out and find it's perfect! Jun 24 '15 at 19:44
0

Another solution with the makecell package, which allows for line breaks inside cells, and a common formatting. Also there are less rows. I removed loading color, since you load xcolor, and added the table option? Iformatted the numbers using the siunitx package. Finally, as I don't have pythontex installed I had to comment the line where it's used:

\documentclass{article}
\usepackage{ragged2e}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.5in, bottom=0.5in, left=1.55in, right=1.55in]{geometry}
\usepackage{multirow,array,varwidth,spreadtab,caption}
\usepackage[norule]{footmisc}
%\usepackage{pythontex}
\usepackage{siunitx,booktabs,caption}
\usepackage{ragged2e}
\usepackage{layout}
\usepackage{xtab}
\usepackage{float}
\usepackage{gensymb}
\usepackage{hyperref}
\usepackage[some,bottom]{background}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage{colortbl}
\PassOptionsToPackage{xcolor}{table}
\usepackage{multicol}
\usepackage{indentfirst}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{rgb}{0.88,1,1}
\usepackage{siunitx} 
\sisetup{table-format=6.0,group-separator ={,}}

\begin{document}

\begin{table}[ht]
\centering\setlength\extrarowheight{2pt}
\label{tab:multicol}
\begin{tabular}{|c|c|S|S[table-format=5.0]|S|}
    \multicolumn{5}{c}{\thead{NET ENTITLEMENT FISH OIL MARKETS\\ AS OF DECEMBER 31, 2019}}\\
    \hline%
 \rowcolor{LightCyan}
Country & Company & {\makecell{Proved Cooked\\T}} & {\makecell{Proved Uncooked\\T}}& {\makecell{Total Proved \\T}}\\
\hline
% ChUAN& \pyc{print("{}".format(row[0]))} &51,574&31,202&82,776\\\hline
    IraW-West POINT & & 9656 &57981&67 637\\\hline
     \multicolumn{1}{|c|}{\multirow{3}{*}{KAZSLSKDE}}& PKKR& 32129 & 5174 & 37304 \\\cline{2-5}
     \multicolumn{1}{|c|}{}&KOLKOL&9718 & 3447 & 13165\\\cline{2-5}
     \multicolumn{1}{|c|}{}&PKPK& 424 & 0& 424\\\hline
     TOTAL CNNNO & & 103501 & 97804 & 201306\\\hline
\end{tabular}
\end{table}

\end{document}

enter image description here

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