2

how can I remove the light gray color in the first column below t. Tq.

\begin{table}[h!]
{\textbf{\caption {Numerical results for $y_{1}(t)$, $y_{2}(t)$ (light gray color) in Example \ref{example 1.2}}}}
 \begin{center}
\label{table61} \addtocontents{lot}{\protect\addvspace{.5cm}}
\begin{footnotesize}
\vspace{0.5cm} \scriptsize
\begin{tabular}{cccccc}
&      & \multicolumn{4}{c}{CWFD} \\
\cline{3-6} \\
t&ChC\;\cite{} &$M=10, k=1$&$M=7, k=2$&$M=10, k=2$&$M=12, k=2$\\\hline
0.2 &0.389$\times10^{-9}$&3.766$\times10^{-10}$&2.366$\times10^{-9}$&2.030$\times10^{-12}$&3.228$\times10^{-15}$\\
\rowcolor{lightgray}    &0.623$\times10^{-6}$&1.005$\times10^{-8}$&1.293$\times10^{-8}$&4.668$\times10^{-11}$&3.822$\times10^{-14}$\\\hline
0.4 &0.535$\times10^{-9}$&2.948$\times10^{-9}$&2.787$\times10^{-9}$&9.351$\times10^{-14}$&4.062$\times10^{-15}$\\
\rowcolor{lightgray}& 0.408$\times10^{-6}$&5.823$\times10^{-8}$&1.425$\times10^{-9}$&4.220$\times10^{-12}$&2.814$\times10^{-14}$\\\hline
0.6 &0.143$\times10^{-7}$&1.801$\times10^{-9}$&4.003$\times10^{-9}$&7.782$\times10^{-12}$&2.632$\times10^{-14}$\\
\rowcolor{lightgray}     & 0.362$\times10^{-6}$&3.758$\times10^{-8}$&6.360$\times10^{-8}$&5.791$\times10^{-11}$&7.850$\times10^{-13}$\\\hline
0.8 &0.501$\times10^{-7}$&1.198$\times10^{-11}$&1.296$\times10^{-8}$&1.868$\times10^{-11}$&4.453$\times10^{-14}$\\
\rowcolor{lightgray}     & 0.475$\times10^{-5}$&6.207$\times10^{-10}$&1.462$\times10^{-7}$&1.226$\times10^{-10}$&1.649$\times10^{-12}$\\\hline
1.0 &0.332$\times10^{-6}$&1.152$\times10^{-10}$&1.730$\times10^{-8}$&2.728$\times10^{-11}$&2.181$\times10^{-14}$\\
 \rowcolor{lightgray}    &0.982$\times10^{-5}$&9.882$\times10^{-10}$&1.985$\times10^{-7}$&1.696$\times10^{-10}$&2.261$\times10^{-12}$
\end{tabular}
\end{footnotesize}
\end{center}
\end{table}
  • Please re-format your code. Use the bottom "{ } (Code Sample)" to do it again. – Wayne Tsai Aug 8 '16 at 4:23
  • Please provide a minimal working example (mwe). According to your code, just remove \rowcolor{lightgray}. Do you mean only the 1st column? – azetina Aug 8 '16 at 4:28
  • Yes I want to have the first column with white color but others gray color – Oliver Aug 8 '16 at 5:03
  • There are also the \columncolor and \cellcolor commands. – jon Aug 8 '16 at 5:11
3

See, if you like to have something similar to the following:

enter image description here

In resetting of your table I exploit some packages which make it easy and gives better (more beautiful) results:

  • for caption: caption package with option font=\bf
  • for columns type I use S from package siunitx, which simplify typing of cel content from &0.389$\times10^{-9}$ to 0.389e-9

Beside this the mismatch with table font size I replace with simple \footnotesize (this is easy change to desired size), replace \begin{center} ... \end{center} with \centering, which not add spurious vertical space. Also is considered suggestion in above comments how to remove gray colors in the first column with \cellcolor{white}.

According to my taste I also remove horizontal lines in table, but if you like to have, you can return it :-). With all thee the MWE with your table is:

\documentclass{article}
\usepackage[font=bf]{caption}
\usepackage[table]{xcolor}
\usepackage{siunitx}

\begin{document}
\begin{table}[h!]
\caption {Numerical results for $y_{1}(t)$, $y_{2}(t)$ (light gray color) in Example \ref{example 1.2}}
    \centering
\label{table61} 
%\addtocontents{lot}{\protect\addvspac.5cm}}
%\begin{footnotesize}
%\vspac0.5cm}
%    \scriptsize
    \footnotesize
\renewcommand\arraystretch{1.2}
\begin{tabular}{     S[table-format=1.1]
                *{5}{S[table-number-alignment = center,
                       table-format = 1.3,
                       table-figures-exponent = 2]}
                }%ccccc}
 &      & \multicolumn{4}{c}{CWFD} \\
    \cline{3-6}
t   &   ChC \cite{} 
                & {$M=10, k=1$} 
                           & {$M=7, k=2$} 
                                      & {$M=10, k=2$} 
                                                  & {$M=12, k=2$}   \\
    \hline
0.2 & 0.389e-9 & 3.766e-10 & 2.366e-9 & 2.030e-12 & 3.228e-15       \\
    \rowcolor{lightgray}
\cellcolor{white} 
    & 0.623e-6 & 1.005e-8  & 1.293e-8 & 4.668e-11 & 3.822e-14       \\
0.4 & 0.535e-9 & 2.948e-9  & 2.787e-9 & 9.351e-14 & 4.062e-15       \\
    \rowcolor{lightgray}
\cellcolor{white} 
    & 0.408e-6 & 5.823e-8  & 1.425e-9 & 4.220e-12 & 2.814e-14       \\
0.6 &0.143e-7 & 1.801e-9   & 4.003e-9 & 7.782e-12 & 2.632e-14       \\
    \rowcolor{lightgray}
\cellcolor{white}
    & 0.362e-6 & 3.758e-8  & 6.360e-8 & 5.791e-11 & 7.850e-13       \\
0.8 & 0.501e-7 & 1.198e-11 & 1.296e-8 & 1.868e-11 & 4.453e-14       \\
    \rowcolor{lightgray}
\cellcolor{white}
    & 0.475e-5 & 6.207e-10 & 1.462e-7 & 1.226e-10 & 1.649e-12   \\
\cellcolor{white} 
1.0 & 0.332e-6 & 1.152e-10 & 1.730e-8 & 2.728e-11 & 2.181e-14   \\
    \rowcolor{lightgray}
\cellcolor{white} 
    & 0.982e-5 & 9.882e-10 & 1.985e-7 & 1.696e-10 & 2.261e-12   \\
    \hline
\end{tabular}
%\end{footnotesize}
%\end{center}
\end{table}
    \end{document}
  • +1 for recommending the use of the siunitx package and for simplifying the material inside the tabular environment. :-) – Mico Aug 8 '16 at 6:31
1

I would recommend that you not highlight alternating rows in gray. Instead, simply insert a bit of whitespace after every second row, and provide a short legend to inform readers what the first and second row of each pair of rows shows. Incidentally, you needn't use \footnotesize or even \scriptsize -- the tabular material fits if you use the normal font size. Just use a tabular* environment to assure that the table fits inside the text block.

As @Zarko does in his answer, I would also recommend that you use some of the tools of the siunitx package to simplify and structure the inputs of the tabular material.

enter image description here

\documentclass{article}
\usepackage{booktabs,siunitx,caption}
\captionsetup{font=bf,skip=0.75\baselineskip}
\begin{document}
\begin{table}[h!]
\caption{Numerical results for $y_{1}(t)$ and $y_{2}(t)$ in Example XYZ}
\label{table61}
\setlength\tabcolsep{0pt}
%%\small

Results for $y_{1}(t)$ ($y_{2}(t)$) are shown in upper (lower) row of each pair of rows.

\bigskip
\sisetup{tight-spacing = true, table-format = 1.3, table-figures-exponent = 2}
\begin{tabular*}{\textwidth}{ c @{\extracolsep{\fill}} *{5}{S} }
$t$ & {ChC} & \multicolumn{4}{c}{CWFD} \\
\cmidrule{3-6}
&& {$M=10$, $k=1$} & {$M=7$, $k=2$} & {$M=10$, $k=2$} & {$M=12$, $k=2$}\\
\midrule
0.2 &0.389E-9&3.766E-10&2.366E-9&2.030E-12&3.228E-15\\
    &0.623E-6&1.005E-8&1.293E-8&4.668E-11&3.822E-14\\
\addlinespace
0.4 &0.535E-9&2.948E-9&2.787E-9&9.351E-14&4.062E-15\\
    &0.408E-6&5.823E-8&1.425E-9&4.220E-12&2.814E-14\\
\addlinespace
0.6 &0.143E-7&1.801E-9&4.003E-9&7.782E-12&2.632E-14\\
    &0.362E-6&3.758E-8&6.360E-8&5.791E-11&7.850E-13\\
\addlinespace
0.8 &0.501E-7&1.198E-11&1.296E-8&1.868E-11&4.453E-14\\
    &0.475E-5&6.207E-10&1.462E-7&1.226E-10&1.649E-12\\
\addlinespace
1.0 &0.332E-6&1.152E-10&1.730E-8&2.728E-11&2.181E-14\\
    &0.982E-5&9.882E-10&1.985E-7&1.696E-10&2.261E-12\\
\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.