在下面的文档中,项目嵌套在描述中,并且我希望条目之间没有垂直空间。
我使用 删除了 itemize 和 description 上方和下方的空间\vskip-\parskip
,但这可能不是正确的方法。如果 itemize 是 description 中的第一个内容,则此方法无效。
我尝试使用joinedup
并nowhite
如图所示这里,但间距仍然存在。
如何删除项目和描述上方/下方的空间?
代码:
\definedescription[description][
alternative=left,
width=2em,
before={\vskip-\parskip}, %<<< ?
after={\vskip-\parskip}, %<<< ?
]
\setupitemize[each][packed][ % [joinedup,nowhite] don't change spacing
before={\vskip-\parskip}, %<<< ?
after={\vskip-\parskip}, %<<< ?
]
\starttext
\startdescription{Foo}
\input knuth
\stopdescription
\startdescription{Bar}
\startitemize
\item ↑ Too much space above ↑
\item Just some Text
\item Just some Text
\stopitemize
\stopdescription
\startdescription{Baz}
A line that contains some text. A line that contains some text. A line that contains some text.
\startitemize
\item Just some Text
\item Just some Text
\item Just some Text
\stopitemize
A line that contains some text. A line that contains some text. A line that contains some text.
\stopdescription
\stoptext
结果:
使用的 ConTeXt 版本是2013.05.28 00:36
。
答案1
例如,当您使用嵌套 itemize 时,ConTeXt 会删除此类空格
\startitemize
\item
\startitemize
\item One
\item Two
\stopitemize
\stopitemize
但没有高级接口。不过,很容易提供一个包装器来包装低级命令
\unprotect
\define\concatitemgroup{\hskip\d_strc_itemgroups_signal}
\protect
然后使用
\startdescription{Bar}
\concatitemgroup
\startitemize
\item ↑ Too much space above ↑
\item Just some Text
\item Just some Text
\stopitemize
\stopdescription
不幸的是你不能使用
\startitemize[before=\concatitemgroup]
因为before
在中触发得太晚了\startitemize
。对于自动工作流程,您可以定义自己的描述渲染设置。
\unprotect
\startsetups[\??constructionrenderings:leftconcat]
\directsetup{\??constructionrenderings:\v!left:\v!none}
\hskip\d_strc_itemgroups_signal
\stopsetups
\defineconstructionalternative
[leftconcat]
[\c!renderingsetup=\??constructionrenderings:leftconcat]
\def\concatitemgroup{\hskip\d_strc_itemgroups_signal}
\protect
\definedescription
[description]
[
alternative=leftconcat,
width=2em,
]
\setupitemize[packed]
\starttext
\startdescription{Bar}
\startitemize
\item ↑ Too much space above ↑
\item Just some Text
\item Just some Text
\stopitemize
\stopdescription
\startdescription{Baz}
A line that contains some text. A line that contains some text. A line that contains some text.
\startitemize
\item Just some Text
\item Just some Text
\item Just some Text
\stopitemize
A line that contains some text. A line that contains some text. A line that contains some text.
\stopdescription
\stoptext
这使
如果没有垂直空间,只需添加
\setupitemize[nowhite]