防止图形在两个环境之间浮动

防止图形在两个环境之间浮动

我定义了一个mathdescription列表来描述变量。我把它放在数学环境的正下方。列表环境可以按照我的需要进行分页。但不幸的是,在某些情况下,图形会直接浮动在两者之间,如屏幕截图所示。有没有办法防止图形和其他浮动在数学环境和我的列表之间浮动,而不会失去列表的分页能力?我想到了某种浮动的限制区域。谢谢!

在此处输入图片描述

梅威瑟:

\documentclass[
]{scrreprt}

\usepackage{setspace}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{enumitem}

\spacing{1.3}
\newlength{\defaultparindent}
\setlength{\defaultparindent}{\parindent}
\KOMAoptions{parskip=half}

\newlist{mathdescription}{description}{1} % Max depth 1
\setlist[mathdescription]{labelindent=\defaultparindent,nosep}
\BeforeBeginEnvironment{mathdescription}{where:\vspace{-\parskip}}

\begin{document}

\blindtext[3]
\begin{figure}[htbp]
    \centering\includegraphics[width=0.6\textwidth]{example-image-a}
\end{figure}
Some more text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{equation}
    a^2 + b^2 = c^2 \label{equ:Example}
\end{equation}
\begin{mathdescription}
    \item $a$ is \dots,
    \item $b$ is \dots,
    \item $c$ is \dots
\end{mathdescription}

\end{document}

答案1

你总是可以使用牢不可破的盒子。trivlist 的目的是尝试让两者表现得像一个方程。

\documentclass{scrreprt}

\usepackage{setspace}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{enumitem}

\spacing{1.3}
\newlength{\defaultparindent}
\setlength{\defaultparindent}{\parindent}
\KOMAoptions{parskip=half}

\newlist{mathdescription}{description}{1} % Max depth 1
\setlist[mathdescription]{labelindent=\defaultparindent,nosep}
\BeforeBeginEnvironment{mathdescription}{where:\vspace{-\parskip}}

\usepackage{showframe}% MWE only

\begin{document}

\blindtext[3]
\begin{figure}[htbp]
    \centering\includegraphics[width=0.6\textwidth]{example-image-a}
\end{figure}
Some more text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{trivlist}\item
\vbox{\begin{equation}
    a^2 + b^2 = c^2 \label{equ:Example}
\end{equation}
\begin{mathdescription}
    \item $a$ is \dots,
    \item $b$ is \dots,
    \item $c$ is \dots
\end{mathdescription}}
\end{trivlist}

\end{document}

此版本使用\needspace

\documentclass{scrreprt}

\usepackage{setspace}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{enumitem}

\spacing{1.3}
\newlength{\defaultparindent}
\setlength{\defaultparindent}{\parindent}
\KOMAoptions{parskip=half}

\newlist{mathdescription}{description}{1} % Max depth 1
\setlist[mathdescription]{labelindent=\defaultparindent,nosep}
\BeforeBeginEnvironment{mathdescription}{where:\vspace{-\parskip}}

\usepackage{needspace}
\usepackage{showframe}% MWE only

\begin{document}

\blindtext[3]
\begin{figure}[htbp]
    \centering\includegraphics[width=0.6\textwidth]{example-image-a}
\end{figure}
Some more text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\needspace{5\baselineskip}
\begin{equation}
    a^2 + b^2 = c^2 \label{equ:Example}
\end{equation}
\begin{mathdescription}
    \item $a$ is \dots,
    \item $b$ is \dots,
    \item $c$ is \dots
\end{mathdescription}

\end{document}

相关内容