0

I'm writing a book with a long list of questions. Most questions come in parts.

At the bottom of a page it breaks after printing the number of the problem but before printing the parts, which is clearly not the result I want:

Page 1 Page 2

The simplest solution to this I thought would be to add a \filbreak after each problem. But that adds some extra space between items.

Page 1 again Page 2 again

You can see in the previous version page 1 should fit 8 questions but only fits 7 now.

This is a real problem in the book I'm writing since the added space might be around 5mm for each problem. How do I negate this problem?

Note that I cannot use minipage because it doesn't interact nicely with tasks.

    \documentclass[a5paper]{article}
    \usepackage{tasks}
    \begin{document}


    \section*{Here are some questions: }
    \begin{enumerate}
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} \filbreak
    \end{enumerate}

    \end{document}
  • would using geometry package or changing the fontsize be a problem? – Raaja Aug 13 '18 at 11:23
2

You can try this:

\documentclass[a5paper]{article}
\usepackage{tasks}
\ExplSyntaxOn\makeatletter
\RenewEnviron {__tasks_env:} [3]
  {
    \if@inlabel
      \@beginparpenalty=10000 %new
      \noindent\par\nobreak\vskip-\parskip\vskip-\baselineskip\hrule\@height\z@
    \fi
    \dim_compare:nNnF { \l__tasks_before_list_skip } = { 0pt }
      { \vspace {\l__tasks_before_list_skip} }
    \list {}
      {
        \keys_set:nn {tasks/list} {#2}
        \dim_set:Nn \leftmargin  {0pt}
        \dim_set:Nn \rightmargin {0pt}
      }
    \item \scan_stop:
    \int_incr:N \l__tasks_depth_int
    \__tasks:VnnV \l__tasks_instance_tl {#3} {#1} \BODY
    \endlist
    \dim_compare:nNnF { \l__tasks_after_list_skip } = { 0pt }
      { \vspace {\l__tasks_after_list_skip} }
  }

\ExplSyntaxOff
    \begin{document}


    \section*{Here are some questions: }
    \begin{enumerate}
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
        \item \begin{tasks}(2) \task $1$ \task $2$ \task $3$ \task $4$ \end{tasks} 
    \end{enumerate}

    \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.