How can I put a figure that spans both of the two columns text at middle or desired position of a page (not at top or bottom).
\documentclass{IEEEtran}
\begin{document}
\begin{figure*}[h]
\includegraphics{image-file}
\end{figure*}
\end{document}
How can I put a figure that spans both of the two columns text at middle or desired position of a page (not at top or bottom).
\documentclass{IEEEtran}
\begin{document}
\begin{figure*}[h]
\includegraphics{image-file}
\end{figure*}
\end{document}
To illustrate Barbara Beeton's point. Note that the insert \vspace does not have to be at the precise location, but does have to be somewhere in the last line before the break.
\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage{lipsum}
\newlength{\tempheight}
\begin{document}
\lipsum[1]
\begin{figure}[h]
\sbox0{% get height
\begin{minipage}{\textwidth}
\centering
\includegraphics{example-image}
\caption{test}
\end{minipage}}%
\global\tempheight=\dimexpr \ht0+\dp0+2\intextsep\relax
\rlap{\usebox0}
\end{figure}
\lipsum[2-3]
Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel
justo vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. In hac habitasse platea dictumst.
Integer tempus convallis augue. Etiam facilisis. Nunc elementum
fermentum wisi. Aenean placerat. Ut imperdiet, enim sed
gravida sollicitudin, felis odio placerat quam, ac pulvinar elit
purus eget enim.
\vspace{\tempheight}% ***** insert blank space here *****
Nunc vitae tortor. Proin tempus nibh sit amet
nisl. Vivamus quis tortor vitae risus porta vehicula.
\lipsum[5-6]
\end{document}
This solution is based on the shortpage macro. Restrictions: (1) The text argument must start on the previous page. (2) There can be no floats in the text argument. (3) Text argument must consists of one or more complete paragraphs.
Note that you read both columns above the figure* before starting the columns below the figure*.
\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage{afterpage}
\usepackage{multicol}
\usepackage{lipsum}
\newsavebox{\shortpagebox}
\newsavebox{\shortpagefigure}
\makeatletter
\newcommand{\shortpage}[2]% #1 = text, #2 = figure*
{\par
\setbox\shortpagebox=\vbox{\strut #1\par}% cram text together
\global\setbox\shortpagefigure=\vbox{\hsize=\textwidth
\def\@captype{figure}%
#2}% store figure
\afterpage{\twocolumn[%
\begin{multicols}{2}
\unvbox\AP@partial
\end{multicols}\par
\vskip\intextsep
\box\shortpagefigure
\vskip\dbltextfloatsep]}
\unvbox\shortpagebox
\par}
\makeatother
\begin{document}
\lipsum[1-10]\strut
%\hrule% locate start of short page
\shortpage{\lipsum[11-12]}%
{\centering
\includegraphics{example-image}
\caption{test}}
\lipsum[12-16]
\end{document}