如何防止 ConTeXt 中的枚举后出现换行符?

如何防止 ConTeXt 中的枚举后出现换行符?

我试图在 ConTeXT 中的枚举后放置三列信息,如下所示:

1 text  |   more text   |   yet more text
2 text  |   more text   |   yet more text
3 text  |   more text   |   yet more text
4 text  |   more text   |   yet more text
5 text  |   more text   |   this is a sample
        |               |   of what happens when
        |               |   there is too much text
        |               |   it wraps
6 text  |   more text   |   yet more text

我尝试使用此代码,并花了几个小时尝试其他类型的表格和列集,但无法获得结果。此代码将文本显示在三列中,但不幸的是,每个项目符号后都会留出很大的空间。如何让分列文本与项目符号(或在本例中为数字)显示在同一行?我尝试使用,\blank[overlay]但没有成功。

\define[3]\tablewordsetis{
\starttabulate[|cp(.3\textwidth)|cp(.3\textwidth)|cp(.3\textwidth)|]
                    \NR
    \NC #1 \VL #2 \VL #3 \NC\NR
                    \NR
\stoptabulate
}

\starttext
    \startitemize[n]
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}
        \item \tablewordsetis{text}{more text}{yet more text}v
    \stopitemize
\stoptext

答案1

您需要采用不同的方法来获取表中的每个行的逐项计数器,最简单的方法是使用\itemtag打印当前项目值的命令。

除了命令之外,您还需要在表中增加一行作为计数器。

\starttext

\startitemize[n]
\starttabulate[|lp(.1\textwidth)|cp(.25\textwidth)|cp(.25\textwidth)|cp(.3\textwidth)|]
\NC \itemtag \NC text \VL more text \VL yet more text \NC\NR
\NC \itemtag \NC text \VL more text \VL yet more text \NC\NR
\NC \itemtag \NC text \VL more text \VL yet more text \NC\NR
\NC \itemtag \NC text \VL more text \VL yet more text \NC\NR
\NC \itemtag \NC text \VL more text \VL this is a sample of what
    happens when there is too much text it wraps \NC\NR
\NC \itemtag \NC text \VL more text \VL yet more text \NC\NR
\stoptabulate
\stopitemize

\stoptext

当您的项目计数器出现在如上所述的单独列中时,您可以替换\NC\itemtag组合该\NI命令。

\starttext

\startitemize[n]
\starttabulate[|lp(.1\textwidth)|cp(.25\textwidth)|cp(.25\textwidth)|cp(.3\textwidth)|]
\NI text \VL more text \VL yet more text \NC\NR
\NI text \VL more text \VL yet more text \NC\NR
\NI text \VL more text \VL yet more text \NC\NR
\NI text \VL more text \VL yet more text \NC\NR
\NI text \VL more text \VL this is a sample of what
    happens when there is too much text it wraps \NC\NR
\NI text \VL more text \VL yet more text \NC\NR
\stoptabulate
\stopitemize

\stoptext

相关内容