Hacker News new | past | comments | ask | show | jobs | submit login

This is neat. I've used Latex before, and it definitely suffers from poor ergonomics. Both the language and tooling contribute to this.

The selling point seems to be that this is more similar to Markdown. That makes sense, Markdown is objectively more common and has more users than Latex. I've used both, but Markdown way more often.

Here's something I don't understand: it would be trivial to make Typst even more similar to Markdown, and yet it exists at some strange middle point in the language design space, arbitrarily far from Markdown.




Well maybe it’s good to make it clear that it isn’t markdown to avoid confusion? Also Typst has less syntactic sugar which also has benefits.

More generally, I am really impressed by Typst’s abstractions. I have typset my whole PhD thesis in it without needing any external packages. It was so easy to use the basic building blocks and write a few extra functions for the rest.


Is your template/source available by chance?



Great thesis on an interesting topic. I’m always a fan of good model explainability.

What did you use to generate the attractive and clear svgs?


Thank you for the kind words.

The plots were all created with Makie.jl [1] and lots of fiddling and manually writing code to get things right. Although I think Makie is great, I guess it would also be possible with other plotting libraries.

[1]: https://docs.makie.org/stable/


Places I’ve switched from LaTeX to Typst: My resume, research papers. Markdown was never a serious contender for my resume, since I want to control the rendering and the layout.

Places I’ve switched from Markdown to Typst: Slides. There are some okay Markdown-to-HTML solutions, but they have this unfortunate side-effect that you move the slides to some other computer, and something breaks in your rendering. PDFs ftw.


Are there journals/conferences that accept typst for typesetting yet? It is probably my main reason for staying in LaTeX.


Perhaps you can use pandoc to turn Typst into Latex and then do the little dance of making it compatible with the provided headers?

[ The latter is painful no matter what; once, I had a paper that I simply could not get to compile with the journal's header and had to give it to a wizard for examination. He did some manual TeX shenanigans resulting in a big blob of raw TeX at the preamble and it all worked. ]


the pandoc typst reader is a bit barebones, it doesn’t support packages (understandable) and seems to get confused with functions for me…though it’s been a bit since i tried it


How do you submit your research papers written in Typst?


I really wish typst had a good way to emit html. Id love to use it for blogging & technical writing and documentation.


(Typst dev here.) That's one of the next big things we plan to work on once Typst 0.12 has shipped. :)


I can’t wait! Thankyou for all your work - I really appreciate what you’re building!


I'm not sure the selling point is similarity with markdown, but rather, to improve, or modernize LaTeX/TeX-the-language/s: TeX is really archaic: if you're curious, there's a series of articles by overleaf[0] detailing some of TeX's inner-working, quite insightful.

I remember reading — but can't find a source at the moment — that TeX originally didn't had counters; people came to rely on Church numerals[1] instead, before Knuth finally implemented them.

EDIT: found out where I've read about it: [2]

[0]: https://www.overleaf.com/learn/latex/A_six-part_series%3A_Ho...

[1]: https://en.wikipedia.org/wiki/Church_encoding

[2]: https://news.ycombinator.com/item?id=29713270


> The selling point seems to be that this is more similar to Markdown.

The problem is that extending Markdown syntax gets messy.

    #figure(
      image("image.jpg", width: 70%),
      caption: [
        Observe the image in the picture
      ],
    ) <figure>
This is kind of a strange blend of Markdown, CSS, JSON, and HTML. TeX at least has a consistent syntax.


It may be similar to Markdown if you squint your eyes real hard, but it's not Markdown.

Furthermore, quoting a random snippet without any elaboration is unhelpful and only serves to confuse people (as it already did for the other comment!)

# means "evaluate". figure(...) is the function being evaluated.

The syntax inside figure(...) is fairly regular, not too different from what you'd see in typical programming languages (but with a document-oriented twist like the %).

<figure> may seem to be related syntatically to #figure(...), but it's not. It's just a label. Like an HTML div tag with id="figure". It can very well be changed to <foo> in your example and it'd still work.


Strange to the untrained eye, perhaps. To me that just looks like a function. In a long document I recently wrote, I defined a custom function

    #let img(filepath, inset: 0.5em, caption: none) = {
      figure(
        box(inset: inset, stroke: 0.5pt + gray, image(filepath)),
        caption: caption
      );
    }
and just used it like:

    #img("images/excel-5.0.png", caption: "Microsoft Excel 5.0 was released in 1993.")

edit: fixed unused inset param


Looks like it has a bug, the inset parameter is unused


Whoops, thanks. Wrote this one-off and never needed to change the inset so didn't catch that. Fixed!


These 6 lines actually put me off. Probably I have to read more about Typst syntax but, same for me, consistent syntax which covers necessary complexity wins over bending a markup language for purposes for which it was never intended.


It’s best not to think of it as a markup language. It’s a programming language designed around the needs of outputting pdfs.

Structurally it’s like a modern, nice version of php, only it’s built for academic articles rather than emitting websites.

The code snippet there packs in about 8 typst concepts all at once. It’s like if someone showed off how “simple” c++ is by showing some template-heavy magic. It’s straightforward once you’ve spent time with the language, but it’s a pretty terrible place to start learning typst. (That example shows expression mode, block mode, function calling, tags, named arguments, and probably more. Whew!)


That is a great analogy. When I wrote my note/hws in latex, I had the urge to go look for a package more frequently. When I started converting those docs into typst, I was able to hack around more easily, it really did feel like a modern programming language that has great error messages and that I enjoyed writing in. It did not feel complex, especially with the help of compiler errors messages


It's a little odd at first. I would recommend reading through the tutorial (which is quite good) and you might start to see some of the method to the madness.


Was do you find inconsistent here? It seems pretty consistent to me, except maybe the <figure>


and that <figure> tag is kind of moot -- as another commenter mentioned, it could have been some other html tag like a div


It's not a tag, there aren't even HTML/XML tags in Typst. The effect of that <figure> is giving the #figure(...) element the label `figure` (i.e. the name is what's inside the <>). Probably using the label "figure" was not the best choice for an example, something like <my_figure> would have been a bit less confusing showing that it is an arbitrary name/id that you choose.

Edit: and I think you also misinterpreted the other comment about the <div>. It wasn't about using <div> in place of <figure>, but rather that using <figure> in typst does the same thing as id="figure" in HTML.


I stand corrected. Thanks for the detailed info.


Personally, I don't really care about it being similar to Markdown. After all if someone wants Markdown they can just use that... For me the selling point is that it provides almost the same features as Latex except with a sane scripting language. This allows me to actually write my own scripts, as opposed to Latex where even understanding how basic stuff worked was a huge pain.


Markdown is a very poor language to try and use for anything other than single column typewriter like text.

As evidenced by the fact that every project which uses it for more than that adds arbitrary extensions.

The minimum viable language for non-mathematical technical documentation is reStructuredText.


As a side note, TeX engine could support Markdown or HTML or many other syntaxes too: it's easy to redefine control character in TeX to be anything instead or in addition to "\" (I've actually done that with Plain TeX a couple decades earlier to allow two-byte UTF-8 input by making all first-bytes of valid 2-byte UTF-8 sequences into control characters).

So, LaTeX being "unergonomic" is only relative — it's pretty ergonomic compared to things like HTML but especially DocBook or TEI SGML/XML schemas, but less ergonomic than Markdown or even Plain TeX. However, it inherits the most complex part where it is extremely ergonomic from Plain TeX (for the most part): editing math formulae.

But it's also much richer in expressing intent than any of those, and from what I can see, compared to Typst as well — LaTeX is basically semantic markup for excellent printed output (where Plain TeX is excellent printed output with no semantics, DocBook/TEI are pure semantic markup, and HTML/Markdown/Typst are somewhere in the middle too).


I write markdown and use Pandoc (plus some filters) to create Typst. Happy to never touch LaTeX again.


Could you give an example of how it could be more similar to Markdown? I recently used Typst for my bachelor's project and never really thought that it needed to be simpler




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: