# Table width issue in two-column document

column document. I am trying to insert a table, but my table is going out to the page and all I see is about half of the full table . The code is below. How I can fix this issue?

\begin{table*}[!htbp]
\centering
\arrayrulecolor[rgb]{0.212,0.373,0.569}
\begin{tabular}{|l|l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l!{\color[rgb]{0.31,0.506,0.741}\vrule}l|}
\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{\textbf{ Works }}}                                                    & \multicolumn{12}{c|}{\textbf{ Duration of Project }}                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \\
\cline{2-13}
\multicolumn{1}{|c|}{}                                                                                     & \multicolumn{6}{c!{\color[rgb]{0.31,0.506,0.741}\vrule}}{\textbf{ 1st Year (Months) }}                                                                                                                                                                                         & \multicolumn{6}{c|}{\textbf{ 2nd Year (Months) }}                                                                                                                                                                                              \\
\cline{2-13}
\multicolumn{1}{|c|}{}                                                                                     & \multicolumn{1}{c!{\color[rgb]{0.31,0.506,0.741}\vrule}}{\textbf{ 2 }} & \textbf{ 4 }                          & \textbf{ 6 }                          & \textbf{ 8 }                          & \textbf{ 10 }                         & \textbf{ 12 }                         & \textbf{ 2 }                          & \textbf{ 4 }                          & \textbf{ 6  }                         & \textbf{ 8  }                         & \textbf{ 10 }                         & \textbf{ 12 }                          \\
\hline
Literature survey,
purchase of chemicals                                                                 & ~                                                                      & {\cellcolor[rgb]{0.776,0.851,0.945}}~ & {\cellcolor[rgb]{0.776,0.851,0.945}}~ & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                      \\
\hhline{|------------>{\arrayrulecolor[rgb]{0.329,0.553,0.831}}->{\arrayrulecolor[rgb]{0.212,0.373,0.569}}|}
Synthesis
and calcination of BaFe0.9-xNbxO3-δ
(x: 0, 0.05 and 0.1) perovskite powders.                 & ~                                                                      & ~
~                                 & ~                                     & {\cellcolor[rgb]{0.722,0.8,0.894}}~   & {\cellcolor[rgb]{0.722,0.8,0.894}}~   & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                      \\
\hline
Characterizations of BaFe0.9-xNbxO3-δ
(x: 0, 0.05 and 0.1) perovskite powders.                           & ~                                                                      & \multicolumn{1}{l|}{~}                & \multicolumn{1}{l|}{~}                & ~                                     & ~                                     & {\cellcolor[rgb]{0.584,0.702,0.843}}~ & {\cellcolor[rgb]{0.584,0.702,0.843}}~ & ~                                     & ~                                     & ~                                     & ~                                     & ~                                      \\
\hline
Fabrication and densification of bulk BaFe0.9-xNbxO3-δ (x: 0, 0.05 and 0.1) samples                        & ~                                                                      & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & {\cellcolor[rgb]{0.329,0.553,0.831}}~ & {\cellcolor[rgb]{0.329,0.553,0.831}}~ & ~                                     & ~                                     & ~                                      \\
\hline
Density
and microstructural studies of BaFe0.9-xNbxO3-δ
(x: 0, 0.05 and 0.1) bulk samples              & ~                                                                      & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & {\cellcolor[rgb]{0.212,0.373,0.569}}~ & {\cellcolor[rgb]{0.212,0.373,0.569}}~ & ~                                     & ~                                      \\
\hhline{|~------------|}
Stress-strain curves and ferro elastic hysteresis loops studies using
cyclic uniaxial compression tests. & ~                                                                      & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & ~                                     & {\cellcolor[rgb]{0.141,0.251,0.38}}~  & {\cellcolor[rgb]{0.141,0.251,0.38}}~   \\
\hline
Publications of the
analyzed results                                                                     & ~                                                                      & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~ & {\cellcolor[rgb]{0.086,0.149,0.227}}~  \\
\hline
\end{tabular}
\arrayrulecolor{black}
\end{table*}

• Which documentclass do you use? Please make your document compilable. (See minimal working example (MWE)) – leandriis Jul 16 '20 at 14:57
• In order to ensure your table fits into the textwidt, you might want to use tabularx and an X type column for the first column. – leandriis Jul 16 '20 at 15:00
• Unrelated to the issue itself but you might want to makeuse of chemformula of mhchem in order to typeset the molecular folmulae of your perovskites. – leandriis Jul 16 '20 at 15:03
• \documentclass[11pt,twocolumn]{article} – user220593 Jul 16 '20 at 15:26
• I need your help to set my table I am going to be send you my email sanilbhai@ug.uchile.cl – user220593 Jul 16 '20 at 15:29

• Use a tabularx environment instead of a tabular environment, and use (a modified form of) the X column type for the first column.

• Get rid of all ~ ("tie") spacers; that way, the 11 data columns take up a lot less space, meaning that there's more space available for the first column.

• No useful purpose appears to be served by wrapping all \cellcolor directives in extra pairs of curly braces.

• The \multicolumn{1}{|c|}{} directives don't do anything useful.

• You could load the mhchem package and use its \ce macro to typeset the expression BaFe_{0.9-x}Nb_{x}O_{3-δ}.

\documentclass[11pt,twocolumn]{article}
\usepackage[table]{xcolor}
\usepackage{hhline}

%% new stuff:
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X}
\usepackage{upgreek,amsmath,newunicodechar}
\newunicodechar{δ}{\ensuremath{\updelta}}
\usepackage{mhchem} % for '\ce' macro
\newcommand\BFNO{\ce{BaFe_{0.9-x}Nb_{x}O_{3-δ}}} % handy shortcut macro

\begin{document}
\begin{table*} % make table span both columns
\arrayrulecolor[rgb]{0.212,0.373,0.569}
\setlength\extrarowheight{2pt} % <-- for a more open "look"
\begin{tabularx}{\textwidth}{| L *{12}{!{\color[rgb]{0.31,0.506,0.741}\vrule}c} |}
\hline
\textbf{Works} &
\multicolumn{12}{c|}{\textbf{Duration of Project, in Months}} \\
\cline{2-13}
&
\multicolumn{6}{c!{\color[rgb]{0.31,0.506,0.741}\vrule}}{\textbf{1st Year}} &
\multicolumn{6}{c|}{\textbf{2nd Year}} \\
\cline{2-13}
&
\multicolumn{1}{c!{\color[rgb]{0.31,0.506,0.741}\vrule}}{\textbf{2}}
& \textbf{4} & \textbf{6} & \textbf{8} & \textbf{10} & \textbf{12}
& \textbf{2} & \textbf{4} & \textbf{6} & \textbf{8} & \textbf{10} & \textbf{12} \\
\hline

%% Body of Table:
Literature survey, purchase of chemicals
& & \cellcolor[rgb]{0.776,0.851,0.945}
& \cellcolor[rgb]{0.776,0.851,0.945}
& & & & & & & & &  \\
\hhline{|-----------%
->{\arrayrulecolor[rgb]{0.329,0.553,0.831}}%
->{\arrayrulecolor[rgb]{0.212,0.373,0.569}}|}
Synthesis and calcination of \BFNO{}
($x$: 0, 0.05 and 0.1) perovskite powders.
& &
& & \cellcolor[rgb]{0.722,0.8,0.894}
& \cellcolor[rgb]{0.722,0.8,0.894}
& & & & & & &  \\
\hline
Characterizations of \BFNO{}
($x$: 0, 0.05 and 0.1) perovskite powders.
& & \multicolumn{1}{l|}{}
& \multicolumn{1}{l|}{} & &
& \cellcolor[rgb]{0.584,0.702,0.843}
& \cellcolor[rgb]{0.584,0.702,0.843}
& & & & &  \\
\hline
Fabrication and densification of bulk \BFNO{}
($x$: 0, 0.05 and 0.1) samples
& & & & & & &
& \cellcolor[rgb]{0.329,0.553,0.831}
& \cellcolor[rgb]{0.329,0.553,0.831}
& & &  \\
\hline
Density and microstructural studies of \BFNO{}
($x$: 0, 0.05 and 0.1) bulk samples
& & & & & & & &
& \cellcolor[rgb]{0.212,0.373,0.569}
& \cellcolor[rgb]{0.212,0.373,0.569}
& &  \\
\hline
Stress-strain curves and ferro elastic hysteresis loops
studies using cyclic uniaxial compression tests.
& & & & & & & & & &
& \cellcolor[rgb]{0.141,0.251,0.38}
& \cellcolor[rgb]{0.141,0.251,0.38}   \\
\hline
Publications of the analyzed results
& & \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}
& \cellcolor[rgb]{0.086,0.149,0.227}  \\
\hline
\end{tabularx}
\end{table*}
\end{document}


Here is my slightly different suggestion, also based on tabularx.

Additionally to using tabularx and an X type column for the first column in order to ensure the table fits into the available text width, I have used wc{...} type columns for the month columns. This makes them equally wide. I have also moved the color definitions to the preamble and made sure all lines share the same color. In addition to that, I have removed the multirow command since you can vertically center the "Works" entry with respect to three rows, even without using \multirow. For the column headers, I have used \thead from the makecell package. If you later on decide you don't want all the headers to be bold, just adapt \renewcommand\theadfont according to your needs. I have also removed redundant \multicolumn commands and {}, as well as all ~. Lastly, I also introduced chemmacros in combination with upgreek to improve the molecular formulae and replaced the \hhline commands with \hlines.

\documentclass[11pt,twocolumn]{article}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{upgreek}
\usepackage{chemmacros}

\definecolor{myblue1}{rgb}{0.776,0.851,0.945}
\definecolor{myblue2}{rgb}{0.722,0.8,0.894}
\definecolor{myblue3}{rgb}{0.584,0.702,0.843}
\definecolor{myblue4}{rgb}{0.329,0.553,0.831}
\definecolor{myblue5}{rgb}{0.212,0.373,0.569}
\definecolor{myblue6}{rgb}{0.141,0.251,0.38}
\definecolor{myblue7}{rgb}{0.086,0.149,0.227}
\begin{document}

\begin{table*}
\arrayrulecolor[rgb]{0.212,0.373,0.569}
\begin{tabularx}{\textwidth}{|>{\raggedright\arraybackslash}X|*{12}{wc{1em}|}}
\hline
\cline{2-13}
\cline{2-13}
\hline
Literature survey,  purchase of chemicals
&  & \cellcolor{myblue1} & \cellcolor{myblue1} & &  &  &  &  &  &  & &   \\
\hline
Synthesis and calcination of \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}}(x: 0, 0.05 and 0.1) perovskite powders.
&  &  &  & \cellcolor{myblue2}   & \cellcolor{myblue2}   &  &  &  &  &  &  &   \\
\hline
Characterizations of \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}} (x: 0, 0.05 and 0.1) perovskite powders.
&  &  &  &  &  & \cellcolor{myblue3} & \cellcolor{myblue3} &  &  &  &  &   \\
\hline
Fabrication and densification of bulk \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}} (x: 0, 0.05 and 0.1) samples
&  &  &  &  &  &  &  & \cellcolor{myblue4} & \cellcolor{myblue4} &  &  &   \\
\hline
Density and microstructural studies of \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}} (x: 0, 0.05 and 0.1) bulk samples
&  &  &  &  &  &  &  &  & \cellcolor{myblue5} & \cellcolor{myblue5} &  &   \\
\hline
Stress-strain curves and ferro elastic hysteresis loops studies using  cyclic uniaxial compression tests.
&  &  &  &  &  &  &  &  &  &  & \cellcolor{myblue6} & \cellcolor{myblue6}    \\
\hline
Publications of the analyzed results
&
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
\\
\hline
\end{tabularx}
\arrayrulecolor{black}
\end{table*}

\end{document}

• +1 for using the chemmacros package and its \ch and \chemdelta macros. – Mico Jul 16 '20 at 18:05

Do not use any positioning suggestions with the table* environment. Thus

\begin{table*}


not

\begin{table*}[!htbp]