在页面左侧和右侧放置浮动内容(包括文本)

在页面左侧和右侧放置浮动内容(包括文本)

我有两个浮点数。我想将它们放置在双面文档中彼此相对的两页之上。

下面的示例已经运行良好,但是,它不允许浮动下方有文本。

有人知道如何解决这个问题,以便浮动下方也能有文字吗?

\documentclass{book}
\usepackage[margin=1in]{geometry}
\newcommand\smallrectangle{\rule{12cm}{12cm}}
\usepackage{lipsum}                         % filler text
\usepackage{afterpage}

\begin{document}
\lipsum[1-5]
\hrule % to indicate start of "afterpage" material

\afterpage{%
    \clearpage% flush all other floats
    \ifodd\value{page}
    %\else% uncomment this else to get odd/even instead of even/odd
        \expandafter\afterpage% put it on the next page if this one is odd
    \fi
{    

\begin{figure}[t!]
\centering
\smallrectangle
\caption{First (verso) figure}
\end{figure}
\clearpage

\begin{figure}[t!]
\centering
\smallrectangle
\caption{Second (recto) figure}
\end{figure}
\clearpage % force-flush the second figure as well
} 
}

\lipsum[6-15]  % more filler text: fill rest of p. 1, then continue on p. 4 

\end{document} 

答案1

为什么要在第一张图片之后清除页面?如果不清除,那就没问题了。

\documentclass{book}
\usepackage[margin=1in]{geometry}
\newcommand\smallrectangle{\rule{12cm}{12cm}}
\usepackage{lipsum}                         % filler text
\usepackage{afterpage}

\begin{document}
    \lipsum[1-5]
    \hrule % to indicate start of "afterpage" material

    \afterpage{%
        \clearpage% flush all other floats
        \ifodd\value{page}
        %\else% uncomment this else to get odd/even instead of even/odd
        \expandafter\afterpage% put it on the next page if this one is odd
        \fi
        {    

            \begin{figure}[t!]
                \centering
                \smallrectangle
                \caption{First (verso) figure}
            \end{figure}




            \begin{figure}[t!]
                \centering
                \smallrectangle
                \caption{Second (recto) figure}
            \end{figure}
             % force-flush the second figure as well
        } 
    }

    \lipsum[6-15]  % more filler text: fill rest of p. 1, then continue on p. 4 

\end{document} 

相关内容