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.

1
  • Now there's an interesting question. Probably yes, but not out of the box, would need a bit of rearrangement of the latex code... Commented May 9, 2013 at 20:02

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .