I am writing a research paper in where I have to write a table in latex. My Code in latex is as follows:
\begin{table}[!t]
\noindent\makebox[\textwidth]{
\begin{tabular}{|r|r|r|r}
\hline
cell1 & cell2 & cell3 \\
\hline
cell4 & cell5 & cell6 \\
\hline
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
}
\captionsetup{justification=centering}
\caption{Some caption}
\end{table}
But the table is now colliding with section content as described in the screenshot. How can I get rid of this?
Also, I want to center my caption of table which does not work here. How can I do this ?
[!t]
with[htb]
.\noindent\makebox[\textwidth]{
is completely wrong here it is adding a word space (from the newline after{
) to the left of the table and then centering the tabular in the width of the page when your image suggestes that you have a two column docuemnt and this is a single column float. Just remove the whole line and use\centering
to centre the tabular within the column\centering
. The proper way to center a tabular is the following\begin{table}[htp] \centering <tabular and stuff> \end{table}