防止在段落内放置浮动

防止在段落内放置浮动

是否可以防止浮动元素被放置在段落内?我知道还有另一篇帖子(如何保护文本不被浮点数分割?) 有类似的问题,但我想允许浮动也放在段落之后。

这个最小的工作示例(缩短)说明了我的意思:

\documentclass[a4paper,10pt]{scrreprt}
\usepackage[utf8]{inputenc}

\begin{document}

\begin{figure}[htbp]
   \def\a{ I am a figure}
   \a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a
\end{figure}

\begin{figure}[htbp]
    \def\b{I am another figure}
    \b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b
\end{figure}

\begin{figure}[htbp]
    \def\c{I am yet another figure}
    \c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c
\end{figure}

\def\d{I am text}
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d
\end{document}

使用我上面链接的帖子中的解决方案,这三个图形将被强制放在文本之前,但我也想允许以下解决方案:

FIGURE1
FIGURE2
TEXT
FIGURE3

我认为也许可以将文本放在某种盒装环境中(段落内必须可以分页)。

答案1

改变浮动放置参数中间文档有点脆弱,但在这里有效

\documentclass[a4paper,10pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{afterpage}
\begin{document}

\begin{figure}[htbp]
   \def\a{ I am a figure}
   \a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a\\\a
\end{figure}

\begin{figure}[htbp]
    \def\b{I am another figure}
    \b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b\\\b
\end{figure}

\begin{figure}[htbp]
    \def\c{I am yet another figure}
    \c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c\\\c
\end{figure}


{\setcounter{totalnumber}{0}
\def\d{I am text}
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\
\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d\\\d}\afterpage{\setcounter{totalnumber}{3}}

\end{document}

相关内容