Live data from Hacker News

Exploring Typst, a new typesetting system similar to LaTeX

blog.jreyesr.com

111–120 of 243 posts

Re: Exploring Typst, a new typesetting system similar to LaTeX

#111
post #40

First of all, I will commend the Typst community for attempting to rectify the trainwreck that is LaTeX typesetting. It appears that they have succeeded. So Typst has its own styling system, and its own scripting system, and plugin system via WASM... isn't this just HTML with extra steps? Not to mention that Typst doesn't support HTML export https://github.com/typst/typst/issues/188#issuecomment-14933... , which is a…

PDF was designed to look the same on any device/viewer and that's something that HTML/CSS/JS will likely never be able to do (every browser does things slightly different!). HTML also lacks good support for embedding resources in a single file and is much heavier to display (try coding a whole HTML + CSS + JS engine vs a basic PDF/A viewer!). Moreover HTML/CSS lacks all the typesetting features that Latex/Typst support out of the box.

But anyway here's a challenge for you: take some random small document in Latex/Typst and try converting it to HTML/CSS/JS while keeping the same layout and visual feelings. Make it a single file you can share with people and try seeing if all browsers display it the same way.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#112
post #92

Typst is a lot of fun and lets you do some really cool stuff. However! In the process of doing that cool stuff, you may need to debug things and that’s when it’s no longer fun. There is no way to print anything out to console and debug anything about what is going on. People have asked for it for over a year now and the authors have refused/ignored their requests. I would be using it a lot more except for this. https…

The author of this issue is the main developer so I guess they want it done, just had other priorities. I agree typst needs better debugging tools, but you're a bit harsh. It has things like `repr` that can often be used to inspect objects, and `panic` can be used as a (admittedly crappy) substitute for printing a value to the console.

Would you prefer that I not say exactly why I am not using typst right now as I would like to? The debugging experience is jarring compared to everything else and it put me off. I'd like to be using it but for the things that I want to do, I need to be able to figure out the mistakes I was making faster and easier.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#113

I've moved all of my LaTeX-based content creation to Typst. It's: - Fast—Compiling my books would take around 1 minute (I often had to compile twice due to indexing). With Typst, it takes less than 5 seconds. - Easy to write—I actually don't write it, I wrote a bunch of Pandoc plugins to tweak the output from Pandoc (I write all my books in Jupyter these days, so lots of markdown). - Easy to read—I've used LaTeX for…

With your experience of both, have you found that Typst has fewer issues with conflicting/non-commutative plugins than LaTeX does? Because that's where I lose the most time with LaTeX: packages often mess with the (piles of) global state in ways that sometimes conflict, and the only "solution" seems to be that, if you're very lucky, sometimes conscientious package authors will try to "detect" (through various hacks)…

I think compatibility issues in LaTeX often come from packages that redefine the same macros in incompatible ways. This kind of things doesn't happen in typst because all user code is pure: a package can define 1) values or pure functions that can be imported (this makes them available only in the scope where they're imported) and 2) content that can be included in the document.

There's still potential for conflicts, for example content can contain elements that represent a state update such as incrementing a counter. Packages can define their own states for internal use, and the namespace is global, so they can interfere with each other if they don't follow good practice (prefixing state names with __package-name for example). And show rules can replace an element of content with another one, for example one package can replace verbatim code with a figure, and another package can format verbatim code. What happens if you mix them without limiting their scope?

But so far, I think the compatibility problems in typst are more of the "well, what do you expect?" kind. Compare to LaTeX where sensible code is broken when a package makes a small changes somewhere deep in the macro pile of cards.

For example someone here mentioned the example of one package changing "the" to red and another changing "the" to blue. This can be done declaratively in typst, and won't cause an error, but the result will depend on the order of declarations.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#114

It's cute that you can write greek letters by spelling them, without any escape: pi, alpha What I'd really want to type is however π, α Will this work in typst? I had some trouble installing it.

Yes that works. What trouble did you have installing it? (It's literally a single binary with zero dependencies)

> Yes that works.

Oh, that great! My major point of friction with LaTeX is that using unicode is not straightforward. You sort of can, by including the right packages and using the right interpreters, but it imposes strange constraints involving the fonts that you can use and whatnot.

Regarding the usage, it's probably my fault. I tried to compile it locally and it didn't work at first (requires newer rustc version).

Re: Exploring Typst, a new typesetting system similar to LaTeX

#116
post #77

Earlier quoted context omitted.

In general, with the TeX "engine", you can locally scope most changes by simply wrapping them in braces {}. However, if you have a need to override something globally (eg. a global heading font, or spacing at the paragraph level), there is really no way to do it other than doing it globally. How would Typst solve this without having the same problem? Eg. how can I have a package that sets every "the" in red colour, w…

>how can I have a package that sets every "the" in red colour, without it interfering with a package that sets every "the" in blue or titlecase? Exactly. Broadly, the things you might want a package/plugin to do can be categorised as "local" (e.g., add some new type of content in a fixed-size box that the layout engine can then treat the same way as it treats any other such box) or "global" (e.g., change where floats…

I disagree with the assumption that the red/blue conflict should produce an error. In real life most of the time you want one style to override the other. So in this simplistic example at least, having the result determined by the order is the correct behavior (and it's what typst does).

More generally, if your system generates errors left and right, you end up making it hard for users to find a combination of packages that work. It's better to make them work error-free as much as possible. And the concept of "overriding" is natural and useful.

I think typst does make a nice attempt at managing global effects. It's nowhere near perfect but works pretty well already. For example it's super easy to implement your example with two packages, one applying bold and the other applying italic:

    Template from package A: #show regex("\bthe\b"): set text(style: "italic")
    Template from package B: #show regex("\bthe\b"): set text(weight: "bold")
You can use both templates in any order, typst will correctly render "the" in italic bold.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#117
post #29

In the very limited time I used typst it has been pretty amazing, but imho there is one missing feature that a LaTeX successor, but even more so, templating engine should have. Come up or adapt a format, that can defer certain styling decisions to the consumer of the document. Stuff like, font, font size, line spacing, citation style, double or single column, numeration style, etc. On a different note, we got to find…

That was exactly my reaction after stumbling upon https://typst.app/universe/package/modern-cv/ I just want a replacement for ModernCV, not downloading MBs of fonts I don't want to use.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#118

I was hoping that the syntax for equations would be borrowed from LaTeX but it is not the case unfortunately. I would like to switch away from LaTeX, but i think the syntax for equations in LaTeX is pretty sensible actually.

Do give typst's syntax a try! I had the same worry as you but I now find typst's syntax more pleasant to write, and the resulting code is much more readable. Instead of

    \frac{1}{\alpha - 1}\ \mathrm{for}\ n\in\{1, \ldots, N\}
you get to write

    1/(alpha - 1) "for" n in {1, ..., N}

Re: Exploring Typst, a new typesetting system similar to LaTeX

#119
I have a love-hate relationship with LaTeX... in 2016, I wrote my PhD with it, for wich I defined lots of helpers and commands.I used xetex for some obscure reasons I don't remember.The final result was beautiful but I dread opening any of those files. And it doesnt compile anymore.

Among all the systems (tools, languages, devices...) I exploited professinaly, LaTeX is the one that remains the most obscure and frustrating to me. I'm not sure why.

Re: Exploring Typst, a new typesetting system similar to LaTeX

#120
post #108

While I appreciate these projects, I can't see any headway for something like this in our academic community. We have a very established ecosystem of LaTeX packages, styles and documents, some of which are more than 25 years old. Everyone knows it. Everyone collaborates with LaTeX. Knowledge is easy to pass on because it is well understood. Everyone knows (or are) the people who write the packages or maintain things…

Sure but you have to take into account how easier it is to build these things in typst. It's like one year since the first public typst release and someone already built a very functional "TikZ" equivalent called CeTZ. Far from being as mature as TikZ but easier to extend yourself.
Post reply on HN