1

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}
Dr.PB
  • 767
  • You can't, as far as I know. Anyway, for reading it's better to have it at the top or bottom. (Edit: this is a two-column document, right?) – Torbjørn T. Sep 15 '16 at 10:15
  • 1
    This was already questioned here (How can I insert a large figure in IEEE template?), although it wasn't properly answered, the comments provides this info: user @percusse said "You can't without a serious hack. Two column mode is not straightforward to handle." – Guilherme Zanotelli Sep 15 '16 at 10:37
  • @TorbjørnT. sometimes it requires to have this. – Dr.PB Sep 15 '16 at 10:52
  • 1
    this answer addresses the problem of putting a two-column insert at the bottom of a page. a similar approach can be used for an insert in the middle of a page. the important points are: the insert must be specified in the exact location where it would fall in the first column, and at that corresponding exact location in the second column an "empty" insert of the exact same dimension must be placed. all manual. all subject to restarting the process if anything changes earlier in that document. – barbara beeton Sep 15 '16 at 13:12

2 Answers2

2

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}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
1

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}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120