![防止图形在两个环境之间浮动](https://linux22.com/image/443984/%E9%98%B2%E6%AD%A2%E5%9B%BE%E5%BD%A2%E5%9C%A8%E4%B8%A4%E4%B8%AA%E7%8E%AF%E5%A2%83%E4%B9%8B%E9%97%B4%E6%B5%AE%E5%8A%A8.png)
我定义了一个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}