1

In my document, I made the first table to place on the special page. But all the following tables are also going to this page ignoring any positioning arguments I use.

\documentclass{article}

\begin{document}
\ldots

\begin{table}[p]       % this [p] affects the following tables
\begin{tabular}{|c|}
1
\end{tabular}
\end{table}

\begin{table}[ht]
\begin{tabular}{|c|}
2
\end{tabular}
\end{table}

\begin{table}[!b]
\begin{tabular}{|c|}
3
\end{tabular}
\end{table}

\ldots
\end{document}

I thought the positioning argument was responsible only for its own table. Is it possible to free the other tables from forced placement on a separate page?

7
  • 2
    Not sure I understand what you're trying to achieve with tables 2 [ht] and 3 [b!]. I believe you don't want them on the same page as table 1 [p], but I'm not sure I understand where else you want them to go. E.g., should they be placed on the page that follows "table 1", or maybe on the page that precedes "table 1" (assuming, of course, that there's enough space available to begin with on that page)? Please advise.
    – Mico
    Oct 15 at 6:07
  • 1
    @Mico Yes, I want tables 2-3 to be on the current page (that precedes table 1).
    – Vladimir
    Oct 15 at 6:12
  • 2
    @Vladimir By design, floats will never be typeset out of order. Figure 1 will always be ahead of Figure 2 and so on.
    – egreg
    Oct 15 at 6:20
  • @egreg That's the point. The tables 2-3 have to follow the table 1 and since it is on the special page then 2-3 must be there by design.
    – Vladimir
    Oct 15 at 6:39
  • 3
    I suggest to defer all decisions about figure placement when your text is in final form. At that point, you can move the figure environments around to get the best placement for each.
    – egreg
    Oct 15 at 7:20
1

I think that what you need to do in order to achieve the desired physical ordering of the 3 table floats is to load the afterpage package and employ the \afterpage macro.

Specifically, I suggest you encase the code for the [p] table environment in an \afterpage directive, effectively telling LaTeX to defer or postpone the the processing of that float (which will have a caption numbered "3") until the start of the next page. This postponement, in turn, frees LaTeX to process whatever is next in the queue. If "whatever is next" consists of two floats which happen to fit on the current page, LaTeX is entirely fine with that.

Do be aware, though, that the captions of floats 2 and 3 will now actually be numbered as "1" and "2", since these two floats now precede, in a physical sense, the float that's been placed on the floats-only page via the \afterpage device.

The following code hopefully explains things further. Note that I've deleted the tabular environments and introduced \caption statements instead.

\documentclass{article}
\usepackage{afterpage}
\usepackage{lipsum} % filler text
\begin{document}
\lipsum[1]  % to occupy the top of p. 1

\afterpage{%
\begin{table}[p]     % this float is placed on page 2 
\caption{AAA}        % caption is given number "3"
\end{table}
\clearpage}          % nothing else on this page

\begin{table}[ht]    % this float is placed immediately after lips-1 para
\caption{BBB}        % caption is given number "1"
\end{table}

\begin{table}[!b]    % this float is placed at the bottom of page 1
\caption{CCC}        % caption is given number "2"
\end{table}

\lipsum[2]           % this para is placed below table "1" ("BBB")
\end{document}
5
  • I've run the code and got a message: ! LaTeX Error: File `l3backend-dvips.def' not found.. I downloaded the archive from ctan.org/pkg/l3backend but there is no file `l3backend-dvips.def'.
    – Vladimir
    Oct 15 at 7:34
  • @Vladimir - Which TeX distribution do you employ, and when did you last update it? (FWIW, my TeX distribution is MacTeX2021 with all updates applied, and I don't encounter the problem mentioned in your comment.)
    – Mico
    Oct 15 at 7:47
  • Mine is MikTex 2.9, installed in 2018. I ran MikTex Console to check for updates but there was an error with PATH variable...
    – Vladimir
    Oct 15 at 8:54
  • @Vladimir - The only suggestion I can think of for now is to update your MikTeX distribution. Installing the latest version from scratch may be the way to go if the pesky PATH variable refuses to be reset gently...
    – Mico
    Oct 15 at 10:32
  • 1
    Finally I succeeded with updating my distribution and compiled your code. And the result is that the A-table is on the special page and B- and C-tables are on the current page. Now I see first I asked about something 'unnatural' for LaTeX because normally each new table has to follow the previous ones so if a table was sent to the table page then all the following tables also had to be there. They are kind of chained to the first [p]-table. But there is a way to manually change this behavior using afterpage package.
    – Vladimir
    Oct 15 at 13:07
2

I'm not really sure what you want on your special page. The following puts the p table on a page by itself and any later tables are positioned according to their particular placement specifications. Float placement only applies to the particular float. In your MWE the p table is put on the next page but doesn't take all of it up, leaving space for further floats.

% pposprob.tex  SE 619028

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\lipsum[1]  % on page 1

\begin{table}[p]     % on next page (2) and is the only thing
\caption{\texttt{p} table}
\end{table}

\clearpage


\begin{table}[ht]     % on top of page 3
\caption{\texttt{ht} table}
\end{table}

\begin{table}[!b]     % on bottom  of page 3
\caption{\texttt{!b} table}
\end{table}

\lipsum[2]       % on page 3

\end{document}
1
  • Maybe \clearpage matters. I ran your code with and without this command. And without it a [p]-table takes all the following tables to the separate page. But with this command there is a clear page for the p-table and other tables are on their places according with their place specifiers. But the next p-table does not go to the table page -- it is on its new page. Seems like I should follow the LaTeX's logic of placing objects on the page...
    – Vladimir
    Oct 16 at 14:56

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.