Typst 报告式枚举

问题描述 投票:0回答:1

我想修改 Typst 的

#enum
函数,以按照技术报告样式对文档中的每个段落进行编号。

例如

+ Paragraph 1
 + SubParagraph 1
  + Sub-SubParagraph 1
+ Paragraph 2
 + SubParagraph 2
  + Sub-Sub Paragraph 2

应该导致:

1 段

1.1 小段

1.1.1 小段

2 段

2.1 小段

2.1.1 小段

这可以通过使用标题来完成,例如:

= Heading 1
== SubHeading 1
=== Sub-Subheading 1

结果:

1 标题

1.1 副标题

1.1.1 小标题

但我想枚举段落,而不是将文档中的所有内容都视为标题。

enums report enumeration typst
1个回答
0
投票

使用

#set enum(full: true)
,请参阅 枚举文档

使用枚举时,Typst 默认情况下仅使用当前级别的编号,而不是完整模式。您可以通过在列表之前插入一组规则(如上面的规则)或将其放入模板文件中来更改此设置。

一个最小的工作示例如下所示。

#set enum(full: true)

+ My top-level paragraph is only numbered with a `1.`

  + This is a sub-paragraph, so it receives a `1.1.`

  + Pay attention that given the right indentation,
    because an enumeration item can contain multiple
    paragraphs.

    So you'd need to manually insert a plus in front
    of each paragraph to ensure they all get their own
    number, unlike this one.
  
+ This is the second top-level item

还要确保在枚举项之间放置一个空行,如上例所示,这样 Typst 将插入段落间距而不是枚举间距(默认为行间距)。您可以通过在上面链接的文档页面上查找严格列表来了解有关这种区别的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.