\newpage を含む enumerate 環境内のすべての \item の後に \vfill を取得するにはどうすればよいですか?

\newpage を含む enumerate 環境内のすべての \item の後に \vfill を取得するにはどうすればよいですか?

私は授業用のノートパックを作成しようとしています。これは基本的に1ページに2つか3つの質問が書かれた長いリストで、各質問の後に生徒が解答を導き出せるスペースがあります。私はそのenumitemパッケージを使用していて、ほとんど完璧な解決策は、カスタム リスト環境を使用し、垂直方向の間隔の作業を定義するitemsepことです。after

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\newlist{questions}{enumerate}{1} 
\setlist[questions]{label=\itshape{{Question }\arabic*.},
                    ref={Question }\arabic*,
                    leftmargin=*,
                    itemindent=*,
                    itemsep=\fill, 
                    after={\vfill},
                    resume}

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

これは問題なく動作しますが、手動で次のコードを挿入して、これらの質問を 2 ページに分散することにします\newpage

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
           \newpage
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

このバージョンでは、質問 2 はページ 1 の一番下に配置され、その後にスペースがありません。questions次のように、新しいページの前でリストを終了し、その後で再開することで、これをある程度修正できます。

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
    \end{questions}
           \newpage
    \begin{questions}
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

...しかし、新しいページを挿入するたびにリストを終了して再開するのは面倒です。

enumitem パッケージを使用して、必要な動作を実現するより「エレガントな」(つまり、より簡単な) 方法はありますか? 私は enumitem にかなり満足しており、本当に正当な理由がない限り、別のパッケージに切り替えるつもりはありません。

答え1

オートマチックがあります\vfil\newpageに押しつぶされそうになりました\fill

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\newlist{questions}{enumerate}{1} 
\setlist[questions]{label=\itshape{{Question }\arabic*.},
                    ref={Question }\arabic*,
                    leftmargin=*,
                    itemindent=*,
                    itemsep=0pt plus 1fil, 
                    resume}

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
    \newpage
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

答え2

問題は、\itemsepグルー (glue) がコマンドによって挿入されるため\item、2 ページ目の先頭にあり、ルールによって破棄されてしまうことです。

TeX はページを完成するとそれをメモリから削除するため、「バックトラック」する方法はないようです。したがって、\vfillの前に手動で を追加する必要があります\newpage

いくつかのセマンティクスを追加すると、次のようにすることができます

\newcommand{\questionbreak}{\vfill\pagebreak}

例:

\documentclass{article}
\usepackage{enumitem}

\newlist{questions}{enumerate}{1}
\setlist[questions]{
  label=\textit{Question} \arabic*.,
  ref=Question \arabic*,
  leftmargin=*,
  itemindent=*,
  itemsep=\fill,
  after=\vfill,
  resume,
}

\newcommand{\questionbreak}{\vfill\pagebreak}

\begin{document}

\begin{questions}
\item First Question

\item Another Question

\questionbreak

\item Another Question

\item Another Question

\end{questions}

\end{document}

ここに画像の説明を入力してください

小さな変更を確認してください:\itshape引数を取りません。数字も斜体にしたい場合は、

label=\textit{Question \arabic*.}

関連情報