注意:该中文文档为社区驱动的非官网文档,可能存在错译、漏译或过时等问题,请以官网文档 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 中文文档

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

在文本上添加上划线。

Example

#overline[A line over text.]
Preview

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

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

如何绘制线条。

详细内容参见 line 的文档 如果设为 auto, 则采用文本颜色和当前字体定义的粗细。

默认:auto

查看示例
#set text(fill: olive)
#overline(
  stroke: green.darken(20%),
  offset: -12pt,
  [The Forest Theme],
)
Preview

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

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

默认:auto

查看示例
#overline(offset: -1.2em)[
  The Tale Of A Faraway Line II
]
Preview

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

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

默认:0pt

查看示例
#set overline(extent: 4pt)
#set underline(extent: 4pt)
#overline(underline[Typography Today])
Preview

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

是否跳过与字形冲突的部分。

默认:true

查看示例
#overline(
  evade: false,
  offset: -7.5pt,
  stroke: 1pt,
  extent: 3pt,
  [Temple],
)
Preview

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

上划线是否位于内容后面。

默认:false

查看示例
#set overline(stroke: (thickness: 1em, paint: maroon, cap: "round"))
#overline(background: true)[This is stylized.] \
#overline(background: false)[This is partially hidden.]
Preview

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

要添加上划线的内容。