How to place a widehat above 3 letters?

Hello everyone,

I’m writing a course for my students on the scalar product.
And I’m trying to define it with 3 points.
But I’m having trouble writing the angle like we do in france.
In latex, I simply write \widehat(ABC).
But in TYPST this function doesn’t exist.
I tried :
#let widehat(body) = $accent(upright(body), hat)$
or
#let widehat(body) = $accent(upright(body), hat,size:#300%)$
but all I have is a tiny accent over the letter in the middle.

Is there a solution ?

Thanks for your help.

I tried :
hat(A B C) (doesn’t work)
One thing I don’t understand is that when I write hat(x+) the hat is above everything. If I write hat(x+y) the the hat is just above the +, but if it’s hat(x+m) the hat is above everything.
Of course everytime it’s between $$

It seems that my proble comes from the font I’m using in math mode : STIX Two math.

I used that to solve my problem :

#let widehat(body) = text(font: "Latin Modern Math", $hat(body)$)

I discovered that STIX 2 Math as another issue : the norm.
If I try

$norm(arrow(u)$

The bars go way too far down.

I had to add this :
#let norm(body, auto-size: false) = {
  if auto-size {
    $lr(‖body‖)$
  } else {
    $‖body‖$
  }
}

It’s not perfect, and there are probably other issues, but for now it works.

1 Like

For the record, Enivex and Max have just reported the issue to typst and stix fonts. You can subscribe to them to get future updates.

Besides, the following might be more convenient. It uses new features introduced in typst v0.14.0. Quite new, but I haven’t encountered any problems so far.

#show math.equation: set text(font: "STIX Two Math")
#show math.equation: it => {
  show regex("[‖ ̂ ]"): set text(font: "New Computer Modern Math")
  it
}

$norm(arrow(u))$
$hat(upright(A B C))$