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*}
tabularxin atableenvironment 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 intendedtablefor a single column table, and includehin the options. – David Carlisle Mar 15 '20 at 15:16\FloatBarrierwill do nothing at the point that you have it as there are no pending floats at that point. – David Carlisle Mar 15 '20 at 15:17tablebut it did not work very well as the table got squeezed into one column. – Marcus Mar 15 '20 at 15:23hello. 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. – David Carlisle Mar 15 '20 at 15:27the data in table~\ref{tab:table1}....rather thanthe table below. – David Carlisle Mar 15 '20 at 15:29Appendixon the previous page? – Marcus Mar 15 '20 at 15:29\onecolumnbefore the appendix then use an[h]table under the heading, or several other approaches, it all depends... – David Carlisle Mar 15 '20 at 15:30\onecolumngave me the desired output. – Marcus Mar 15 '20 at 15:36