在不同的页面上保持相同的 \vfill

在不同的页面上保持相同的 \vfill

我用\vspace{\fill}它来均匀分布考试题目,但每页的长度都不一样。我希望每个题目后面的间距都一样,最后一个题目位于最后一页的末尾(但该题目\fill后面的间距也一样)。我也在使用多列,所以我希望最后一列不为空。

以下是 MWE:

\documentclass[12pt]{exam}
\usepackage{enumitem, multicol}

\begin{document}
\large
\begin{multicols*}{2}
\begin{questions}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}

\end{questions}
\end{multicols*}
\end{document}

答案1

这使用了与 multicols 相同的技巧,只不过是跨两页而不是一页。也就是说,它在展开之前将文本分成 4 个大致相等的列\vfill。问题是列并不完全相等,\vfill每列的数量也不相等。

\documentclass[12pt]{exam}
\usepackage{enumitem, multicol}
\usepackage{showframe}

\newsavebox{\tempbox}

\begin{document}
\large
\begin{multicols*}{2}
\global\setbox\tempbox=\vbox{\begin{questions}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing.
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\question This text means nothing. 
\begin{oneparchoices}
\choice 1 \choice 2 \choice 3 \choice 4
\end{oneparchoices}
\vspace{\fill}
\end{questions}}% end of \vbox
\setbox0=\vsplit\tempbox to 0.25\ht\tempbox
\setbox1=\vsplit\tempbox to 0.333\ht\tempbox
\setbox2=\vsplit\tempbox to 0.5\ht\tempbox
\unvbox0\columnbreak
\unvbox1\columnbreak
\unvbox2\columnbreak
\unvbox\tempbox
\end{multicols*}
\end{document}

答案2

(1)为了避免第二页最后一列为空,请使用\begin {multicols}{2}而不是\begin {multicols*}{2}。这样将有两个平衡的列,而不是单个列。

\vspace{...}(2) 为了避免在每个问题之后插入,oneparchoices环境被修改为自动将其包含在末尾。

(3) 不要使用\vspace {\fill},它会在一页内均匀分布空间,但每页之间的空间可能会有所不同,最好使用固定长度,但添加一些粘连,以帮助 LaTeX 的分页机制避免在可能的情况下在问题和答案之间出现中断。

A

b

\documentclass[12pt]{exam}
\usepackage{enumitem, multicol}

%% ************************  added <<<
\AtEndEnvironment{oneparchoices}{%
%\vspace{0ex plus 0.5ex minus 0.5ex} % 16 questions en the first page   
%\vspace{0.8ex plus 0.5ex minus 0.5ex}% 15 questions but ..
\vspace{2ex plus 0.5ex minus 0.5ex} % 14 questions
%\vspace{3ex plus 0.5ex minus 0.5ex}  %13 questions
}
%% *************************

\begin{document}
    
\large
    \begin{multicols}{2}
        \begin{questions}

            \question This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question  This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question  This text means nothing. This text means nothing. This text means nothing.
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question  This text means nothing. This text means nothing. This text means nothing. This text means nothing. 
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    
            \question  This text means nothing. % last question
            \begin{oneparchoices}
                \choice 1 \choice 2 \choice 3 \choice 4
            \end{oneparchoices}
    %   \vspace*{\fill}  %<<<< uncomment for two columns, but not exactly balanced
        \end{questions} 

    \end{multicols}
\end{document}

如果您不喜欢最后一页的间距,请将\vspace*{\fill}前面的\end{questions}两列稍微不平衡。

C

相关内容