0

I am trying to place my table at the top of page but it seems there is something I am missing. First of all here is what my document structure

\documentclass{article}
\begin{document}
\section{Introduction}
4 long paragraphs which take exactly one page with this document class.
% Now the actual table starts
\begin{table}
\centering
\caption{Vertical Alignment Test}
\begin{tabular}[t]{ |m{0.85\textwidth}|c| } \hline
Somewhat 20 rows for this table
\end{tabular}
\end{table}
% Table end here
Immediately after table, Same 4 long paragraphs are copied but without \section.
\end{document}

This results in following output document structure

  • Page-1: 4 paragraphs
  • Page-2: Vertically center aligned table
  • Page-3: 4 paragraphs

Problem: Now my table is not as much long that it should take complete page rather if aligned properly at top of page, 2 paragraphs from bottom can be adjusted on page-2.

Tried Solutions

Here is somewhat related question which discusses the same problem. I tried to understand accepted answer and applied given solutions but no luck.

I tried to move table between paragraphs but it didn't change on output file mean same structure keep on outputting i.e. 4 paragraphs -> table -> 4 paragraphs

I cut some rows and at about half of rows (10) table get positioned at top and I get the effect what I wanted. But I don't want 10 rows I want all 20 rows in one table.

Please let me know if there are any questions regarding my explanation.

  • do have a good look at this. I guess the problem is your table being larger than what is allowed at the top of a page. As suggested in the link using [!t] should loosen that restriction and allow your table at the top of the page with some text below. – greyshade Aug 11 '14 at 8:56
  • 1
    What happens if you insert the instructions \renewcommand{\topfraction}{0.8} and \renewcommand{\floatpagefraction}{0.8} in the preamble? – Mico Aug 11 '14 at 8:57
  • Well, in any case, the table should not float around if it should be at top of the page, so remove the table environment and use \captionof{table}{your caption here} in conjunction with \usepackage{caption} – user31729 Aug 11 '14 at 9:00
  • Try putting [htb] after \begin{table} In my test, I get this: i.stack.imgur.com/g1md3.png – user11232 Aug 11 '14 at 9:06
  • 1
    note that your code has a [t] flag on the tabular, which is probably ignored (but remember we don't have a (non-) working document showing all the packages you load). your table environment doesn't have a [t] flag, so will get the default flag set which is inappropriate for you – wasteofspace Aug 11 '14 at 10:17
0

Just to close this off

You have to give the position specifiers to the table environment. It is preferrable to give [htb] instead of [!t] so that latex has some room to improve the appearence.

\documentclass{article}
\usepackage{array,kantlipsum}
\begin{document}
\kant[1-4]
\begin{table}[htb]   %%<<--- give it here
\centering
\caption{Vertical Alignment Test}
\begin{tabular}[t]{ |m{0.85\textwidth}|c| } \hline
Somewhat 20 rows for this table
\end{tabular}
\end{table}
\kant[1-5]
\end{document}

enter image description here

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.