9

Consider following MWE

\documentclass[twocolumn,a5paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks}

\title{Debug}

\begin{document} \maketitle

\lipsum[1]

\begin{figure}[ht] \center \tikz\randuck; \caption{Duck} \end{figure}

\begin{figure}[ht] \center \tikz\randuck; \caption{Duck} \end{figure}

\begin{figure}[h] \center \tikz\randuck; \caption{Big Duck} \end{figure}

\clearpage

\lipsum[2]

%\begin{figure}[h] % \center % \tikz\randuck; % \caption{Big Duck} %\end{figure}

\lipsum[1]

\begin{figure}[h] \center \tikz\randuck; \caption{Duck} \end{figure}

\end{document}

I meant to have one page with Figure 1 and Figure 2 next to each other (which ht should do), and Figure 3 underneath them on the same page (which is why I commented out the figure at its original location in the code and put it directly beneath Figure 2 in the code). You see in the picture that I failed, what can I do?

Note that I do not mean to use subfigures, but three distinct figure floats with their respective captions.

I also added a \clearpage hoping that this would flush the figures, but it also does not work.

enter image description here

Karlo
  • 3,257
  • 3
    Does this answer your question? Force figure placement in text – Teepeemm Apr 23 '23 at 21:48
  • Specifically, https://tex.stackexchange.com/a/8631/107497, which begins "do not use a floating environment if you do not want it float." Note that [ht] will not put two figures next to each other. It may put them sequentially, as in this case, or it may put them at the top of consecutive pages. – Teepeemm Apr 23 '23 at 21:49
  • 1
    you can not use [h] wiith figure* so \begin{figure*}[h] means not t not p so it can not be placed anywhere until flushed witth \clearpage – David Carlisle Apr 23 '23 at 23:05
  • also never use \center as a command, always \centering – David Carlisle Apr 23 '23 at 23:07
  • 3
    @Teepeemm -- The cited question doesn't deal with figure*. That's a special case, and the usual floating mechanism only allows figure* at the top of a page, while this OP wants it below two half-width figures. The hvfloat package provides more flexibility, but I don't think it includes that option. That leaves brute force. But maybe I'm just not aware of something automatic. – barbara beeton Apr 23 '23 at 23:40

2 Answers2

13

enter image description here

figures that should float together should be in the same float, that's why figure allows multiple \caption

\documentclass[twocolumn,a5paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks}

\title{Debug}

\begin{document} \maketitle

\lipsum[1]

\begin{figure*}[t] \begin{minipage}[t]{.5\textwidth} \centering \tikz\randuck; \caption{Duck}
\end{minipage}% \begin{minipage}[t]{.5\textwidth} \centering \tikz\randuck; \caption{Duck}
\end{minipage}

\centering
\tikz\randuck;
\caption{Big Duck}

\end{figure*}

\lipsum[2]

\lipsum[1]

\end{document}

David Carlisle
  • 757,742
7

Like this?

enter image description here

Images, first two are inserted into parboxes, are merged in one figure* floats. Consequently they will appear on the top of the next page from point of figure* insertion:

\documentclass[twocolumn,a5paper]{article}

\usepackage{graphicx} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzducks}

\title{Debug}

\begin{document} \maketitle

\lipsum[1]

\begin{figure*}[t] \centering \parbox{0.45\linewidth} { \tikz\randuck; \caption{Duck} } \parbox{0.45\linewidth} { \tikz\randuck; \caption{Duck} }

\bigskip \tikz\randuck; \caption{Big Duck} \end{figure*}

\lipsum[2]

\begin{figure}[h] \centering \tikz\randuck; \caption{Duck} \end{figure} \lipsum[3]

\end{document}

Zarko
  • 296,517