TypstDocumentation

underlineElement
Question mark

Underlines text.

Example

This is #underline[important].
Preview

Parameters
Question mark

stroke
auto or length or color or gradient or stroke or pattern or dictionary
Settable
Question mark

How to stroke the line.

If set to auto, takes on the text's color and a thickness defined in the current font.

Default: auto

View example
Take #underline(
  stroke: 1.5pt + red,
  offset: 2pt,
  [care],
)
Preview

offset
auto or length
Settable
Question mark

The position of the line relative to the baseline, read from the font tables if auto.

Default: auto

View example
#underline(offset: 5pt)[
  The Tale Of A Faraway Line I
]
Preview

extent
length
Settable
Question mark

The amount by which to extend the line beyond (or within if negative) the content.

Default: 0pt

View example
#align(center,
  underline(extent: 2pt)[Chapter 1]
)
Preview

evade
bool
Settable
Question mark

Whether the line skips sections in which it would collide with the glyphs.

Default: true

View example
This #underline(evade: true)[is great].
This #underline(evade: false)[is less great].
Preview

background
bool
Settable
Question mark

Whether the line is placed behind the content it underlines.

Default: false

View example
#set underline(stroke: (thickness: 1em, paint: maroon, cap: "round"))
#underline(background: true)[This is stylized.] \
#underline(background: false)[This is partially hidden.]
Preview

body
content
RequiredPositional
Question mark

The content to underline.