How to typeset a double underline in math mode?

For my masters thesis, it’s required to typeset vectors with a single and matrices with double underlines. Whats the best way to accomplish this double underline, as math.underline has no stroke option.

Screenshot 2025-07-14 151900

You should be able to use package mannot with its function markul to do this. Either once with a custom double stroke pattern (more trouble than it’s worth, I think) or using the function twice with different values for bottom outset, which is how you move the line.

1 Like

A simple solution that gets kind of close to your image involves just underlining twice:

#let ul(body) = $underline(body)$
#let uul(body) = $underline(underline(body))$

$ ul(y)(t) = uul(C)_C ul(x)(t) + uul(D)_C ul(u)(t) $

image

Defining the ul() function is not necessary, I just wanted to keep the names similar.

1 Like

Based on @bluss’s recommendation to use mannot:

#import "@preview/mannot:0.3.0": markul

#let ul(body) = $underline(body)$
#let uul(body) = $markul(markul(body, outset: #(bottom: 0.3em, rest: 0em)))$

$ ul(y)(t) = uul(C)_C ul(x)(t) + uul(D)_C ul(u)(t) $

Double stroke spacing can be controlled by changing the 0.3em to something else.

3 Likes

thanks a lot! using the approach with mammot’s markul now as the spacing is a bit better than the just calling the standard underline twice.

1 Like

You could also use an accent. Note however that under accents in math only work properly in the dev version, not 0.13.1 (IIRC). There’s U+0333 Combining Double Low Line in Unicode, which you can use as follows

#let ull(base, size: 100%) = math.accent(base, "\u{0333}", size: size)
$ ull(C)_C $

(I have no idea if this is stretchy in math fonts, so I’ve just added the size parameter for completeness).