如何将描述标签的宽度设置为 ConTeXt 中文本字符串的宽度?

如何将描述标签的宽度设置为 ConTeXt 中文本字符串的宽度?

我正在使用\startdesc{}创建标签和描述环境,例如:

\startdesc{(label)}
    This is some text in a sentence.
\stopdesc

\startdesc{(another label)}
    This is some more text in another sentence.
\stopdesc

不幸的是,这会导致标签长度不同,并且句子相对于左边距的起始距离不同。

(label)  This is some text in
   a sentence.

(another label)  This is some
   more text in another sent-
   ence.

我如何将所有标签的宽度设置为固定宽度,以适合字符串的宽度WWWWWWWW,而该字符串实际上从未出现在文档中?

(WWWWWWWW)  This is some text
   in the first sentence.

(label)     This is some text
   in a sentence.

(another labTlis is some
   more text in another sent-
   ence.

答案1

用于\setwidthof查找字符串的宽度:

\setwidthof A really really long long Long word \to \WIDTH

对于描述,您可以使用width键来设置标签的宽度:

\definedescription[desc][width=\WIDTH]

相关内容