15

Is it possible to always have a certain type of float, i.e. in my case figures or tables, come first when they end up on a float page? I don't want to change the order in the source.

  • Now there's an interesting question. Probably yes, but not out of the box, would need a bit of rearrangement of the latex code... – David Carlisle May 9 '13 at 20:02
11

This actually sorts the list before attempting to make the float page which could potentially have an effect on later pages as any held over tables would be tried before held over figures, but anyway it works on the one test document I tried it with.

It keeps the order of each type of float put pulls any tables out and puts them at the head of the float list.

enter image description here

\documentclass{article}
\makeatletter
\def\@gettable#1{%
  \count@\count#1%
  \divide\count@\@xxxii
  \ifnum\count@=\ftype@table\relax
   \@cons\@tablelist#1%
  \else
   \@cons\@nottablelist#1%
  \fi
}
\def \@tryfcolumn #1{%
  \global \@fcolmadefalse
  \ifx #1\@empty
  \else
    \xdef\@trylist{#1}%
    \global \let \@failedlist \@empty
    \begingroup
      \let\@tablelist\@empty
      \let\@nottablelist\@empty
      \let\@elt\@gettable
      \@trylist
      \let\@elt\relax
      \xdef\@trylist{\@tablelist\@nottablelist}%
      \let \@elt \@xtryfc \@trylist
    \endgroup
    \if@fcolmade
      \@vtryfc #1%
    \fi
  \fi
}

\makeatother

\begin{document}

\begin{table}[p]\centering
TTTa
\caption{ttt}
\end{table}

\begin{figure}[p]\centering
FFFa
\caption{fff}
\end{figure}

\begin{table}[p]\centering
TTTb
\caption{ttt}
\end{table}

\begin{figure}[p]\centering
FFFa
\caption{fff}
\end{figure}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.