Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

\afterpage and \endfloat

Tags:

latex

How do I combine \afterpage and \endfloat to easily switch between having figures and tables at the end of the document or having them in the text?

I want to easily choose between my figures at the end of the document and my figures in the text. Because of that, sometimes I will use \afterpage package and other times I will use \endfloat would be nice to combine both.

Right now, all the times I try to run \endfloat when I have a clear page, I get the following message:

Argument of \efloat@xfloat has an extra }.

I already tried to include after page in the DeclareDelayedFloatFlavor, something like:

\DeclareDelayedFloatFlavor{afterpage}{figure}

It did not work.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{float}
\usepackage{afterpage}

% ---------------------
%figures at the end
% ---------------------
\usepackage[nolists]{endfloat}
    % force landscape at the end

\begin{document}
    {\afterpage{
    \begin{figure}

    \end{figure}
    }
\end{document}
like image 326
Leonardo Rosa Avatar asked Jul 20 '26 10:07

Leonardo Rosa


1 Answers

If you want to switch between having figures within the text and at the end, I suggest to only use the endfloat package. Commenting or commenting it's optional argument disable will allow you to quickly alternate between figures at the end or in the text.

I'm not entirely certain what the purpose of afterpage was in your example, but if you used it to move the figure to a separate page, this can conveniently be done with the p floating specifier.

\documentclass{article}

\usepackage[
disable
]{endfloat}

\begin{document}

test

\begin{figure}[p]
xxx
\caption{caption}
\end{figure}

test
\end{document}
like image 115
samcarter_is_at_topanswers.xyz Avatar answered Jul 25 '26 09:07

samcarter_is_at_topanswers.xyz