1

I am writing my first paper in latex and have problem when I am about to finish the paper i.e. at the end of the paper.

I used the following code and want to display the figures first before the text.

\begin{figure*}[h]
    \centering
    \includegraphics[]{fig5.png}
       \label{fig:my_label}
  \end{figure*}

\begin{figure}[h] \centering \includegraphics[]{fig6.png} Figure 6: title of figure \label{fig:my_label} \end{figure}

\section{5.Discussion}

In this work, we provided ....... two paragraph I added

then

\section{Conclusion and future work}

In this work, we describe .... two paragraphs

But the problem is that both the figures comes below these texts. I need to put the figures first and then Discussion and conclusion parts to conclude my paper. How can I do that?

Bernard
  • 271,350
  • 1
    Does this answer your question? – Ian Thompson Jan 19 '22 at 22:34
  • @IanThompson, I used "h" option already and now after your comment, also added \usepackage{float} but the problem persist – Neha gupta Jan 19 '22 at 22:38
  • 1
    H not h, but it's worth taking the time to read the reasons for not doing this. – Ian Thompson Jan 19 '22 at 22:40
  • @IanThompson, with H the figures disappear. With "h" figures are showed but at the end of document i.e. before text – Neha gupta Jan 19 '22 at 22:51
  • That's strange. To fix it we'll probably need an example code that reproduces the problem. You can use \rule{4cm}{4cm} in place of the \includegraphics commands, and change the sizes as necessary. – Ian Thompson Jan 19 '22 at 22:54
  • @IanThompson, yes it seems strange because in the rest of document earlier, I used the same code for figures (and tables) and it work fine but these two figures produce problems at the end of the document/paper. – Neha gupta Jan 19 '22 at 23:02
  • 1
    Uh, figure* only supports [tp]. You need dblfloatfix to support [b]. figure* never supports [h] or [H]. You can use multicols or flowfram to modify the columns. – John Kormylo Jan 20 '22 at 05:08
  • I forgot to mention but I am using two column page (IEEE format) – Neha gupta Jan 20 '22 at 12:21

2 Answers2

1

You may try this

\documentclass{article}

\usepackage{graphicx}%manage images \usepackage{multicol}%set multicolumn features in page \usepackage{float}%Places the float at precisely the location in the LaTeX code

\begin{document} \begin{multicols}{2}

\begin{figure}[H] \centering \includegraphics[width=3cm, height=2cm]{fig5.png} \caption{fig: title of figure}

\end{figure} \columnbreak

\begin{figure}[H] \centering
\includegraphics[width=3cm, height=2cm]{fig6.png} \caption{Figure: title of figure}

\end{figure} \end{multicols}

\section{5.Discussion}

In this work, we provided ....... two paragraph I added

then

\section{Conclusion and future work}

In this work, we describe .... two paragraphs

\end{document}

You can control image width and height using width and height values.

c_bfx
  • 48
  • Welcome to TeX:SE! OP ask for positioning of figure*. For it placement see @ John Kormylo comment. – Zarko Jan 20 '22 at 08:16
  • Hi @Zarko OP wants a figure first, before the text. I think in this way it can be done. – c_bfx Jan 21 '22 at 04:24
  • Who knows what OP is after. I doubt that her/his article start with figure (I newer see such article) so before it is some text and image (over two column?) should be before some some section title. Apparently OP nor you are not aware of potential problems with your solution. You should look https://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat/39020#39020 ... – Zarko Jan 21 '22 at 07:32
  • Thanks, I'll read. – c_bfx Jan 21 '22 at 17:26
1

It seems that your question is duplicate to how-to-influence-the-position-of-float-environments. Anyway, due to specific of your question (which is not very clear), some possibilities are summarized below.

In the first, advantage of float environments are that they can float! It is not a sin, if for better looking of document, image is moved after some section title :-).

From use of the figure* environment can be concluded that you use two column article and that you like to span figures over both columns. In this case figure* only supports [tp] (see @John Kormylo comment) and will always appear on the top of the next page (consequently you can float's omit placeholder):

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{multicol}

\usepackage{lipsum}

\begin{document} \lipsum[1-3] \begin{figure} \centering \includegraphics[height=33mm,width=\linewidth]{example-image-A} \caption{fig: title of figure} \end{figure}

\begin{figure} \centering \includegraphics[height=33mm,width=\linewidth]{example-image-B} \caption{Figure: title of figure} \end{figure}

\section{Discussion} \lipsum[4-5]

\section{Conclusion and future work} \lipsum[6-7]

\end{document}

enter image description here

In the case that you estimate, that at bottom of page is sufficient space, it will be placed here by help of package stfloats:

\documentclass[twocolumn]{article}
\usepackage{graphicx} 
\usepackage{multicol} 
\usepackage{stfloats}   % <---

\usepackage{lipsum}

\begin{document} \lipsum[1] \begin{figure}[b] \centering \includegraphics[height=33mm,width=\linewidth]{example-image-A} \caption{fig: title of figure} \end{figure} \begin{figure}[b] \centering \includegraphics[height=33mm,width=\linewidth]{example-image-B} \caption{Figure: title of figure} \end{figure} \lipsum[1-3]

\section{Discussion} \lipsum[4-5]

\section{Conclusion and future work} \lipsum[6-7]

\end{document}

As you see, here images are inserted earlier in text that in page is sufficient space for them. This "trick" is handy in the many cases.

enter image description here

However, in the case of use figure, i.e. that images widths are equal to column width, than you can use figure placement specifier for example htb and newer just [h]. In later case can happen that TeX will push figure on the end of document if in text is not enough space at point of insertion.

\documentclass[twocolumn]{article}
\usepackage{graphicx} 
\usepackage{multicol}

\usepackage{lipsum}

\begin{document} \lipsum[1-6] \begin{figure}[ht] % <--- \centering \includegraphics[height=33mm,width=\linewidth]{example-image-A} \caption{fig: title of figure} \end{figure} \begin{figure}[ht] \centering \includegraphics[height=33mm,width=\linewidth]{example-image-B} \caption{Figure: title of figure} \end{figure}

\section{Discussion} \lipsum[4-5]

\section{Conclusion and future work} \lipsum[6-7]

\end{document}

enter image description here

Zarko
  • 296,517