sijo
October 8, 2024, 12:20pm
1
The default tilde is very small:

```
$ tilde(U) tilde(I) $
```

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) $
```

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) $
```

How can I define `Tilde()`

to work like `tilde()`

but larger?

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

In math, the overline(U) is frequently used to denote closure, but the Typst-defined function ‘overline’ doesn’t have a good appearance for some fonts. Is there a way to specify the height, position, length, and thickness of that ‘bar’? One of my attempts is the following:
#show math.equation: set text(font: "STIX Two Math", size: 12pt)
#let overU = $ limits(U)^(#line(start: (1pt,0pt),end: (8pt,0pt), stroke: 0.7pt) #h(0.6pt) \ #v(-6.3pt) ) $
However, it seems to have some problems when adding…
1 Like

sijo
October 8, 2024, 2:16pm
3
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) $
```

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) $
```

Enivex
October 8, 2024, 5:01pm
4
The only truly robust solution here is switching to a font that has the look you’re looking for.

1 Like

sijo
October 8, 2024, 5:15pm
5
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) $
```

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?

Eric
October 8, 2024, 6:23pm
6
I filed an issue; it’s not limited to accents alone:

opened 06:22PM - 08 Oct 24 UTC

bug

### Description
When using `em` units in math mode together with script sized c… ontent, the resolved length is not adjusted to the scaled font size.
For example:
<table>
<tr>
<th>With <code>1em</code> spacing</th>
<th>With unicode 'Em Space'</th>
</tr>
<tr>
<td>
```typ
$ a #h(1em) b \
x^(a #h(1em) b) \
x^x^(a #h(1em) b) $
```
</td>
<td>
```typ
$ a\u{2003}b \
x^(a\u{2003}b) \
x^x^(a\u{2003}b) $
```
</td>
</tr>
<tr>
<td>
![image](https://github.com/user-attachments/assets/e15fcc2d-74c9-48c6-934e-eec32742d2fd)
</td>
<td>
![image](https://github.com/user-attachments/assets/a8b32b97-c26b-4e9b-bf38-29be1dce9955)
</td>
</tr>
</table>
This also manifests itself when setting the size of an accent, as seen in [How to define uniformly larger accents in math? (Forum)](https://forum.typst.app/t/how-to-define-uniformly-larger-accents-in-math/983)
### Reproduction URL
_No response_
### Operating system
Web app
### Typst version
- [X] I am using the latest version of Typst

1 Like