1

I know that this question has been asked before. But I am having real trouble implementing the before-mentioned approaches into my document which is of IEEEtran class.

My code snippet is the following one:

\subsection{Testing the Image}

\begin{figure*}[h!]
        \centerline{\fbox{\includegraphics[width=1\textwidth]{images/Experiment.png}}}
        \caption{Experiment}
\end{figure*}

% TEXT HERE ... 
% TEXT HERE ...
% TEXT HERE ...
% TEXT HERE ...

But the resulting pdf has the image inserted in a new page and not above the %TEXT HERE segments as in the example.

How could I resolve this issue?

MWE

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{tabularx}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{float}
\usepackage{lipsum}  


\begin{document}

    \author
    { 
        \IEEEauthorblockN{ Broxigar }

    }

    \title{Trying to spot this Error}
    \maketitle
    \lipsum
    \begin{figure*}[h!]
        \centering
        \centerline{\fbox{\includegraphics[width=1\textwidth]{eeee.png}}}
        \caption{caption}
        \label{fig}
    \end{figure*}
    \textbf{here???}
    \textbf{anybody????}

\end{document}
ex1led
  • 339
  • 1
    Can you give a reference to "I know that this question has been asked before", furthermore can add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document} – albert Mar 08 '20 at 13:23
  • Okay, i did it....as you can see the here??? and anybody???? added before the image and the image is in the new page. – ex1led Mar 08 '20 at 13:44
  • The best solution is to move the figure* ahead one page, especially using IEEEtran. You could use flowfram or an afterpage loop, but that would essentially move the figure* to the preamble. – John Kormylo Mar 08 '20 at 16:40
  • @JohnKormylo I wish for the image to be at the point that its being inserted. If I add \lipsum after the image it works just fine. But when I try to add custom text, it doesn't – ex1led Mar 08 '20 at 16:45
  • See also https://tex.stackexchange.com/questions/329709/how-to-put-figure-at-middle-or-at-desired-position-on-a-page/329777?r=SearchResults&s=6|11.8424#329777 and https://tex.stackexchange.com/questions/499556/order-of-figure-and-figure-figure-either-goes-to-next-page-or-order-reversed/499579?r=SearchResults&s=1|13.6704#499579 – John Kormylo Mar 08 '20 at 16:51
  • figure* does not support b: https://tex.stackexchange.com/questions/218199/put-figure-at-the-bottom-of-the-first-page#comment511638_218199 and I suppose it does not support h also. (I find full-width h figures weird, because I never know where to continue reading...). You can see also https://tex.stackexchange.com/questions/107270/how-to-put-a-full-width-table-at-the-top-or-bottom-of-the-same-two-column-page-a – Rmano Mar 08 '20 at 17:47
  • you can not use h with figure* and you have removed the option t so most likely you force the image to the end of the document – David Carlisle Mar 08 '20 at 17:57
  • do you really want a figure with a caption or just insert an IEEE logo (can not run your document as it uses an image we don't have) – David Carlisle Mar 08 '20 at 17:59
  • While thinking about it, I came up with a better solution (https://tex.stackexchange.com/questions/329709/how-to-put-figure-at-middle-or-at-desired-position-on-a-page/531802#531802) but it won't work on the first page. – John Kormylo Mar 09 '20 at 23:51

1 Answers1

2

figure* does not support h (it's not clear what that would mean) so [h!] just has the effect of preventing t (top) or p (float page) so makes the float unable to be positioned anywhere until it is flushed out by \clearpage or \end{document}

double column floats always come at the earliest at the top of the next page, so you can pot the figure* immediately after \maketitle and it will come as soon as possible, however there is not enough text in this example to fill the first page, so it comes at the end of the document.

If you really need the figure before here? then you need to force a pagebreak at that point:

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{tabularx}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{float}
\usepackage{lipsum}  


\begin{document}


    \author
    { 
        \IEEEauthorblockN{ Broxigar }

    }

    \title{Trying to spot this Error}
    \maketitle

    \begin{figure*}
        \centering
        \centerline{\fbox{\includegraphics[width=1\textwidth]{example-image.png}}}
        \caption{caption}
        \label{fig}
    \end{figure*}

    \lipsum

\clearpage

    \textbf{here???}
    \textbf{anybody????}

\end{document}

But in most cases it would be better to avoid that, shown here with additional text

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{tabularx}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{float}
\usepackage{lipsum}  


\begin{document}


    \author
    { 
        \IEEEauthorblockN{ Broxigar }

    }

    \title{Trying to spot this Error}
    \maketitle

    \begin{figure*}
        \centering
        \centerline{\fbox{\includegraphics[width=1\textwidth]{example-image.png}}}
        \caption{caption}
        \label{fig}
    \end{figure*}

    \lipsum

    \textbf{here??? see Figure \ref {fig}}
    \textbf{anybody????}

    \lipsum

\end{document}
David Carlisle
  • 757,742