Hacker News new | ask | show | jobs
by cbolton 816 days ago
I find the typst syntax nicer and more compact: https://typst.app/docs/guides/guide-for-latex-users/#maths

I was initially suprised to see that the typst devs chose to go with their own syntax, but I'm now very happy they did.

1 comments

I would be interested to see how the formula looks for a more complicated equation. For example, Eq 3.12 or 3.31 in the link https://arxiv.org/pdf/2203.09346.pdf
here's 3.31:

  $
  cal(C)(M) = cal(E)_T^t (theta, cal(S)_t)^2 + C_t M_t^(-2/d)
  + cal(E)_T^"PDE" (theta_t, cal(S)_"int")^2 + C_"PDE" M_"int"^(-2/(d+1)) \
  + C_1T^(1/2) [cal(E)_T^"div" (theta, cal(S)_"int") + C_"div" M_"int"^(-1/(d+1))
  + (1+nu)(cal(E)_T^s (theta, cal(S)_s) + C_s M_s^(-1/d))]
  $
Would you have the equivalent LaTeX code for comparison?
It should be in the LaTeX sources on the website. This does look much more compact though.

Just to now push it a little. I wonder if I can make the `1/(d+1)` in the superscript be not a real fraction but inline fraction.

Here are the LaTeX versions from the article source:

  \begin{align}
    \begin{split}
     \mathcal{C}(M) = &\: \Et^t(\theta,\S_t)^2
     + C_t M_t^{-\frac{2}{d}}
     + \Et^\pde(\theta,\S_\inte)^2 +C_\pde 
     M_\mathrm{int}^{-\frac{2}{d+1}}\\&+ C_1{T}^{\frac{1}{2}}
     \bigg[\Et^\divv(\theta,\S_\inte) +C_\divv 
     M_\mathrm{int}^{-\frac{1}{d+1}}+(1+\nu)
     big( \Et^s(\theta,\S_s) + C_s M_s^{-\frac{1}{d}}\big)\bigg],\\
    \end{split}
  \end{align}
and for 3.12:

  \begin{align}
    \begin{split}
    \norm{(u_0)_j-\hu_j(t=0)}_{L^2(\mathbb{T}^d)} &\leq 
    \norm{u_j-\hu_j}_{L^2(\partial \Omega)} \\&\leq 
    \sqrt{\frac{2\max\left\{2h_\Omega,d+1\right\}}
    {\rho_\Omega}}\norm{u_j-\hu_j}_{H^1(\Omega)}\\
    &\leq \sqrt{\frac{2\max\left\{2h_\Omega,d+1\right\}}
    {\rho_\Omega}}C_{1,k,d+1, u_1} \lambda_{1}(N)N^{-k+1}, 
    \end{split}
  \end{align}
Note that these rely on user-defined commands \Et, \pde, \inte, \divv, \S, \hu, for example \renewcommand{\S}{\mathcal{S}} and \newcommand{\Et}{\mathcal{E}_T}.
Yup. Much more verbose. However, I must admit, all the unescaped names in Typst leaves me with any eerie feeling. It seems a ground ripe for a name conflict at some point. Or a bottleneck for customization like calligraphic C or script C.
You can do that by escaping the slash: `1\/(d+1)`
Cool
Thanks for your effort. With this example, I started testing typst again and it does look to have improved quite a bit. And it is of course extremely fast.
You're welcome, I hope you'll like it this time!
should be close to 3.12

  $
  norm((u_0)_j-hat(u)_j (t=0))_(L^2 TT^d) &<= norm(u_j - hat(u)_j)_(L^2 delta Omega) \
  &<= sqrt(2 max {2h_Omega,d+1} / rho_Omega) norm(u_j - hat(u)_j)_(H^1 (Omega)) \
  &<= sqrt(2 max {2h_Omega,d+1} / rho_Omega) C_(1,k,d+1,u_1) lambda_1 (N) N^(-k+1)
  $
Thanks for your effort. This was instructive. Seems there's a decent alternative to LaTeX. May be over time it becomes as powerful in all respects.