0

I am trying to place a table immediately below some text but Latex keeps putting it either above or at the bottom if the page.

I have using FloatBarrier but it has no effect. Removing the t option from the table places it at the bottom of the page creating a large gap of white space under the text. I also tried \raggedbottom which did not help.

I have read that LaTeX inserts floats before text and I don't understand why it does so and how to put the table in the right order.

How can I place the table directly below the text?

This is my MWE:

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage[style=numeric,autocite=plain,backend=biber,bibencoding=utf8]{biblatex}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{stfloats}
\usepackage{placeins}
\raggedbottom

\begin{document}
\appendix  %
hello!
\FloatBarrier
\input{table}
\end{document}

And the table:

\begin{table*}[htbp]

    \caption{Title}
    \label{tab:table1}
    %\begin{center}
    \begin{tabularx}{\linewidth}{@{} l l l X @{}}
        \toprule
        \textbf{Authors} & \textbf{Year} & \textbf{Methods} & \textbf{Comments} \\
        \midrule
        \citeauthor{Name2020} & \citeyear{Name2020} & Method 1 & Comment 1 \\
        \midrule
        \citeauthor{Name2019} & \citeyear{Name2019} & Method 2 & Comment 2 \\
        \bottomrule
    \end{tabularx}
\end{table*}

8
  • 2
    the only reason to wrap the tabularx in a table environment is to specify that it can be moved, so basically what you describe is expected. You are using table* which are spanning tables which can not come mid page after your text, perhaps you intended table for a single column table, and include h in the options. Mar 15, 2020 at 15:16
  • 1
    \FloatBarrier will do nothing at the point that you have it as there are no pending floats at that point. Mar 15, 2020 at 15:17
  • 2
    well if it spans two columns it can not possibly come immediately after the one-column text hello. spanning floats go at the top or (with the stfloats package you are using, also the bottom) of the page. It isn't clear what [h] would mean for a spanning float but it is not supported in any case. Mar 15, 2020 at 15:27
  • 1
    This is why typesetting systems allow tables to float, allow it to float to the top of the page, give it a caption and refer to it indirectly by the data in table~\ref{tab:table1}.... rather than the table below. Mar 15, 2020 at 15:29
  • 1
    you could use \onecolumn before the appendix then use an [h] table under the heading, or several other approaches, it all depends... Mar 15, 2020 at 15:30

1 Answer 1

1

Two-column floats can not come mid-page, but to get one under a heading you can usually do

\onecolumn
\section{Appendix whatever}
\begin{table}[htp]
\centering
\caption{zzzz}
\begin{tabular}...

To get a [h] here float under the heading in a single-column appendix of an otherwise two column document.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .