2

I am trying to clearpage and then immediately have the figure on top, then the text below the figure on this new page. However, what shows are the following: the figure is right in the middle of the second page, and the text is on the third page. I wish to erase the 3rd page, and that the text on the 3rd page at the moment will be on the second page along with the figure.

If I do not use the /clearpage or /FloatBarrier, then the text will go to the first page, and that is the least I wanted. I also tried \afterpage, but it was not working either. I probably did something wrong. Thank you so much for helping!
Current I would like the page to be this: Expected

Below are my code sample:

\documentclass[twoside,twocolumn]{article}
\usepackage{subcaption}
\usepackage{afterpage}
\usepackage[section]{placeins}
\begin{document}
 .....
\renewcommand\thesubfigure{\alph{subfigure}}
\graphicspath{ {Data/N-DImensional(0<r_i<1)/r_i_0dot0262955/} }
\begin{figure*}[h]
\centering
\begin{subfigure}{0.5\textwidth}
\centering
  \includegraphics[width=0.85\linewidth]{0dot348731M}
  \caption{Biomass vs. Biodiversity}
  \label{fig:sub41}
\end{subfigure}%
\begin{subfigure}{0.5\textwidth}
  \centering
  \includegraphics[width=0.85\linewidth]{0dot348731D}
  \caption{Biomass vs. Biodiversity}
  \label{fig:sub42}
\end{subfigure}
\caption{4-Dimensional Lokta-Volterra model with different growth rates $(x_0=0.348731)$.}
\end{figure*}

\FloatBarrier

\noindent Text Sample

\end{document}

Here are the links of what the 2 pages I imported:

This is what the pages look like right now

And this is what they look like without \clearpage

Valia
  • 121
  • Welcome to TeX.SE! what you try so far? Please, provide small but complete document with \documentclass{...}on beginning and\end{document}on the end. Usual help to add position option[t]to figure environment (\begin{figure}[t]`). – Zarko Apr 23 '17 at 23:57
  • @Zarko Hi, Thanks for looking through. Would this much code be sufficient? I tried using \afterpage, clearpage as well as FloatBarrior, but I could't get the Text Sample be right below the figure. Currently the figure and the text are displaying in two separate pages. – Valia Apr 24 '17 at 00:17
  • In your MWE a preambel is missing. You should add all relevant packages and also \begin{document} ... – Zarko Apr 24 '17 at 00:46
  • You have two column document and environment figure* (for span two columns) , which is always on the top of the next page where it is inserted. Consequently at them the positioning option hasn't sense. Please, can you explain again, what is your problem? – Zarko Apr 24 '17 at 00:53
  • @Zarko Yeah I completely understand what you mean. It's slightly complicated and I can't really describe it well. So I have three pages. The first page consists of 3 figures, and the second page has 1 figure, and the third page has the Text. My goal is to let the first page has 3 figures, and the second page has the 4th figure and the text right below it. If I don't use \clearpage, then the 3rd figure in the first page will be in the second page, and the text will go up to the first page: so 2 figures in first page and the text, 2 figures in second page. – Valia Apr 24 '17 at 00:59
  • @cfr Thanks for checking! I have tried all the positional parameters like h,c,b,p, t and !, but for some reason none of them seem to have an effect at all. The \clearpage is between the figure and the text. – Valia Apr 24 '17 at 01:17
  • There's not much flexibility in a 2 column layout when you want a wide figure. But probably somebody will have an idea. Note that nobody can test your example right now. Can you reproduce with standard images e.g. example-image or example-image-a etc.? – cfr Apr 24 '17 at 01:24
  • @cfr yeah I just imported the two pages to a cloud drive. I hope you take a look at it real quick. This is the current page with \clearpage and This is the page if do not use /clearpage – Valia Apr 24 '17 at 01:29
  • @Akroma I have not gotten it to work, but if I understand you correctly, your end result should only have two pages? In that case, I think the fundamental issue is to prevent a floatpage from being created for the fourth figure, not really the placement of the figure at the page's top. I would maybe change your question's title, if that is indeed the case. Something about preventing a float page from being created in a twocolumn document, perhaps? Unless my assumption is wrong, of course, in which case, apologies. – alpenwasser Apr 24 '17 at 02:03
  • As for simply having the float at the top of the page, you can accomplish that via \makeatletter \setlength{\@dblfptop}{0pt} \setlength{\@dblfpbot}{0pt plus 1fil} \makeatother in the preamble, but that will still put it on a separate page and not on the same page as the small bit of text (at least for me, despite several experiments with the LaTeX float parameters like \dblfloatpagefraction etc.). – alpenwasser Apr 24 '17 at 02:04
  • @alpenwasser Hi, yeah I believe you are right. If the 3rd page does not appear, then the text that currently sits at the f3rd page must go to the 2nd page. Sorry for my bad way of explaining it. It is like having three pages currently, but the 2nd page only has 1 figure in the middle, and the 3rd page has text on top. I wish to merge the two things to the 2nd page. However, the 2nd page is a new page from the command /clearpage. – Valia Apr 24 '17 at 02:08
  • @Akroma There is a section about two-column floats in this great answer: https://tex.stackexchange.com/a/39020/131649 If I put more text into the document, then it works, but of course that is not a solution. Reading that answer, I'm starting to suspect that the problem might indeed run pretty deeply into LaTeX's innards and will require some serious sorcery to solve. But I've never really used twocolumn mode much, nor looked at its implementation. – alpenwasser Apr 24 '17 at 02:19
  • As said though, it might not be the stupidest idea to rename the question. I don't think its current title really matches the underlying issue (if I understand the issue correctly, otherwise nevermind silly ol' me). That might make it easier for people who know how to answer it to actually find it when perusing the questions. – alpenwasser Apr 24 '17 at 02:20
  • @alpenwasser I think you got what I was trying to say. Have you had a chance to browse the two imported pages I uploaded? It will take less than 10 seconds. Let me think of a good way to phrase this topic. – Valia Apr 24 '17 at 02:25
  • @Akroma Yes, I have looked at your two example documents; as best as I can tell, the underlying issue is to prevent a float page from being created. So maybe I'd suggest something along the lines of "Prevent Float Page in twocolumn Document" or similar? I have googled around for an answer to that and similar questions, but so far no luck. – alpenwasser Apr 24 '17 at 02:32
  • @alpenwasser yeah I understood now. The document does generate two pages after one single \clearpage. One page about the figure, and the other page is about the text. – Valia Apr 24 '17 at 02:34

1 Answers1

1

Carrying this over from our chat conversation. I think the underlying issue is trying to prevent a float page from being created when both text and image would fit onto the same page.

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

\begin{document}

\begin{figure*}
    \centering
    \includegraphics[height=0.25\textwidth,width=0.75\linewidth]{pic}
    \caption{Picture}
    \label{fig:1}
\end{figure*}
\lipsum[1]

\end{document}

This will yield:float page

I have fiddled around with the float parameters of LaTeX (like \dblfloatpagefraction and friends), but no luck. Maybe a potential workaround would be to avoid putting that \includegraphics inside a floating environment at all?

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

\begin{document}

\twocolumn[{%
    \centering
    \includegraphics[height=0.25\textwidth,width=0.75\linewidth]{pic}
    \vspace{1em}
}]

\lipsum[1]

\end{document}

Result:

twocolumn-no-floatpage

A caption could be added via \captionof from the caption package, for example.

alpenwasser
  • 2,455