Live data from Hacker News

Exploring Typst, a new typesetting system similar to LaTeX

blog.jreyesr.com

141–150 of 243 posts

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

#141
post #82

References in established systems like LaTeX work the way they do for a reason: you don't want to embed words in them (like "Figure" or "Section") automatically because it does not work across languages. Eg. both the article and docs at https://typst.app/docs/reference/model/ref/ use an inline reference that wouldn't work in Serbian. Serbian (and many other languages) have suffix declensions, so while "Figure 4" is "…

Why would a user who types only in English prefer a system that was optimized for all languages?

If Typst aims for eventually competing with LaTeX, getting outside the bubble of "everyone uses English" is a very good step to take. And it's good to take it early, when your system architecture is still easy to change and not implicitly ossified around englishisms.

Things like "if you ever want to translate your document from English to XXX, you will also need to port it from Typst to LaTeX" tend to be dealbreakers.

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

#142
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…

> A plugin that sets each "the" to red clearly conflicts with a plugin that sets each "the" to blue: at most one of them can "win", so which is it? Does it depend on which plugin was loaded first? If so, that's no better than LaTeX, and will become an ever-growing headache as the ecosystem grows.

Just loading a package in Typst won't perform side-effects. Instead what they can do is giving you some function that will apply the styling to any content passed to it. It will be up to you to choose to wrap your whole document in such functions in order have them apply globally, which can be done conveniently with something like `#show: foo_template`, where `foo_template` is the aforementioned function.

This still has a chance of "incompatibility", like in the blue/red example, because you might do this with two functions from two different plugins. However it is up to you to do this, and it will hopefully be clear that you're modifying global styles in two different ways with a specific order between them.

To be fair though I should mention that some packages will expect you to use `#show` with their functions, so sometimes it will be difficult to avoid using it multiple times.

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

#143
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…

You can embed attachments in PDFs. This way you could include CSV or JSON files into your PDF report. For a quick way doing it with CLI see `qpdf --help=add-attachment`

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

#144

Earlier quoted context omitted.

Which engine? I believe XeTeX and LuaTeX support it natively?

Yes, that is the problem, precisely. Lualatex and xelatex do not support all the features of plain latex (mostly "hacky" things, like pdf controls, js animations in beamer, etc). So, you have to chose between using these features and being able to type unicode letters directly. Probably there is a magic combination of engines and packages that allows to do everything at the same time, but I haven't found it. If this…

Uh, pdftex, xetex and luatex should support everything of the original tex engine, but each has extended tex, so some things will work on pdftex (which I think is what you're thinking of as plain latex), others on xetex and then others on luatex (or pairs of engines, I know microtype works on pdftex and luatex, but not xetex). I don't think this is an tex specific problem, more a natural result when there's multiple implementations.

I suspect as typst only has a single implementation (I believe), it won't have the problem of different engines ;)

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

#145

Earlier quoted context omitted.

I'm not a latex expert. I don't know what the difference is between tex math, latex math and amsmath is. (And please don't explain it, I don't care.) Maybe there are some weird expressions out there that don't have a typst equivalent, if we really looked for them. But I haven't run into anything myself, despite writing a pretty math-heavy CS paper. (Or at least, the early drafts were math heavy.) > I'm not interested…

I'm curious, how does typst work out that I want the function expanded or I want the literal string if there's no marker.

There are 3 syntactic modes in typst: markup, code and math. In markup, everything is literal, unless you put a `#` sigil like `#expr` in which case `expr` is parsed in code mode. In code mode everything is an identifier, as usual in programming. In math its a bit of an ugly tradeoff but its ok: single-letter things are parsed as literals but multi-letter tokens are parsed as identifiers. Finally, in code you can enclose in `[...]` to parse in markup mode. So typically, your document will be mostly in markup mode and you will encounter stuff like `#something[An argument]`, which is a function call to which you pass one content-typed argument.

So above, `y` is parsed as literal, while `dt` is parsed as an identifier, hence function call.

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

#146
post #121

It took me a few hours to be able to do things I could never do in Latex, which I have had used for a number of documents like thesis, project reports, etc. In Latex I always relied on googling random packages to fix weird stuff while in Typist I feel like I can do anything I want myself. The scripting capabilities are powerful and compared to latex insanely easy to use.

This! My first actual project (besides some testing) has been my phd manuscript, and after ~2 days i actually had a tufte-style 1.5 column layout going, written from scratch. And its probably like ~250 lines.

There are some rough edges still, the dom model and advanced programming stuff is not quite there yet (user-defined elements, user-defined settables, advanced layout like chaining blocks for laying text flows). But like the quality of the user interface is several orders of magnitude better than (La)TeX.

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

#147

Earlier quoted context omitted.

Why would a user who types only in English prefer a system that was optimized for all languages?

If Typst aims for eventually competing with LaTeX, getting outside the bubble of "everyone uses English" is a very good step to take. And it's good to take it early, when your system architecture is still easy to change and not implicitly ossified around englishisms. Things like "if you ever want to translate your document from English to XXX, you will also need to port it from Typst to LaTeX" tend to be dealbreakers…

Typst authors being germans, one can hardly accuse them in the "everyone uses English" attitude. Typst `dif` math operator (as in dx/dt) produces upright 'd', quite unexpected to ones used to slanted 'd' tradition.

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

#148

I really want to like this because it seems a lot more accessible to folks than latex but I'm getting that "uncanny valley" feeling like when I look at equations that have been typeset in MS Word. They look almost, but not quite, good. Like if you look at the equation for Binet's closed form solution for Fibonacci numbers in the link below from their github, it looks to me like there is a bit too much space on either…

I think you're imagining things... This spacing stuff is mostly defined in the font files and typst uses the same math font (or a more recent version, depending on your LaTeX config). I made a small comparison: https://imgur.com/a/0k6dsok

Note that by default, typst uses the book weight from New Computer Modern. This corresponds to the default settings in LaTeX with the "fontsetup" package.

The only difference I can see is the spacing after the comma. Not sure why typst does it differently. I think typst might be doing the right thing here actually, but it's easy to adjust if you want.

My typst code:

    $ round(1 / sqrt(5) phi.alt^n), quad phi.alt = (1 + sqrt(5)) / 2 $
My LaTeX code:

    \[ \left\lfloor\frac{1}{\sqrt{5}} \phi^n\right\rceil,\quad \phi = \frac{1+\sqrt{5}}{2} \]

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

#149

I like Typst, but I've had a couple issues so far: 1. The line spacing. It's not defined as baseline to baseline, but as the space inbetween two lines of text. Very difficult for an assignment with a prescribed line height since it usually refers to a baseline-baseline measure. 2. While having multiple columns is really easy, adding floating elements for the text to wrap around seems not possible. There's a reason al…

https://github.com/typst/typst/issues/4224

This issue and others like it are dealbreakers for me. There are numerous related issues, but the developers are stubbornly sticking to their interpretation—using the older definition of leading from the days of metal type, rather than the more modern concept of line-spacing. No other software or modern typesetting system I know of uses this approach anymore. This is particularly frustrating since I work with a lot of multilingual text, including Arabic, and it's very difficult to align the baselines when setting text in more than one column.

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

#150

I really want to like this because it seems a lot more accessible to folks than latex but I'm getting that "uncanny valley" feeling like when I look at equations that have been typeset in MS Word. They look almost, but not quite, good. Like if you look at the equation for Binet's closed form solution for Fibonacci numbers in the link below from their github, it looks to me like there is a bit too much space on either…

I think you're imagining things... This spacing stuff is mostly defined in the font files and typst uses the same math font (or a more recent version, depending on your LaTeX config). I made a small comparison: https://imgur.com/a/0k6dsok Note that by default, typst uses the book weight from New Computer Modern. This corresponds to the default settings in LaTeX with the "fontsetup" package. The only difference I can…

Thanks for doing the comparison but that just looks to me like I’m not imagining it. There’s more space around the plus sign with typst.
Post reply on HN