#Math
4213 messages · Page 5 of 5 (latest)
I've noticed that there is no double exclamation symbol in codex. More on the math side though, I think !! makes sense as a shorthand in math for ‼
I don't understand why you would use such a restrictive license....
I don't think it's a math symbol
What does this symbol mean?
I actually found out about it from the MathML operator dictionary, and its used on wikipedia instead of two !
Why does Unicode have so many precomposed juxtapositions? 😭
Reminder that ⩶ is a single Unicode codepoint
so it is presumably semantic and should be used as opposed to two !
Okay that makes sense
https://en.wikipedia.org/wiki/Double_factorial is a thing (not very widely used)
The page I linked seems to use two !
I think the shorthand would be fine.
In Codex, it would probably be excl.double
I can't tell because the math is rendered (to svg?), but in the first line
In mathematics, the double factorial, or semifactorial, n‼
uses the right unicode char
Okay I retract my claim. It is listed on the big list in unicode-math
Actually, excl.double already exists
i might open a PR adding it as a shorthand then, it seems very uncontroversial
i'm guessing it is new? couldn't find it in the docs sym list I'm wrong it is there
It's not new
I just did a bad job
hmmm on further research it seems like it may not actually be used as a math symbol after all...
the mathml operator dictionary only has "!!" (the string literally) not the single unicode char
It is included in several math fonts at least
it seems quite a few don't have it though either? Looking at the unimath-symbols.pdf
True. Making it a shorthand though to convert to a single unicode char would make life much easier throughout the compiler, all the way through to MathML export (I'm only looking at this because n! is emitted as <mi>n</mi><mi>!</mi> currently, instead of the ! being a mo)
Can the web app (or even typst itself) even use the font with that license?
oh thats a good point
<@&1200368100202258552> might want to check it out
He may not have thought through the consequences of such a license change
He actually emailed me a while back asking about the change of the license (this was suggesting GPLv3+FE only then) and after asking Laurenz I responded saying it would be an issue for the compiler binary and to discuss with the team directly. AFAIK they never got a reply, but the new release included this "distribution exception", which I'd infer is the maintainer's way to ensure the fonts can be bundled into Typst
But yeah idk how that then applies to other projects using Typst that use a license "incompatible with the GPL"
The distribution exception wouldn't help though, because it's not compatible with MIT
It is with apache though (which is what the compiler is licensed under)
However, GPLv3 software cannot be included in Apache projects
But
This licensing incompatibility applies only when some Apache project software becomes a derivative work of some GPLv3 software, because then the Apache software would have to be distributed under GPLv3.
And the exception explicitly says though that any program distributing the fonts with a license compatible with GPL isn't considered a derivative work under GPL
Okay but even if that's the case it still may be a problem for the web app no?
it might be, yeah.
I think you're right, since the app runs locally in the user's browser it must count as distribution
(if it was like overleaf it would be different, you would need the affero gpl to trigger the restrictions)
I don't see how client/server side is relevant here
The bigger issue would be that the web app is not open source
Anyway, I leave this for the Typst GmbH legal department :p
usually if you use GPL software in your cloud app, you are not restricted in any way, as long as you only give the output to the user because the restrictions only kick in when you distribute the software (the Affero GPL was developed to plug this hole). So if overleaf was closed source they could still use GPL software in the backend without problem. But since the whole Typst sofware is sent to the client when you load the app (including the part that uses the fonts), it probably counts as distribution so the GPL would kick in
https://github.com/typst/typst/issues/1435 should this have been closed with https://github.com/typst/typst/pull/7742 ?
I don't know how to interpret laurenz' "We should probably avoid the "Closes X" syntax until things have actually landed in main."
oh it's because it's only the math-syntax branch
Martin and I have re-consulted the GPL text, checked the font's additional license text, and have concluded that New CM's terms are okay for both the open-source compiler and our web app.
That's good
Better safe than sorry
(I still think it's an awkward license for a font)
I agree and we would also avoid adding any other GPL-licensed fonts because there are always legal insecurities with GPL.
It sounds like the maintainer of NCM had tried to contact you, but didn't get an answer? Maybe you could ask if he could change his mind
No he didn't contact us
He contacted @desert spire, which referred him to us, but we never received an email.
AFAIK they never got a reply
I think "they" is referring to the team here
Hm, maybe I misunderstood then
If that's the case, @desert spire could make an introduction, I'd be happy to sort this out
https://ctan.org/pkg/newcomputermodern it's live on ctan now
All fonts are distributed under the GUST license except
NewCM10-Regular, all NewCMUncial, and all NewCM*Devanagari which are
So is the math font not GPL then?
Not yet, I think he said the roman letters are from Latin Modern, which is under OFL which is incompatible with GPL. So he needs to retrace them from scratch
So far its just been done for NewCM10-Regular (and the other fonts under the new license don't have those roman letters)
So why is he so interested in making it GPL exactly?
Idk, he just wants to license his work under a more copyleft license I suppose
that's not really the tradition for non-commercial fonts though
I guess I can understand where he's coming from, but I also think it can potentially cause people to stop using it because of potential headaches
@desert spire is this still supposed to be open https://github.com/typst/typst/issues/3784 ?
I suppose it has turned into a feature request now for some smarter alignment of underbrace text
Typst matches luatex exactly now
I didn't want to close it because the 'issue' is still there, even once we've aligned with luatex
Integral.slash has broken script placement in luciole, has anyone reported that?
I didn't check the other more specialized integral symbols, but I suspect they're similar
I was under the impression that this should have variation selectors now @subtle elbow ?
I am not sure what causes this result, as a font that does not support variation selectors should at worse display the original thing followed by an empty glyph (for the variation selector)
Some regression on main?
Although here the situation is a bit more complex because Typst is emitting variation sequences that are not valid Unicode. But the font shouldn't react in this way either way
it works with capital letters
though they're the same
maybe the lower case ones are simply missing in lete sans math
Or am I misremembering whether the lowercase one even exist?
Lowercase script letters have no standardized variation sequences in Unicode, but we emit the variation selector anyway. I was against that but we decided otherwise (can't find where though)
That seemingly breaks some fonts
ah nm, it simply doesn't have the glyph in the first place
I'll see if I can find one that has the lowercase ones
Oh that's right, I just checked as well
It would be better if only one tofu was shown instead of two
at least
But I guess it doesn't really matter that much
Wait, Lete is supposed to have both cal and scr
that is a capital letter
The version on the webapp must be outdated then
Description https://github.com/abccsss/LeteSansMath/releases/tag/v0.50 Use Case
let me upload it manually
When uploading it manually it works for me
Okay, I added a comment to the issue
Since it's in the web app issues repo I can't reopen it
@upper trench do you have the power to do that?
I'm afraid the issue was indeed solved internally , but i wonder if the wrong font version was used? Is there a way to check?
You would need to check which font file is on the server I guess. I don't think there's a way to check the metadata from the web app
But it's definitely the wrong one
Maybe updated but not the latest one
the latest is 0.61?
Yeah
@tawdry dock The font is definitely updated and I also see the scr version. You probably have an outdated cached version in your browser. Try clearing the cache. This is one of the reasons why I dislike updating fonts (next to reproducibility) --- our current font caching is very aggressive because the fonts consume a lot of bandwidth and we do not yet have a good way to evict these caches.
Sorry for the false alarm then! I will keep in mind the cache from now on.
I still think, on balance, keeping fonts updated is a good idea 🙂
I don't know how the caching works, but can a hash not be used to solve this issue?
Like, just including a hash in the file name
Yes, that would be the solution. But we'd also need to have something in place that ensures font updates don't silently break tabs that haven't yet reloaded and still have the old font index (which would then try to fetch a deleted file). So either both fonts need to be retained or something else. It's not super hard, but there would be some engineering effort involved.
One of the two hardest problems in programming after all 😂
#show math.equation: rect.with(stroke: purple)
#show math.equation: set text(font: "New Computer Modern Sans Math")
$ floor(vec(n, n, n, n)) $
renders incorrectly. This is an issue with NewCM Sans Math, right? I just want to confirm before sending an e-mail.
Does it only happen with the show rule?
The rect show rule is to show the size of the equation and is not necessary
The font rule is necessary
there's probably something wrong with the font indeed... trying the following with texlive 2025 and lualatex on overleaf:
\documentclass{article}
\usepackage{amsmath}
\usepackage[sansdefault]{fontsetup}
\begin{document}
\[
\left\lfloor \begin{pmatrix} n \\ n \\ n \\ n \end{pmatrix} \right\rfloor
\]
\end{document}
while when you remove the "sansdefault"
Presumably something wrong with the font metrics, and tex handles it somewhat more gracefully
Currently math.class can be used on any content, but it's applied recursively. Should that be changed? It would allow doing something like the following:
?r
$
&log x \
&log (x+y) \
&log class("normal", (x+y)) \
$
here class is used to have the whole (x + y) treated as normal (to have spacing with log consistent with the "log ..." notation), but it screws the spacing around + inside
(See forum thread for context)
In LaTeX, you use { } to group expressions, e.g. for attachments. In Typst, you do that with ( ). Understandably, though, ( ) outside of those situations renders as actual parentheses. But in LaTeX, you can also use { } directly in normal equations with no special syntactic role. You can write e.g. 1 + {2 + 3}, which renders like 1 + 2 + 3 would...
I recall coming across this before too. Applying it recursively probably isn't best, but I don't know whether not doing so will have any undesired side effects?
I can't think of any situation where recursive would be desirable. But maybe I lack imagination
i suppose the only issue would be that then it can't go on the style chain (at least not easily), since that applies recursively.
is there an issue open for this?
Not that I know of
https://ctan.org/pkg/lua-unicode-math I discovered this, not sure how much faster it actually is than unicode-math, since no benchmarks are provided
I filed one here: https://github.com/typst/typst/issues/8239
Currently math.class can be used on any content, but it's applied recursively which limits its usefulness. For example, to use the notation log ... consistently (instead of log(...)) and get co...
maybe it could work similarly to how math.op works?
?r
$
op(A.B) x \
op(A) op(.) op(B) x
$
Hmm I need to double check the code. It might actually just be super simple
Would be nice! I was a afraid it could be tricky, as I guess math.class should ideally apply only in relation to the outside, i.e. in the log class("normal", (x+y)) example it should set the class of ( in relation to the log, but not in relation to the x
Yeah that's the bit that I can't quite remember
With MathML export, I get the following error message in the Firefox console:
Balisage non valide : le nombre d’enfants de la balise <msubsup/> est incorrect.
Which translates to
Invalid tags: the number of children for the <msubsup/> tag is incorrect
Is this expected or should I try to find a minimal reproduction?
What does the mathml in question look like?
It's within a huge document. I don't know where in the HTML file the error comes from
False alarm. The issue was likely due to a weird show rule
I would still not expect weird show rules to cause html errors
Unless you're injecting raw invalid html
You can write some very weird show rules, but even the invalid HTML errors you might cause are very benign
Performance is no issue, ~8% faster than main on the math heavy test (test run 200, compared with 196). Not too shabby.
How does one get 8% from 196 and 200 @desert spire ? 😅
Those are test run numbers, Laurenz has a computer for comparing performance that some contributors can access remotely and run branches on. Not really meant for public use, so I'm not gonna link it unless he does, but there is a publicly accessible site
That's fine, I thought it means 196 and 200 runs of some document in a given amount of time, respectively
Yeah I don't want to link the site as it isn't exactly for public use. The run numbers are there for Laurenz then to have a look when he reviews it
Is there some other refactoring that makes it go faster? My understanding was that it's now doing more things?
It is doing more things, but some careful modification of what gets memoized netted the speed up
I wasn't expecting it to be faster, I just didn't want it to be slower
happy little accidents
https://github.com/typst/typst/issues/8343 is technically not really upstream but if at all rather downstream, right? Maybe we should have separate labels for these two things?
True, adding a separate label makes sense
There's a new bug fix release of old standard math https://ctan.org/pkg/oldstandard
(date is wrong in the version field on ctan, it was released today)
..I wrote pennstander for some reason,
Now that https://mathup.xyz came up again in #discussions, I was remembered that I liked it having special syntax for tensor indices (i.e. indices that are not merged but each have their own column). What do you think about adding something like this to Typst? Writing tensor indices is a bit of a pain right now. My best workaround is writingR^μ""_(ν ρ σ), but that is not really correct.
I think this is a job for a package
https://ctan.org/pkg/tensor could be a source of inspiration
I don't know whether the Math Refactor™ people have discussed this particular point, but I could see (R^μ)_(ν ρ σ) working for this purpose. Although this may have the drawback of making it more annoying to write sequences: ((u_i))_(i in NN)
I think it'd be almost impossible to create a syntax that's flexible enough, unambiguous, not super ugly, and also amenable to the level of tagging required by pdf/ua-2
Mathup doesn't need to care about these things since it's very much limited in scope
I suppose sequences are more common in general, so I don't know how I feel about that. Also, the real annoying cases switch levels more often, like (((R^μ)_ν)^ρ)_σ and there your proposal would still be nonergonomic
Maybe there could be an additional parameter to math.attach that would prevent the grouping behavior.
Conceivably you could create a package that took converts mathup string to typst math
I intend to add support to math.attach for tensor notation. Cause its got mathml output equivalents and can be laid out using the opentype spec
I have no idea what the interface would be. Maybe have the attachments be able to take an array?
But this has nothing to do with adding some syntax for it
E.g.
$ attach(R, tr: (mu, , rho), br: (, nu, , sigma)) $
Wouldn't that require a mess of # and $?
Uh probably? Idk. That seems like the only sane way to add it to attach tho
The only syntax I could imagine being semi-ergonomic with how typst works currently would be something like $ attach(R;;;;mu,,rho;,nu,,sigma) $, though counting the semicolons would be annoying...
as evidenced by the fact that I think I missed one 😂
Yeah that looks painful aha
If the semi colon syntax worked for named arguments that would make things more reasonable?
how would that work though?
anyway @fresh horizon has done a lot of thinking about parsing I guess
Good question. Aha
I think you could just define an argument list that alternates top/bottom, and then maybe make use of math allowing empty args. Something like attach.alt(base, t, b, t t t, b b b, t)
Maybe call it like attach.rows or attach.rows.tb or even attach.tensor
You also need to allow attachments on the left though?
I'm not super familiar with tensors
Haven't seen tensors with indices on the left yet. Also this would be really confusing (Which indices belong to which letter in the output of R^μ_νρσ ^ν_ρR^σ_μ)
I like this one
?r
#let cL = math.cal("L")
If we use a normal $L$:
$ L (x) "vs" L(x) $
If we use $cL$:
$ cL (x) "vs" cL(x) $
What's the underlying reason? And is this considered a bug or intended? (I think it should not work this way.)
It's because you defined cL using a string
which is interpreted as text
Do #let cL = $cal(L)$ instead
?r
But `cal(L)` and `cal("L")` used to behave the same with respect to spacing. It's only different since `v0.14.1`. It was still the same in `v0.14.0` and before. Is this intended?
$gradient cal(L) "vs" gradient cal("L")$
$cal(L) (x) "vs" cal("L") (x)$
I assume it's not indended because 0.14.1 should only fix things not introduce new behavior.
Yes it is intended, this was done by PR 7276 for Issue 7270 due to PR 5738 creating SymbolElem to solve the upright single letter string problem in math: $"a"$ was the same as $a$, but not $upright(a)$
This is likely going to see updates in the new math.var changes being spearheaded by @desert spire in PR 7855