我想制作enumerate
一个列表,在每个后面添加一定数量的空白行\item
,但不允许分页符将\item
文本与空白处分开。我的列表是一个问题集,每个问题都有空白处供大家解决,我不希望问题与这个空白处分开。
我目前正在使用以下代码来创建这些空行:
\let\olditem\item
\renewcommand{\item}{\olditem \vspace*{10em}}
这在添加10em
垂直空间时非常有效,但实际上每一页的\item
最底部都有一个空间,然后\vspace*{10em}
在下一页继续。
我怎样才能防止这种情况发生?
答案1
没有显示示例,很难确定,但我想这样的事情会做你想要的(用真实代码替换1pt
,0pt
可见规则仅用于调试)
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\newcommand\myitem{\item\mbox{}\par}
\begin{enumerate}[label={\arabic*)\rule[-10\baselineskip]{1pt}{10\baselineskip}}]
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\end{enumerate}
\end{document}
答案2
根据您的描述,我认为enumerate
这不是合适的工具。
你似乎想编写一个包含
- 问题陈述
- 预留工作空间
您希望“粘在一起”。确保这一点的最简单方法是将整个技巧粘在一个小页面内。以下是概念验证。(对于可变高度版本,与 David 的答案相同,将1pt
规则中的替换0pt
为生产。这1pt
只会帮助您直观地了解保留的空间。)
\documentclass[twocolumn]{article}
\newcounter{problemnum}
\newenvironment{problem}{\refstepcounter{problemnum}%
\par\noindent\begin{minipage}[t]{\linewidth} \noindent \theproblemnum)~}{\rule[-8.5em]{1pt}{8.5em} % This is the amount of vertical space to reserve
\end{minipage}}
\newenvironment{problemfh}{\refstepcounter{problemnum}%
\par\noindent\begin{minipage}[t][8.5em]{\linewidth}\noindent \theproblemnum)~}{\end{minipage}}
\begin{document}
Variable height version: keeping the same amount of ``work space''.
\begin{problem}
This is a math problem
\end{problem}
\begin{problem}
This is another math problem
\end{problem}
\begin{problem}
This is a multiline math problem. It is something about chickens and rabbits on a farm, and the counts of how many feet they have altogether and how many mouths they have between them. It has something to do with algebra.
\end{problem}
\begin{problem}
This is another short problem
\end{problem}
\begin{problem}
This problem should straddle the column break and be moved to the second column
\end{problem}
\hrule
The next version has a fixed total height, so the work space shrinks for the longer problem.
\begin{problemfh}
This is a math problem
\end{problemfh}
\begin{problemfh}
This is a multiline math problem. It is something about chickens and rabbits on a farm, and the counts of how many feet they have altogether and how many mouths they have between them. It has something to do with algebra.
\end{problemfh}
\begin{problemfh}
This is another short problem
\end{problemfh}
\hrule
\end{document}
请注意,在左列中,LaTeX 在问题之间插入了额外的粘连(空格),以使问题分布得更均匀。您可以看到,问题 5 中有足够的空间用于文本,但使用 minipage 会强制将保留的空间放置在与文本相同的“页面”(在本例中为列)上。