I am using the figure* and table* environments to place figures and tables in my document. I am using revtex4-2 documentclass and so each page is divided into two columns of text. So I need to use figure* and table* instead of figure and table environment as my figures and tables are big, and need to span both the columns of text horizontally. However, some of my figures and tables are getting placed after or in the middle of the bibliography. How do I solve this problem?
I have provided a code below that will replicate this problem.
\documentclass[aps,prd,reprint,groupeaddress,showpacs,preprintnumbers,nofootinbib,nobibnotes,amsmath,amssymb,floatfix,superscriptaddress]{revtex4-2}
\usepackage[colorlinks=true,linkcolor=red,citecolor=blue,urlcolor=blue]{hyperref}
%,groupedaddress
%\usepackage[numbers]{natbib}
\usepackage{hyperref}
\hypersetup{
colorlinks = true, % Colours links instead of ugly boxes
urlcolor = blue, % Colour for external hyperlinks
linkcolor = navy, % Colour of internal links
}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{graphicx}
\usepackage{color}
\usepackage{float}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{natbib}
\usepackage[T1]{fontenc}
\begin{document}
Filler text including citations
\begin{figure}
\centering
\input{plot1.tex}
\caption{Plot 1 }
\label{fig.1}
\end{figure}
\begin{figure}
\centering
\input{plot2.tex}
\caption{Plot 2 }
\label{fig.2}
\end{figure}
\begin{table}\label{table 1}
\centering
\caption{Table. \label{table 1}}
\begin{tabular}[t]{cccccccccccccccccccccc}
\toprule \toprule
&&& & \multicolumn{7}{c}{\makecell{With E}}
&&& & \multicolumn{7}{c}{\makecell{Without E}} \
\cmidrule{5-11}\cmidrule{15-21}
&&& &DD1 && &DD2 && &DD3 &&& &DD1 && &DD2 && &DD2\
\midrule
$K$ &&& &2.86 && &2.94 && &2.84
&&& &2.85 && &2.93 && &2.82 \
$\bar{K}$ &&& &4.66 && &4.86 && &4.64
&&& &4.65 && &4.86 && &4.63 \
\bottomrule \bottomrule
\end{tabular}
\end{table}
\bibliography{references}
\end{document}
Also, is there a way to place my figures and tables exactly where I want them to in the page while using the figure* and table*?
Note: Of course, for the code to work and for the problem to be reproduced a proper bibliography list and the figures themselves are required but still I hope the sample code helps.
figure*andtable*will ordinarily be placed at the top of a page, but never in the middle. What's really important though is that the code for such a float must be input before anything else that will appear on the intended page. So it may be necessary to input the float quite a bit earlier than where its reference appears. For more information see Put a table* at the bottom of a page? and How to influence the position of float environments like figure and table in LaTeX? – barbara beeton May 14 '22 at 15:44