0

I desperately search for an answer now, nothing helps. I want a graphic and a tabular appear before another subsection.

I use the placeins package for that, and expanded it to also do it in subsections. but the figure and the table are placed at the end of the document, on different pages.

It's still not working. here is the whole file: https://drive.google.com/file/d/1Is9gyBBw8-fJo6Zag0SnIIaJ5kpWH718/view?usp=sharing

\usepackage{placeins}

\makeatletter
\AtBeginDocument{%
    \expandafter\renewcommand\expandafter\subsection\expandafter{%
        \expandafter\@fb@secFB\subsection
    }%
}
\makeatother

\begin{document}

\subsection{Tables and Figures}

\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{frog.jpg}
\caption{\label{fig:frog}This is a figure caption.}
\end{figure}
\FloatBarrier

\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\FloatBarrier

\subsection{Mathematics}
...

\end{document}

Output: enter image description here

second last page last page

  • it would be easier to help if you provided a test example that showed the problem you can use example-image as that is available for tests and fill in the document class and anything else required to reproduce the issue. – David Carlisle Jun 30 '19 at 14:06
  • 1
    I see you mention apa6 in comments that class moves all floats to the end, or before the appendix if you ave an appendix – David Carlisle Jun 30 '19 at 14:20
  • Thanks David, the floatsintext option in the apa6 document class fixed my issue. I'm new here, shall I close this case or something? – derBolle Jun 30 '19 at 18:50
  • I think it's probably a duplicate, but in future please always make the code you post useable – David Carlisle Jun 30 '19 at 19:40

0 Answers0