![在页面左侧和右侧放置浮动内容(包括文本)](https://linux22.com/image/339400/%E5%9C%A8%E9%A1%B5%E9%9D%A2%E5%B7%A6%E4%BE%A7%E5%92%8C%E5%8F%B3%E4%BE%A7%E6%94%BE%E7%BD%AE%E6%B5%AE%E5%8A%A8%E5%86%85%E5%AE%B9%EF%BC%88%E5%8C%85%E6%8B%AC%E6%96%87%E6%9C%AC%EF%BC%89.png)
我有两个浮点数。我想将它们放置在双面文档中彼此相对的两页之上。
下面的示例已经运行良好,但是,它不允许浮动下方有文本。
有人知道如何解决这个问题,以便浮动下方也能有文字吗?
\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}