代码如下
\documentclass[%
reprint,
amsmath,amssymb,
aps,
]{revtex4-2}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{caption} % For controlling captions
\usepackage{subcaption} % For subfigure
\usepackage{float}
\usepackage{hyperref}% add hypertext capabilities
\usepackage[mathlines]{lineno}% Enable numbering of text and display math
\usepackage{mwe} % For example images
\begin{document}
\begin{figure*}[htbp]
\centering
% First row of images (subfigure 1 and subfigure 2)
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-a}
\caption*{}\label{a}
\end{subfigure}%
\hspace{0.1cm}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-b}
\caption*{}\label{b}
\end{subfigure}
% Second row of images (subfigure 3 and subfigure 4)
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-c}
\caption*{}\label{c}
\end{subfigure}%
\hspace{0.1cm}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image}
\caption*{}\label{d}
\end{subfigure}
\caption{Overall caption for the entire figure.}
\label{fig2:mainfig}
\end{figure*}
In Fig.~\ref{fig2:mainfig}~(\ref{a}), (\ref{b}), and (\ref{c}), we show ...
\end{document}
编译之后无法正常显示In Fig. 1 (??), (??), and (??), we show ...
个人认为你这个问题的本质是revtex4-2
的双栏布局和单栏的figure
之间的冲突。当你使用article
文档类时代码并没有什么问题;而使用revtex4-2
出错,说明是revtex4-2
的问题。好的问题题目会方便其他人检索到。
\caption*
用法说明
要想引用必须有内容
(我不是太理解为什么你一定要藏起来subcaption
的(a)(b)(c)(d)?这样读者很难快速定位到Fig.4(d)和Fig.8(e)指的是哪个吧)
https://www.latexstudio.net/index/details/index/mid/3922.html
源代码中的 \onecolumngrid
和 \twocolumngrid
进行切换 (但我不是太懂revtex4-2
...)
\documentclass[reprint,aps,amsmath,amssymb,]{revtex4-2}
\usepackage{graphicx}% Include figure files
\usepackage{subcaption} % For subfigure
\usepackage{float}
\usepackage{lipsum}
\usepackage{hyperref}% add hypertext capabilities
\begin{document}
\lipsum[1-9]
\onecolumngrid
\begin{figure*}[htbp]
\centering
% First row of images (subfigure 1 and subfigure 2)
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-a}
\caption{}\label{a}
\end{subfigure}%
\hspace{0.1cm}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-b}
\caption{}\label{b}
\end{subfigure}
% Second row of images (subfigure 3 and subfigure 4)
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image-c}
\caption{}\label{c}
\end{subfigure}%
\hspace{0.1cm}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth, keepaspectratio]{example-image}
\caption{}\label{d}
\end{subfigure}
\caption{Overall caption for the entire figure.}
\label{fig2:mainfig}
\end{figure*}
\twocolumngrid
In Fig.~\ref{fig2:mainfig}~(\ref{a}), (\ref{b}), and (\ref{c}), we show ...
\lipsum[10-12]
\end{document}