Hacker News new | ask | show | jobs
by abdullahkhalids 1183 days ago
Latex is "typesetting-complete". This language is not, so it's not a replacement. For instance

* The syntax does not use escape sequences for functions/symbols, i.e. phi instead of \phi or floor instead of \floor. You will inevitably run into situations where, for instance, you want to write the letters phi, and have to resort to some ugly hack to write the natural language. This is not okay.

* There is reasonable syntax for text-formatting in bulk (whole paragraphs), but if you want to format a single word or sentence, the syntax seems to involve way too much work.

A side concern: This uses a mix of markdown-style formatting (asterisks for bold text) and programming style formatting. Personally, I think this makes it difficult to visually parse complex documents.

7 comments

I'd encourage you reading through the thesis explaining the decisions and the thing in details. Just did skimmed through myself and all your concerns are easily answered (https://www.user.tu-berlin.de/laurmaedje/programmable-markup...).

Your first concern is just wrong, afaik content and code live in different syntactic worlds. Code in content has a "#" sigil (and ends at some point) and content in code is delimited with square brackets. Your second concern is weird. For one off things you definitely just wrap it in a function call `#myweirdthing[blabla]`.

Last remark: you're bikeshedding. Seeing your previous remarks i'm not sure you should. Makes complete sense to have a simple powerful syntax and a handful of shortcuts for markdown-level common typography.

I'm absolutely not affiliated btw, just thought about very similar stuff for some time and been waiting for the release. I would've done a couple things sightly differently but the big decisions look very sensible and i'm sure they thought about it for a long time. Good work releasing this and thanks for the free software work!

The first bullet point is incorrect. In normal text, you use # for functions and symbols, i.e. #sym.phi or #emph. In math blocks, you don't use # for stuff like phi or floor but that's because it interprets everything as a function or symbol, with an exception for single letters. If you want any plain text in a math block, whether it's a function name or not, you just put quotes around it. If you want implicit multiplication, you need spaces between each letter.

I also don't know what you mean by the second bullet point. If you want repeatable single word or sentence formatting, you can define a function for it, which there is easy syntax for.

> If you want any plain text in a math block, whether it's a function name or not, you just put quotes around it.

Math fonts and plain text fonts should be different. If you put quotes around something, you get plain text font.

> If you want implicit multiplication, you need spaces between each letter.

Probably the first rule of any good typographical system is that it should not force the user to change how they normally write (barring special exceptions). Any syntax for typography should be additional to this, which is why escape syntax is so good. Forcing the user to put spaces between variables is a no go.

> Math fonts and plain text fonts should be different. If you put quotes around something, you get plain text font.

Why? LaTeX defaults to Computer Modern for both text in math and normal text. And if you want to change just the math font in Typst I'm pretty sure you can do that with a one line set rule.

> Probably the first rule of any good typographical system is that it should not force the user to change how they normally write (barring special exceptions). Any syntax for typography should be additional to this, which is why escape syntax is so good. Forcing the user to put spaces between variables is a no go.

Did you have a habit of putting backslashes before everything before you used TeX? This is a nonsense standard. The math that appears in papers is mostly special characters and so it makes sense to prioritize the syntax for that over implicit multiplication, which is often written with spaces anyway.

Yeah, I have all of my textbooks full of \frac{}{}, that’s definitely how I write math..
We had programming languages that didn't require spaces back in the 80s. It led to code like this:

    10 IFA=3ANDB=5THENPRINT"HELLO"
Even better, Fortran allowed spaces anywhere¹

    I FACE. EQ. BUT HEN GOT O1
¹ OK, not in a Hollerith constant.
If you want to write the letters phi, you can write p h i if you mean implied multiplication or "phi" if it should be a single unit. In general, Typst's syntax is designed to make every sequence of characters expressible, just like TeX.
I need 80% of LaTex with 10% of its problems. Typst, could be exactly that.
> The syntax does not use escape sequences for functions/symbols, i.e. phi instead of \phi or floor instead of \floor. You will inevitably run into situations where, for instance, you want to write the letters phi, and have to resort to some ugly hack to write the natural language. This is not okay.

Down in the README it's written that you need to put identifiers into quotes to write them in math blocks

> Latex is "typesetting-complete". This language is not, so it's not a replacement.

Based the documentation (and the title), it isn't meant to be _a replacement_, but rather _an alternative_ and that's totally OK. Not everything needs a drop-in replacement.

> i.e. phi instead of \phi or floor instead of \floor. You will inevitably run into situations where, for instance, you want to write the letters phi, and have to resort to some ugly hack to write the natural language.

I thought exactly the same: What if I want to write the product of f,l,o,o,r? Well, the "ugly hack" is explained in the readme: You just write "floor" with quotes instead of floor. Seems alright to me ;-)

The product of f, l, o, o, and r is denoted as $f l o o r$ (Same as $floor$ in latex). "floor" is exactly $\operatorname{floor}$
this isn't even a hack -- in Typst you write `$a b$` for implicit products, `$ab$` is always parsed as an identifier and you'll get a compile error if its not defined.
Ah, thanks for the correction, this is even better :-)