注意:该中文文档为社区驱动的非官网文档,可能存在错译、漏译或过时等问题,请以官网文档 Documentation 为准,如发现错漏,也欢迎 您的贡献镜像)。Typst 非官方中文交流 QQ 群:793548390
Warning: the Chinese document is a community-driven non-official document, there may be mistranslation, omission or outdated problems, please refer to the official website documentation.
Typst 中文文档

strike 元素
元素函数可以通过 set 和 show 规则进行样式自定义。

穿过文本的删除线。

Example

This is #strike[not] relevant.
Preview

参数
参数是函数的输入,它们在函数名称后面的括号中传入。

stroke
auto length color stroke dictionary
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

如何绘制线条。

line 的文档。如果设置为auto,则采用文本的颜色和当前字体中定义的粗细。

注:请勿真正用来删除,因为仍然可以复制粘贴文本。

默认:auto

查看示例
This is #strike(stroke: 1.5pt + red)[very stricken through]. \
This is #strike(stroke: 10pt)[redacted].
Preview

offset
auto length
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

相对于基线的线的位置。 如果设置为auto,则从字体表中读取。

如果不满足于字体提供的偏移量,可以使用此选项进行微调。

默认:auto

查看示例
#set text(font: "Inria Serif")
This is #strike(offset: auto)[low-ish]. \
This is #strike(offset: -3.5pt)[on-top].
Preview

extent
length
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

超出文本长度的量(如果设为负数则缩短)。

默认:0pt

查看示例
This #strike(extent: -2pt)[skips] parts of the word.
This #strike(extent: 2pt)[extends] beyond the word.
Preview

background
bool
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

线条是否应该放在内容后

默认:false

查看示例
#set strike(stroke: red)
#strike(background: true)[This is behind.] \
#strike(background: false)[This is in front.]
Preview

body
content
必需参数位置参数
位置参数按顺序传入,不带名称。

要添加删除线的内容。