0

I'm writing a two sided LaTeX document and would like tables / figures (floats) to be depicted

) in the best case, immediately after the end of the sentence in which the float is referred to with \ref{...} for the first time and

) in the worst case, still on either the current even (left) or odd (right) page.

To elaborate,

) if the float is referred to on the even (left) page number x, the float is to be depicted on that even (left) page with number x or on the odd (right) page with number x+1 and

) if the float is referred to on the odd (right) page number x+1, the float is to be depicted on that odd (right) page with number x+1 or on the even (left) page with number x.

How do I achieve this? Is there perhaps a way to put \FloatBarriers just before the next even (left) page?

Minimum working example:

\documentclass{book}
\usepackage{lipsum}
\usepackage{showframe}
\usepackage{tikz}
\begin{document}
    \lipsum[1-6]
    Figure~\ref{float1}. \lipsum[1]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 1.}
        \label{float1}
    \end{figure}
    Figure~\ref{float2}. \lipsum[2]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 2.}
        \label{float2}
    \end{figure}
    Figure~\ref{float3}. \lipsum[3]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 3.}
        \label{float3}
    \end{figure}
    Figure~\ref{float4}. \lipsum[4]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 4.}
        \label{float4}
    \end{figure}
    Figure~\ref{float5}. \lipsum[5]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 5.}
        \label{float5}
    \end{figure}
    Figure~\ref{float6}. \lipsum[6]
    \begin{figure}[htbp]
        \begin{center}
            \begin{tikzpicture}[scale=1]
                \fill (0,0) rectangle (1,1);
            \end{tikzpicture}
        \end{center}
        \caption{Test picture 6.}
        \label{float6}
    \end{figure}
\end{document}

Here, float 6 is referred to on the odd (right) page 3 but placed on the even (left) page 4. It should be restricted to being placed no later than the odd-even page set 2-3.

  • Please provide an MWE which gives us less typing work. Thanks. – LaRiFaRi Apr 28 '15 at 15:55
  • If you want to implement your last idea, take a look on tex.stackexchange.com/a/6193 – LaRiFaRi Apr 28 '15 at 15:57
  • A \ref can occur anywhere in the document, including before the corresponding figure/table is defined. OTOH, a 2 page delay can be accomplished using \afterpage\afterpage{...}}. – John Kormylo Apr 28 '15 at 16:02
  • @JohnKormylo That's why I spoke of the first time the \ref{...} occurs, which is usually when the float is introduced ;). – Adriaan Apr 28 '15 at 19:16
  • @LaRiFaRi I added a MWE. Float 6 is referred to on the odd (right) page 3 but placed on the even (left) page 4. It should be restricted to being placed no later than the odd-even page set 2-3. – Adriaan Apr 28 '15 at 19:51

Your Answer

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

Browse other questions tagged or ask your own question.