How to define uniformly larger accents in math?

The default tilde is very small:

$ tilde(U) tilde(I) $

image

I want to define a larger one, but the following gives terrible results:

#let Tilde(it) = math.accent(it, math.tilde, size: 1.1em)
$ Tilde(U) quad x^Tilde(U) quad x^x^Tilde(U) $

image

Is this a bug in math.accent?

One idea would be to use a ratio for the size, but that’s relative to the character width, while I want the same tilde size for every character (same as the normal tilde function):

#let Tilde(it) = math.accent(it, math.tilde, size: 130%)
$ Tilde(U) quad x^Tilde(U) quad x^x^Tilde(U) $
$ Tilde(I) quad x^Tilde(I) quad x^x^Tilde(I) $

image

How can I define Tilde() to work like tilde() but larger?

Hello! Would the answers on the topic below help you?

1 Like

Thanks for the link. It pointed me to a solution that kind of works:

#let Tilde(it) = $limits(it)^tilde$
$ Tilde(U) quad x^Tilde(U) quad x^x^Tilde(U) $
$ Tilde(I) quad x^Tilde(I) quad x^x^Tilde(I) $

image

What’s nice is that I can adjust the tilde size, e.g. by replacing tilde with text(1.4em, sym.tilde). But the spacing is not quite right, and adjusting it with baseline doesn’t work for all sizes (see example below).

The main problem with this solution is that sym.tilde is the wrong symbol: it’s meant as operator and doesn’t look good as accent. When I try to force usage of the accent, I have to adjust the baseline and it doesn’t work for all sizes:

#let largetilde = text(
  2em,
  "\u{02dc}",
  baseline: 0.35em,
)
#let Tilde(it) = $limits(it)^largetilde$
$Tilde(U) quad x^Tilde(U) quad x^x^Tilde(U) $

image

The only truly robust solution here is switching to a font that has the look you’re looking for.

1 Like

Makes sense. Going back to my initial example, actually I would be fine with the look of sym.tilde in New Computer Modern Math:

#let Tilde(it) = math.accent(it, math.tilde, size: 1.1em)
$ Tilde(U) quad x^Tilde(U) quad x^x^Tilde(U) $

image

Although not the same as the basic tilde, it’s fine to use as accent. But the way it gets excessively widened and flattened is a deal breaker. Is this expected or should I report a bug?

I filed an issue; it’s not limited to accents alone:

1 Like