typst.app

>Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use Typst is awesome, in particular if you want to generate documents programmatically.

40
7
rust
Rust 4mo ago
Jump
General purpose scripting language with no non-Rust dependencies
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 100%

    That might indeed be the case, I did not look very closely, but mlua has gotten quite some coverage (and I do like lua quite a bit), so I wanted it mentioned :)

    1
  • rust
    Rust 4mo ago
    Jump
    Rust just merged two new very fast sort implementations into stdlib
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 100%

    transitive performance benefits

    I would have assumed the benchmark suite accounts for that, otherwise the results aren't quite as meaningfull really. Which ties back you your 2nd senctence: I certainly trust the rust team more than myself on these things :)

    5
  • rust
    Rust 4mo ago
    Jump
    Rust just merged two new very fast sort implementations into stdlib
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 100%

    only affect very select use cases

    I did not read the whole conversation, but sorting seems a very common usecase (not mine, but seems to me a lot of people sort data), so this seems quite a broad improvement to me.

    that is already perceived as a pain point

    Note though, as is mentioned in the issue, that the survey showed people still prioritize runtime performance over compilation performance in general, so this tradeoff seems warranted.

    the total regression is still minor

    It's not unheard of that regressions can be unmade later on, so here's hoping :)

    5
  • rust
    Rust 4mo ago
    Jump
    Rust just merged two new very fast sort implementations into stdlib
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 83%

    The post mentioned that the introduction of these new algorithms brings compile-time improvements too, so how should I see this?

    I assume you mean the first post of the PR? I'd assume it's simply outdated (or might not have been true to begin with). See https://github.com/rust-lang/rust/pull/124032#issuecomment-2181789935 for the perf run with this PR, it's showing quite a bit of regression.

    4
  • rust
    Rust 4mo ago
    Jump
    Cargo-playdate 0.5 released 🎉
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 100%

    From the Fine Readme:

    This project allows you to create games for the Playdate handheld gaming system in Rust lang.

    You really should preface every announcement with something like this :)

    18
  • rust
    Rust 4mo ago
    Jump
    Allow argument in macro to be Option<T> or T
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    4mo ago 100%

    It's surprisingly simple: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f176852c61dcf0c3382f0ac97c26de03 As a side node, asking for a value, and then immediately calling to_string on it seems kinda hiding the allocation. I'd suggest let the user call to_string on it themselves.

    (e) Changed it a bit to account for passing None as the third argument.

    6
  • rust
    Rust 5mo ago
    Jump
    New crate: derive_typst_intoval
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    5mo ago 100%

    Did I get it right? The crate lets you directly input data into a typst document from an arbitrary struct?

    Well, typst provides those means in itself, this crate just makes it easier to fulfill the necessary trait.

    Also out of scope of OP, is typst in anyway capable of typesetting music notation?

    I don't really think so. Music notation is also pretty specific, so I'd look into specialized software for that (although it might be theres a latex package, those things are everywhere ^^).

    4
  • https://crates.io/crates/derive_typst_intoval

    Hey all! I've just published a small crate, and would like to take the occasion to not only announce this, but also make `typst` better known in the rust community, because I think it's awesome :) # What does this do? It provides a derive macro to derive `typst::foundations::IntoValue` for a struct. # Why would I want that? If you're using `typst` as a library, chances are you want to get data into your documents. Rather than using a templating library or rolling your own, I'd suggest using [`inputs`](https://docs.rs/typst/latest/typst/struct.LibraryBuilder.html#method.with_inputs) (I'm still excited being made aware of that!), which implies making a `Value` out of your data. `typst_macros` provides the possibility to derive [`Cast`](https://docs.rs/typst-macros/latest/typst_macros/derive.Cast.html), which includes the treasured `IntoValue`... for enums. This is a gap somewhat closed by this crate. # So what about this typst? [`typst`](https://typst.app/) is a typesetting system (akin to LaTeX) written in Rust. The core and cli are licensed freely, and it is very useable up to the point that I personally don't use latex anymore, but have switched to typst. I'm personally ultra-fond of the ability to use typst as a library, which makes it perfect for apps that want to produce high-quality documents from user-provided data. Any questions, comments, criticism, code reviews welcome! Also, give typst a shot.

    23
    3
    rust
    Rust 7mo ago
    Jump
    What are you working on this week? (Mar. 10, 2024)
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    7mo ago 100%

    It's absolutely awesome. For my use case, it already surpasses latex, but I'm pretty sure that for other usecases there will be a point where latex offers more, at least due to ecosystem support. I for sure made the switch (wrote some personal docs in typst as well), and I'd suggest anybody at least looks into switching, it's so much better :)

    From a dev perspective, it's also great that this is useable as a lib, instead of having to muck with an external binary (or rather full external latex installation).

    3
  • rust
    Rust 7mo ago
    Jump
    What are you working on this week? (Mar. 10, 2024)
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    7mo ago 100%

    I have an app that ultimately renders pdfs via typst. I'm starting to write tests for the output, exporting the documents to png instead and then applying something like https://github.com/kornelski/dssim or so.

    (If anyone has experience with that, I'd take any hint I get ;))

    6
  • rust
    Rust 10mo ago
    Jump
    The rabbit hole of unsafe Rust bugs – notgull – The world's number one source of notgull
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    10mo ago 100%

    This parting shot sounds pretty dire

    a bug in safe code can easily cause unsound behavior in your unsafe code if you’re not careful.

    That's definitely not how it should be. Fortunately, I think I disagree with that, since miri points to the "real" buggy code:

    unsafe { inner.as_ref() }

    As opposed to the article, I'd argue this code is not correct, since it did not account for alignment, which it must (I mean, by standard use of the word unsound this is unsound, since it can be called from safe code introducing UB). Or am I wrong? Is the fundamental value proposition of rust moot?

    4
  • rust
    Rust 11mo ago
    Jump
    Check out Typst, a modern LaTeX alternative
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    11mo ago 100%

    Note that this is not only a cli and a (closed source) web editor, but also a library. So it's possible to embed a full typesetting library in your project, which is awesome. It's probably not on par with TeX yet, but you can already do an awful lot with it. Scripting it is really much, much easier than, say, LaTeX.

    20
  • rust
    Rust 12mo ago
    Jump
    Share your projects
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    12mo ago 100%

    I've written nvim-rs, an async library for interfacing with neovim via RPC.

    As a sidejob, I'm writing and selling a program to create school reports.

    4
  • rust
    Rust 12mo ago
    Jump
    Hoping for clarity on how Rust works in these situations
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    12mo ago 100%

    A reference IS Copy, by the simple fact that it is a primitive value on the stack.

    This seems a bit misleading, noting that unique/mutable references aren't Copy. Shared references are Copy because it's sound to have that, and it's a huge QOL improvement over the alternative.

    4
  • rust
    Rust 12mo ago
    Jump
    Hoping for clarity on how Rust works in these situations
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    12mo ago 100%

    In fact, isn’t this not true just by the fact that references work for Strings and Strings size can’t be known at compile time?

    I don't understand this. Shared references to String are Copy, too. This doesn't have to do anything with sizes. Rather, it's implemented in the compiler, because it's sound to have it and a huge QoL improvement over the alternative... just the same reason why e.g. usize is Copy, really.

    is it dereferenced specifically because is Boxed on the heap?

    No, it's not really related to the heap. Box implements DerefMut, which is in-depth explained here.

    4
  • The ???? operator
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearKI
    KillTheMule
    1y ago 100%

    While funny, this also highlights part of why I like rust's error handling story so much: You can really just read the happy path and understand what's going on. The error handling takes up minimal space, yet with one glance you can see that errors are all handled (bubbled up in this case). The usual caveats still apply, of course ;)

    33