3

This question is related to this question, but a different case is considered.

Consider you have a blue text with a figure* and a figure, followed by a red text with another figure*.

Because Latex puts the figures too far in the document and even puts the third figure on a separate page, you place the figures earlier in the code, which gives following MWE and result:

\documentclass[twocolumn,a4paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks} \usepackage{dblfloatfix} %allow figure* at bottom

\title{Debug}

\begin{document}

\maketitle

\begin{figure}[ht!] \center \tikz\randuck;\ \tikz\randuck;\ \caption{Figure} \label{fig1} \end{figure} \begin{figure}[h] \center \tikz\randuck;\ \caption{Figure} \label{fig2} \end{figure} \begin{figure}[hb!] \center \tikz\randuck;\ \tikz\randuck;\ \caption{Figure} \label{fig3} \end{figure}

{\color{red} \lipsum[10-15]

SEE FIGS. \ref{fig1}-\ref{fig2}}

{\color{blue} \lipsum[1-9]

SEE FIG. \ref{fig3}}

\end{document}

enter image description here

The only problem is that the last figure is on the bottom of the third page, and you want it to be on the same page as the other two figures (as indicated by the arrow). How to achieve this?

  • If you turn fig3 into an figure instead of a figure*, it is indeed placed at the bottom of the second page.

  • If you comment out fig2 instead, you're left with a top figure* and a bottom figure* that are placed on the same page (thanks to dblfloatfix or these alternatives).

  • You can try setting some fractions and numbers that are mentioned here, such as reducing the \textfraction and increasing the \totalnumber, but nothing seems to help. Note that it seems there is no \dblbottomfraction.

Karlo
  • 3,257
  • 2
    First, you need to load the dblfloatfix or nidanfloat packages to get bottom double floats. Like top double floats, they have to be started a page in advance. – John Kormylo May 12 '23 at 14:21
  • Indeed: I have loaded dblfloatfix, and the floats put before all the text. However, when fig3 is a figure* it is put on the third page for some reason I do not understand. – Karlo May 12 '23 at 14:33
  • 1
    dblfloatfix is old (2012), and documentation is minimal. nidanfloat is newer and has quite detailed documentation. This is just a guess: the space allowed for a bottom -float is .5(textheight). If less than that remains after the top -float and the regular float are placed, the bottom -float may automatically be shunted to the next page. Not tested.* English documentation available as `nidanfloat-en.pdf' (the original is in Japanese). – barbara beeton May 12 '23 at 19:26
  • 2
    you can never use h with * float or single col floats following a * so your optional arguments are making it harder – David Carlisle May 12 '23 at 19:35
  • @barbarabeeton Thank you, I had only found the Japanese version. – Karlo May 12 '23 at 19:41
  • 1
    @Karlo -- I found the reference in the second paragraph of the Japanese version (with credit to David Carlisle for the translation). I looked there in the hope that the documentation might contain the code, as good documentation often does, and I was rewarded. – barbara beeton May 12 '23 at 22:33

2 Answers2

3

enter image description here

\documentclass[twocolumn,a4paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks} \usepackage{dblfloatfix} %allow figure* at bottom

\title{Debug}

\begin{document}

\maketitle

\begin{figure}[t] \center \tikz\randuck;\ \tikz\randuck;\ \caption{Figure} \label{fig1} \end{figure} \addtocounter{figure}{1} \begin{figure}[b] \center \tikz\randuck;\ \tikz\randuck;\ \caption{Figure} \label{fig3} \end{figure} \addtocounter{figure}{-2} \begin{figure}[t] \center \tikz\randuck;\ \caption{Figure} \label{fig2} \end{figure} \addtocounter{figure}{1}

{\color{red} \lipsum[10-15]

SEE FIGS. \ref{fig1}-\ref{fig2}}

{\color{blue} \lipsum[1-9]

SEE FIG. \ref{fig3}}

\end{document}

David Carlisle
  • 757,742
3

It appears to be order dependent. You can get it to work is you put the figure after the two figure*s. Of course that messes up the captions, but that can be fixed easily enough.

\documentclass[twocolumn,a4paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks} \usepackage{dblfloatfix} %allow figure* at bottom \usepackage{caption}% or capt-of

\newsavebox{\delaybox}

\title{Debug}

\begin{document}

\maketitle

\begin{figure}[t!] \centering \tikz{\randuck;}\ \tikz{\randuck;} \caption{Figure} \label{fig1} \end{figure*}

\savebox{\delaybox}{\begin{minipage}{\columnwidth} \centering \tikz{\randuck;} \captionof{figure}{Figure} \label{fig2} \end{minipage}}

\begin{figure}[b!] \centering \tikz{\randuck;}\ \tikz{\randuck;} \caption{Figure} \label{fig3} \end{figure*}

\begin{figure}[h] \usebox{\delaybox} \end{figure}

{\color{red} \lipsum[10-15]

SEE FIGS. \ref{fig1}-\ref{fig2}}

{\color{blue} \lipsum[1-9]

SEE FIG. \ref{fig3}}

\end{document}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120