3

There seems to be a layout issue when attempting to incorporate a tasks environment directly within an enumerate environment, when no text is specified between the \item (enumerate) and the beginning of the tasks.

Is there a way to circumvent this issue without having to resort to the use of \text{} and a negative \vspace*?

Notice that the same thing happens without the use of the enumitem package. The tasks documentation states that one cannot nest two (or more) tasks environments, which is why I'm nesting a tasks within an enumerate.

MWE:

\documentclass[letterpaper, 11pt]{article}

\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{tasks}

\begin{document}

\def\sample{Boring and meaningless text that is long enough to show layout issues.}

\begin{enumerate}
  \item Test A
      \begin{tasks}
        \task Subtest A-1
        \task Subtest A-2
      \end{tasks}
  \item % No text here, before the tasks. CAUSES LAYOUT ISSUE!!!
      \begin{tasks}
        \task Subtest B-1 \; \(\leftarrow\) \; \textbf{PROBLEM HERE!!!}
        \task Subtest B-2
        \task Subtest B-3
        \task Subtest B-4
        \task*(2) \sample \sample
        \task Subtest B-6
        \task Subtest B-7
        \task Subtest B-8
        \task Subtest B-9
        \task! \sample \sample \sample \sample
      \end{tasks}
  \item Test C
      \begin{tasks}(2)%  %% Use two columns instead of the default 3 defined above, for no reason
        \task Subtest C-1
        \task Subtest C-2
        \task Subtest C-3
        \task Subtest C-4
        \task Subtest C-5
      \end{tasks}
\end{enumerate}

\end{document}

Output:

Output showing the issue associated to the above code


EDIT - 2015-05-30


The reason why the negative \vspace isn't a practical idea is because when the layout is such that the problematic \item sits at the bottom of the page, it generates an abnormal page break.

Illustration:

\documentclass[letterpaper, 11pt]{article}

\usepackage{amsmath}
%\usepackage{enumitem}
\usepackage{tasks}

\begin{document}

\def\sample{Boring and meaningless text that is long enough to show layout issues.}

\begin{enumerate}
  \item Test A
      \begin{tasks}
        \task Subtest A-1
        \task Subtest A-2
      \end{tasks}
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \sample
  \item \mbox{}\par\vspace{\dimexpr-\baselineskip-\parsep-\itemsep-\partopsep}% No text here, before the tasks. CAUSES LAYOUT ISSUE!!!
      \begin{tasks}(3)
        \task Subtest B-1 \; \(\leftarrow\) \; \textbf{PROBLEM HERE!!!}
        \task Subtest B-2
        \task Subtest B-3
        \task Subtest B-4
        \task*(2) \sample \sample
        \task Subtest B-6
        \task Subtest B-7
        \task Subtest B-8
        \task Subtest B-9
        \task! \sample \sample \sample \sample
      \end{tasks}
  \item Test C
      \begin{tasks}(2)%  %% Use two columns instead of the default 3 defined above, for no reason
        \task Subtest C-1
        \task Subtest C-2
        \task Subtest C-3
        \task Subtest C-4
        \task Subtest C-5
      \end{tasks}
\end{enumerate}

\end{document}

Output:

Output showing the issue associate to the above code (second block)

2

Just correct the space vertically after inserting a blank entry:

enter image description here

\documentclass{article}

\usepackage{enumitem,tasks}

\begin{document}

\def\sample{Boring and meaningless text that is long enough to show layout issues.}

\begin{enumerate}
  \item Test A
    \begin{tasks}
      \task Subtest A-1
      \task Subtest A-2
    \end{tasks}
  \item \mbox{} \par\vspace{\dimexpr-\baselineskip-\parsep-\itemsep-\partopsep}
    \begin{tasks}
      \task Subtest B-1 \qquad \textbf{No problem here.}
      \task Subtest B-2
      \task Subtest B-3
      \task Subtest B-4
      \task*(2) \sample \sample
      \task Subtest B-6
      \task Subtest B-7
      \task Subtest B-8
      \task Subtest B-9
      \task! \sample \sample \sample \sample
    \end{tasks}
  \item Test C
    \begin{tasks}(2)%  %% Use two columns instead of the default 3 defined above, for no reason
      \task Subtest C-1
      \task Subtest C-2
      \task Subtest C-3
      \task Subtest C-4
      \task Subtest C-5
    \end{tasks}
\end{enumerate}

\end{document}
  • thanks for your answer. Please see my updated question above related to the use of the negative \vspace. Any ideas to circumvent this problem? – feculededentier May 30 '15 at 15:39
  • For the moment, using \mbox{}\par\vspace{\dimexpr-\baselineskip-\parsep-\itemsep-\partopsep-0.1mm} (notice the extra -0.1mm) seems to resolve the abnormal page break without any obvious consequences. It is, of course, a less than optimal temporary hack... – feculededentier May 31 '15 at 0:35

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.