tasks
当尝试将环境直接合并到环境中时,似乎存在布局问题,因为在(enumerate) 和 的开头enumerate
之间没有指定文本。\item
tasks
有没有办法可以规避这个问题,而不必诉诸使用\text{}
和否定\vspace*
?
请注意,即使不使用包,也会发生同样的事情enumitem
。tasks
文档指出,不能嵌套两个(或更多)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}