Open laurmaedje opened 1 year ago
Thanks for your attention! Feel free to share and use this anywhere!
Reply on the remarks:
The thing with the script letters is interesting. Are they even part of Unicode?
I didn't think about this. ~So I've just search on Compart (https://www.compart.com/en/unicode/) and found that they are Unicode letters. For example, the letter $\mathscr{P}$ \mathscr{P}
is actually Mathematical Script Capital P \u{1D4AB}
.~ Script letters and calligraphic letters are the same (handwriting letters with different fonts?) according to this Chinese post on Zhihu. Need to check https://www.ctan.org/pkg/mathrsfs and https://ctan.org/pkg/unicode-math.
Widehat is available, it's automatic if you write
$hat(x+y)$
Oh, nice! I didn't even try this. I'll update the document then.
doteq is
$dot(eq)$
because the dot is an accent
I've tried this but didn't adopt it. I don't remember why though. Maybe the spacing is not identical with the LaTeX \doteq
? I'll check this soon.
Maybe there can be an explanation for scaling: They scale by default if the symbol is entered directly as a codepoint, they don't scale automatically if you use symbol notation like
$angle.l$
.
Yeah, I think there should be some explanations. I'll add this comment by creating a co-authored commit.
The examples for the
h
function are missing a hashtag because the function consists only of a single letter
Oh yes, mentioning single letter functions without a hashtag may be ambiguous. Thanks for pointing this out.
The alignment example is a bit weird since it would look the same without alignment, but I guess that goes for the original LaTeX version, too
I just tried to mimic the original LaTeX version 😝 and didn't think much on this.
$"9.8" "m/s"^2$
would work for the units thing, but it's obviously hacky and not good. Typst needs to support this better.
I have no idea here because I'm not familiar with the ~
spacing in LaTeX. I'll add this (with a 💦 annotation as this is hacky) in a co-authored commit.
I've tried this but didn't adopt it. I don't remember why though. Maybe the spacing is not identical with the LaTeX
\doteq
? I'll check this soon.
So here's a simple test.
LaTeX | Typst
with LaTeX code
\documentclass[10pt]{article}
\usepackage{mathtools, amssymb, amsthm}
\begin{document}
\[ \doteq \]
\end{document}
and Typst code
#set text(10pt)
$ dot(eq) $
Remark on script characters: The font files are in a typical LaTeX distribution (CTAN: /tex-archive/fonts/rsfs), but they're postscript type 1 font, and I think Typst only support opentype font.
Maybe something in https://stackoverflow.com/questions/9322635/how-can-i-convert-postscript-type-1-font-to-otf-or-ttf can convert them to a Typst-compatible format.
https://tex.stackexchange.com/questions/659025/context-lmtx-how-to-use-the-rsfs-font?noredirect=1&lq=1#comment1640490_659025 also has some discussion but nothing too useful.
On the doteq issue, I attempt to build the symbol myself a bit but I still don't understand how the box model work in Typst (compared to that in TeX), as well as the issue of spacing between math symbols/mathstyle (mathchoice):
#let doteq1 = box(baseline: -0.5pt, align(center, stack(spacing: -2pt, sym.dot, sym.eq)))
$ a dot(eq) b, a = b, a doteq1 b $
$ 2^(a dot(eq) b, a = b, a doteq1 b) $
I wrote something weird but maybe usable.
#let eqdot = $\u{2A66}$
#let doteq2 = style(styles => {
let ex = measure("x", styles).height
box(baseline: -ex, align(center, stack(spacing: (0.3455 - 1 + 0.1874 * 2) * ex, $dot$, $eq$)))
})
$ doteq2 = eqdot quad a doteq2 b, a = b, a eqdot b \
2^(doteq2 = eqdot quad a doteq2 b, a = b, a eqdot b) $
Sad to find out that eqdot
is a Unicode character (Equals Sign with Dot Below) while doteq
is not.
See, the problem is that your doteq2 does not respect mathstyle. In superscript doteq still keeps some spacing around it, while = and eqdot doesn't.
In TeX this would be solved with \mathchoice. Not sure about this, maybe there's some way to extract the information whether the current text is in superscript or not from the style
?
Unfortunately repr(style)
just return ..
, it's opaque.
It turns out that doteq
is \u{2250}
(see #9). Here's a new demo with typst 0.1.0 (94e052b8)
:
#let eqdot = "\u{2A66}"
#let doteq = "\u{2250}"
Customized symbols defined with `"..."`:
$ doteq = eqdot quad a doteq b, a = b, a eqdot b \
2^(doteq = eqdot quad a doteq b, a = b, a eqdot b) $
#let eqdot = $\u{2A66}$
#let doteq = $\u{2250}$
Customized symbols defined with `$...$`:
$ doteq = eqdot quad a doteq b, a = b, a eqdot b \
2^(doteq = eqdot quad a doteq b, a = b, a eqdot b) $
With typst 0.4.0 (f692a5ef)
, there's no difference any more.
The width of hat
is not always suitable e.g. hat(x_i)
or hat(x y)
. This has forced me to write hat(space x_i space)
.
The width of
hat
is not always suitable e.g.hat(x_i)
orhat(x y)
. This has forced me to writehat(space x_i space)
.
Good point! I hope that readers can do this with the help of Section Spacing in mathematics.
Just out of curiosity: in what context are these use cases?
For me:
hat(space x_i space)
in Typst / \widehat{x_i}
in LaTeX) is really rare. Almost always use $\Large \hat{x}_i$ (hat(x)_i
/\hat{x}_i
).space
$\Large (\widehat{\vec{u}, \vec{v}})$ ((hat(arrow(u)\, arrow(v)))
[^*]/(\widehat{\vec{u}, \vec{v}})
) is OK.[^*]: actually, maybe something like paren.l hat(#h(0.1em) arrow(u)\, arrow(v) #h(0.1em)) paren.r
is better.
Hey, I'm one of the Typst developers. This is great!
A few remarks:
$hat(x+y)$
$dot(eq)$
because the dot is an accent$angle.l$
h
function are missing a hashtag because the function consists only of a single letter$"9.8" "m/s"^2$
would work for the units thing, but it's obviously hacky and not good. Typst needs to support this better.PS: Would you be fine with us posting this on Twitter with the Typst account?