0

In two-column paper I want to place two figures side by side. If I use figure* it shifts them to a new page. If I use minipage option again figures don't obtain correct position. Can I fix this problem using figure*?

Here is my code that I am using. My figures are moving to next page that I don't want. Please guide me how to fix this problem?

\begin{figure*}[!ht]
    \begin{minipage}[l]{1.0\columnwidth}
        \centering
        \includegraphics[width=7.5cm]{Hist_J_0/hist_h1.PNG}
        \caption{}
    end{minipage}
    \hfill{}
    \begin{minipage}[r]{1.0\columnwidth}
        \centering
        \includegraphics[width=7.5cm]{Hist_J_0/hist_h5.PNG}
        \caption{}
    \end{minipage}
\end{figure*}
Mico
  • 506,678
jerry
  • 159
  • 3
    Welcome. Could you please add a compilable example? –  Apr 05 '19 at 05:40
  • 1
    Actually I am new on this forum. I just want to to know how to fix position of two subfigurs in two column paper .In my case I want to show the result on page 1 but it moves to the page two. Is there any way to fix figures on the top or bottom of the page using figure* environment – jerry Apr 05 '19 at 05:44
  • 1
    Welcome to TeX.SE. A figure* environment should be used only if (a) the document is in two-column mode and (b) you need the contents of the environment to span the width of both columns. By default, figure* and table* environments are always placed at the top of a page. If you plan to place 2 subfigures side-by-side inside a single figure (or figure*) environment, you should look into the capabilities of the subfig and subcaption packages. This site has lots of queries related to exactly this topic. – Mico Apr 05 '19 at 05:45
  • I want to place two subfigure side by side in two coloums in a two-column page – jerry Apr 05 '19 at 05:46
  • 1
    @jerry Without an example code we can do nothing, because basically we can't reproduce your problem. –  Apr 05 '19 at 05:48
  • @jerry - Do please search this site for queries about the two issues raised by your query. – Mico Apr 05 '19 at 05:48
  • I already searched and try to implemented. But still figures are moving to next page – jerry Apr 05 '19 at 05:51
  • May be this helps: https://tex.stackexchange.com/a/153859/1952 – Ignasi Apr 05 '19 at 05:56
  • @jerry - Have you searched this site for applications of the stfloats package? – Mico Apr 05 '19 at 06:18
  • No I have searched it using dblfloatfix, figure* and minipage environment – jerry Apr 05 '19 at 06:19
  • 2
    figure* always comes at the earliest on teh next page, so simply move it earlier in the source so it gets typeset on the page that you want,. – David Carlisle Apr 05 '19 at 06:57
  • typeset ? can you please explain it bit more – jerry Apr 05 '19 at 06:58
  • @jerry: Could you please make your code compilable by adding the documentclass and the relevant packages? – leandriis Apr 05 '19 at 07:13
  • I've closed this posting as a duplicate of an earlier one. The earlier posting refers to table* environments, but it's applicable to figure* environments as well. – Mico Apr 05 '19 at 07:32

1 Answers1

2

As David Carlisle told you, a figure* is always placed on page following the page where it is declared on .tex file. Therefore even if you start your document with \begin{figure*}, the figure will appear on second page.

This is the normal behaviour, but Mico proposed to use stfloats package which solves the problem.

Following Mico's suggestion, please note that l and r positioning parameters are not valid for minipage. Only top t, center c and bottom b are accepted.

As your figures are declared into a minipage, \linewidth value adjusts to minipage size, therefore you could also use width=...\linewidth in includegraphics parameters.

\documentclass[twocolumn, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{stfloats}

\begin{document}
     \begin{figure*}[b]
        \begin{minipage}{1.0\columnwidth}
            \centering
            \includegraphics[width=7.5cm]{example-image-a}
            \caption{}
        \end{minipage}
        \hfill  %<-- changed from \hfill{}. See David's comment
        \begin{minipage}{1.0\columnwidth}
            \centering
            \includegraphics[width=7.5cm]{example-image-b}
            \caption{}
        \end{minipage}
    \end{figure*}

\lipsum[1-9]
\end{document}

enter image description here

Ignasi
  • 136,588
  • Please also inform the OP that the minipage environment does not recognize l and r as positioning specifiers; the only recognized specifiers are t (top), c(center -- the default), and b (bottom). Also, the \centering instructions are redundant since the images take up the full width of the column. – Mico Apr 05 '19 at 07:27
  • @Mico Thank you for pointing it, I didn't notice. About \centering command, it was my fault because I changed original 7.5cm to \linewidth, – Ignasi Apr 05 '19 at 07:40
  • \end{minipage} \hfill{} \begin only works if \columnsep is more than two word spaces, better to use \end{minipage}\hfill \begin or the images could be set vertically rather than side by side. – David Carlisle Apr 05 '19 at 08:50