I've inserted a table in my LaTeX document and have used \center
to horizontally align it to the centre of the page. However, it's appearing a page after where it should, is both horizontally and vertically aligned to the centre and appears after some text which it should precede.
What's going wrong?
EDIT: Edited to add a Minimal Working Example (though, given that I don't know what could be causing the problem, I can't guarantee minimality).
\large
\textbf{Section 2}
\\
\normalsize
\textbf{Description of section}.
\begin{figure}[h]
\center
\caption{Sample output}
\includegraphics[width=10cm,height=3cm]{/Users/Matt/Desktop/Figures/2.jpg}
\label{fig:2}
\end{figure}
\textbf{Hello}. Below are the results. \\
\begin{table}[ht]
\caption{Caption}
\center
\begin{tabular}{c c c}
\hline \hline
A & B & C \\
\hline
1 & a & A \\
2 & b & B \\
3 & c & C \\
4 & d & D \\
5 & e & E \\
6 & f & F \\
7 & g & G \\
\hline
\end{tabular}
\end{table}
%Section 2 end
\Large
\textbf{Title}
\large
\textbf{Section 3}
\
\begin{table}[p]
(page) could be causing the table to be set on its own page. If you just used[h]
(here) then try addingt
(top) to it, as if the table runs over a page with just[h]
it can default to page.\centering
instead of just\center
?. If you don't want a table to float beyond a certian point use theplaceins
package's command\FloatBarrier
where appropriatedocumentclass
& pre-amble, and can be compiled without editing. Also, using\` outside of the
tabular` environment in the way you have is not appropriate- I recommend readingThe Not so short guide to LaTeX
for an overview of the basics.