编辑 - 2015-05-30

编辑 - 2015-05-30

tasks当尝试将环境直接合并到环境中时,似乎存在布局问题,因为在(enumerate) 和 的开头enumerate之间没有指定文本。\itemtasks

有没有办法可以规避这个问题,而不必诉诸使用\text{}和否定\vspace*

请注意,即使不使用包,也会发生同样的事情enumitemtasks文档指出,不能嵌套两个(或更多)tasks环境,这就是为什么我将一个嵌套tasks在一个中enumerate

梅威瑟:

\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}

输出:

输出显示与上述代码相关的问题


编辑 - 2015-05-30


之所以说负面想法\vspace不切实际,是因为当布局使得问题\item位于页面底部时,它会产生异常的分页符。

插图:

\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}

输出:

输出显示与上述代码相关的问题(第二个块)

答案1

只需在插入空白条目后垂直更正空格即可:

在此处输入图片描述

\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}

相关内容