我想强制ieeetran
开始一个新页面,在顶部显示一个宽(即 2 列)图形,并在其下方渲染文本。到目前为止,我无法以“确定性”的方式实现此行为,而我发现的唯一解决方法是将宽图形放在页面顶部,通过繁琐的反复试验过程将其实例化移回文本代码的先前部分,但这会导致混乱,因为我最终在整个代码中都出现了看似随机的实例化。相反,我想将图形实例保留在它们所属部分的代码中,但如果我这样做,似乎不可能强制将它们渲染在页面顶部。我该如何实现这一点?谢谢,Jorge。
例子:
\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{lipsum}
\begin{document}
\begin{figure*}[!t]
\centering
\subfloat[]{\includegraphics[width=0.4\linewidth]{example-image-a}}
\hfill
\subfloat[]{\includegraphics[width=0.4\linewidth]{example-image-b}}
\caption{Some dummy figures.}
\label{fig1}
\end{figure*}
\section{This text should follow Fig. \ref{fig1}, not precede it!}
\lipsum[1-6]
% Problem happens also after a \clearpage
\clearpage
\begin{figure*}[!t]
\centering
\subfloat[]{\includegraphics[width=0.8\linewidth,height=0.2\textheight]{example-image-c}}
\caption{Another figure.}
\label{fig2}
\end{figure*}
\section{This text should follow Fig. \ref{fig2}, not precede it!}
\lipsum[1-6]
\end{document}
输出:
答案1
该方法类似于这里,但更简单。请注意,没有标题的图形不会显示在图形列表中。
\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{lipsum}
\usepackage{afterpage}
\makeatletter
\newcommand{\setcaptype}[1]{\def\@captype{#1}}
\makeatother
\newsavebox{\tempbox}
\begin{document}
\savebox{\tempbox}{\begin{minipage}{\textwidth}% measuer height of figure
\setcaptype{figure}%
\centering
\subfloat[]{\includegraphics[width=0.4\linewidth]{example-image-a}}
\hfill
\subfloat[]{\includegraphics[width=0.4\linewidth]{example-image-b}}
\caption{Some dummy figures.}
\label{fig1}
\end{minipage}}
\begin{figure}[t]
\rlap{\usebox\tempbox}
\end{figure}
\afterpage{\begin{figure}[t]% next column
\rule{0pt}{\dimexpr \ht\tempbox+\dp\tempbox}
\end{figure}}
\section{This text should follow Fig. \ref{fig1}, not precede it!}
\lipsum[1-6]
% Problem happens also after a \clearpage
\clearpage
\savebox{\tempbox}{\begin{minipage}{\textwidth}% measuer height of figure
\setcaptype{figure}%
\centering
\subfloat[]{\includegraphics[width=0.8\linewidth,height=0.2\textheight]{example-image-c}}
\caption{Another figure.}
\label{fig2}
\end{minipage}}
\begin{figure}[t]
\rlap{\usebox\tempbox}
\end{figure}
\afterpage{\begin{figure}[t]% next column
\rule{0pt}{\dimexpr \ht\tempbox+\dp\tempbox}
\end{figure}}
\section{This text should follow Fig. \ref{fig2}, not precede it!}
\lipsum[1-6]
\end{document}