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*}
tabularx
in atable
environment is to specify that it can be moved, so basically what you describe is expected. You are usingtable*
which are spanning tables which can not come mid page after your text, perhaps you intendedtable
for a single column table, and includeh
in the options.\FloatBarrier
will do nothing at the point that you have it as there are no pending floats at that point.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.the data in table~\ref{tab:table1}....
rather thanthe table below
.\onecolumn
before the appendix then use an[h]
table under the heading, or several other approaches, it all depends...