7 ms·
Gribouille 0.3.0: A Grammar of Graphics for Typst
- unrealhoang 4mo agoThis is awesome, is there a way to render the graphics/chart in svg so that we can implement something like hover & popup (with data information)?
- alhidade 4mo agoTypst supports SVG output natively.
- red_admiral 4mo agoFrom past experience (may be different now): Typst supports SVGs that are actually vanilla SVGs. The SVG standard lets you embed a HTML page and CSS as a <foreignObject>, which only renders properly in a browser or something that bundles one (surprise!). This is not the fault of Typst and I think Typst is correct not to go down that route. Just a heads up if you wonder why draw.io (diagrams.net) SVGs display as black boxes.
- deleted 4mo ago[deleted]
- adamnemecek 4mo agoTypst is the most important open source project of the last 5 years. I predict a future where markdown and latex are largely replaced by typst. And I couldn't be more excited. It is such a stepup from markdown and latex. Try it today if you are intrigued.
- mastermage 4mo agoFor Latex I agree thats definitely. Markdown I am unsure as Markdown is not meant for creating documents but to just have a little Richt Text Markup in READMEs and other Text files. Typst needs a compile step and altough that one is fast as hell it is still different from Markdown that renders directly from the file without an intermediary.
- adamnemecek 4mo agoThe problem with markdown is that it's not extensible and that there is no spec. Essentially all READMEs would be better off using typst, they would make for better READMEs.
- sbysb 4mo agoI do not think that is the problem with markdown lol. There are lots of problems with markdown, especially vanilla or the more limited versions of it - but really its super power is that it is readable with a regular text editor (or `cat`) and can be rendered without a compilation step. Markdown is not competing with latex or typst, it is competing with (and has won against) .txt files
- Certhas 4mo agoActually basic typst is as readable as markdown, e.g. this is the example from the webapp: = The Typst Playground Welcome to the Typst Playground! This is a sandbox where you can experiment with Typst. You can type anywhere in the editor panel on the left. The preview panel to the right will update live. = Basics <basics> Typst is a _markup_ language. You use it to express not just the content, but also the structure and formatting of your document. For example, surrounding a word with underscores _emphasizes_ it with italics and starting a line with an equals sign creates a section heading. Typst has lightweight syntax like this for the most common formatting needs. Among other things, you can use it to: - *Strongly emphasize* some text - Refer to @basics - Typeset math: $a, b in { 1/2, sqrt(4 a b) }$ That's just the surface though! Typst has powerful systems for scripting, styling, introspection, and more. In the realm of a Typst document, there is nothing you can't automate.
- tlarkworthy 4mo agoOf course it's extensible, you can put HTML in it, and HTML is extensible.
- adamnemecek 4mo ago
- utopiah 4mo agoI'm not sure either matter to be honest. It's cool sure, powerful also... but when anybody has access to both vector-based editor and raster-based editor ... but also tools that incorporate them, e.g. rich text editors ... but also entire toolchain going from compilers to libraries all the way to Web based notebook with their editors and running environment that can then output printable artifacts, I don't think there has to be "the" way. They might be a more popular way within a certain zeitgeist but... does one project has to "replace" another one? I guess I don't really get the passion some people have for "perfect" rendering. I'm fine with just text, then just readible equations below it, then an OK looking graph. I don't actually care if any of those are pixel perfect. I don't get it. IMHO in terms of actual knowledge transmission reproducibility and interactivity are way more important. They might not look as good and in fact introduce a TON of complexity but I believe it's better than yet another system that is slightly better looking while being slightly easier, for those people with a specific mindset, to setup and use. PS: still both Gribouille and Typst are cool projects! Just want to make sure I'm not sounding critical against those efforts.
- adamnemecek 4mo ago> It's cool sure, powerful also... but when anybody has access to both vector-based editor and raster-based editor ... but also tools that incorporate them, e.g. rich text editors ... but also entire toolchain going from compilers to libraries all the way to Web based notebook with their editors and running environment that can then output printable artifacts, I don't think there has to be "the" way. They might be a more popular way within a certain zeitgeist but... does one project has to "replace" another one? cool, why do you think people use tikz? And like generating images programmatically from text is impossibly more powerful than using vector editors.
- zhshnsnnaaka 4mo agoI agree but to me it seems humanity has a terminal case of being unable to separate content from presentation. I can see it in this thread with clamoring for Typst in READMEs etc. If READMEs need to be anything they need to be plain bloody text. Markdown is the absolute maximum. Having some “header semantics” defined is fine as that’s universal in a document but let’s keep it simple guys, OK? Information needs to be plain and clear. Presentation can be fancy. Let’s keep these very, very different things separate. AI will thank you as well.
- red_admiral 4mo agoMarkdown and Typst serve different markets - I don't need page layouts and font choices in a pull request, for example. Typst is however a good Markdown++ in that once a collection of markdown files grows to book size, it's easy enough to port. Typst challenging TeX would be my dream too - there's a lot of math you can port just be leaving off the backslashes. Mind you the kids these days know TeX primarily as "that language in overleaf".
- sieve 4mo agoI like typst. But I am not a fan of the syntax. I use it as an intermediate format on the way to PDF. A document markup language should avoid building a programming language inside it. Pick python, or lua, or whatever.
- cryo32 4mo agoNot so sure. I work with a lot of people in academia who work with LaTeX. I haven't met anyone who knows Typst even exists. And the source material is usually just thrown in Word or LibreOffice. The problem is also momentum. Do you rewrite 30 years' of CTAN contributions, internal templates/styles and the toolchain off and start again or not? There's not much reason to. And you will hit the same brick walls doing so that you hit with TeX the first time round. If it is a greenfield, possibly, but all the orgs I've seen using LaTeX have been using TeX since the dawn of time and respect the accumulated knowledge rather than the distraction of a new tool.
- vatsachak 4mo agoAcademia is stuck in the past in a lot of ways.
- lkm0 4mo ago> accumulated knowledge my experience is the opposite. Due to LaTeX's arcane scripting and the lack of interest people have in learning it beyond "it compiles on overleaf", I'm seeing a lot of accumulated superstition. People copying and pasting preambles with useless packages, unused newcommands. Worse, people sometimes use their group's newcommands without being aware of the native functions, e.g. \beginmymatrix replacing \begin{pmatrix}. Even if change is slow, any amount of Typst adoption is good.
- cryo32 4mo agoIf it's any consolation we use native stuff including pmatrix :). In fact most of our typesetting is very very plain LaTeX.
- aloisdg 4mo agoMarkdown is already seen as arcane by non technical folks. Which is sad btw. Typst is not going to replace it. That said I was not a huge latex user and nowadays I use typst a lot. Typst is everything I was expected from latex. The content is in markdown and loaded by typst with cmarker
- eikenberry 4mo agoHow is it an step-up from markdown? Markdown (w/o any embedded html) is a simple text formatting that lets you read it as a plain text file with some minor formatting when rendered. Typst source files are not human readable in the same way and would be terrible at it. Typst is great when you need typesetting, but if you just want plain text, readable files it isn't it. E.g. markdown for notes, typst for papers.
- Diti 4mo agoAnything is a step-up for Markdown, unless you include HTML in your Markdown. The base features of AsciiDoc (or Org-mode) are alike to Markdown in terms of simplicity (no typesetting).
- fourthark 4mo agoIt's intended to be a markdown with code. So it has nesting and scopes and code/math modes in with the markdown. Idk, I find it mind-bending but quite readable.
- matijsvzuijlen 4mo agoWhy are all the parameters full words except 'labs'? I find it jarring because to me 'lab' is short for laboratory, not label.
- bestouff 4mo agoHe's open to API suggestions, you should open an issue
- matijsvzuijlen 4mo agoYes, I will do that!
- mcanouil 3mo agoThat's fixed in 0.4.0 awaiting approval for Typst Universe (plus other improvements in various areas).
- nxobject 4mo agoI suspect for consistency with ggplot - the same reason why ‘aes’ is shorthand and everyone forgets that it stands for “aesthetic”. https://ggplot2.tidyverse.org/reference/labs.html https://ggplot2.tidyverse.org/reference/labs.html
- matijsvzuijlen 4mo agoThanks, that makes sense. I actually just parsed aes as related to encryption without even considering how weird that was given the contect.
- nxobject 4mo agoI get it – in my (limited) opinion, there's a lot that's quirkily (but avoidably) named about ggplot and the surrounding R ecosystem in general.
- 4mo ago
- spider-mario 4mo agoWhat’s with the slanted figures until you hover over them?
- red_admiral 4mo agoAlways pleased to see Typst mentioned. TeX made a lot of choices that made sense at the time, but TeX macros and C #defines especially when nested and/or not properly bracketed to allow nesting are a mess when things go wrong.
- flerovium114 4mo agoIn what setting are you mixing LaTeX and C code?
- red_admiral 4mo agoNo, no, TeX macros nested within other TeX macros.
- cozzyd 4mo agoPretty common to emit latex from C, no?
- kzrdude 4mo agoIt is fun how in computer science terms, TeX and Typst are so incredibly far apart. TeX is a macro language that could be implemented in very little memory, while Typst literally memoizes every typst function's result; to the point where it will eat all available memory if the document and its editing increments needs it. This reflects the time in which they were developed.
- stared 4mo agoInteresting! If I get it right, the API is in the spirit of Observable Plot (https://observablehq.com/plot/ https://observablehq.com/plot/), less ggplot2. In any case, I'm curious whether aes is necessary, or whether it would suffice to drop this function entirely and just use keys in the mapping (similarly for labs). Or, more broadly, whether using patterns from other implementations of the Grammar of Graphics is a conscious decision, or some sort of legacy baggage.
- mcanouil 3mo agoThat's still an open question to be honest. Whether or not I should still surface aes() or just drop it in favour of the plain dictionnary. it's indeed not really necessary, but makes it way easier for all ggplot2 (R), plotnine (Python), ggsql (SQL) users to switch or adopt Gribouille in typst.
- stared 3mo agoMy take: does something add value OR is there because were are just used to? Gribouille is not ggplot2, or other. Syntax is different. Superficial keyword similarity is (usually) a false friend. Reusing a keyword might be useful, but keeping an unnecessary construction is (in my view), a cargo cult. Typst itself breaks with a lot of LaTeX stuff, and it is good that it does not pretend it is LaTeX-with-Rust, but has a fresh look.
- mcanouil 3mo agoWith a constructor, you get to document/validate. A plain dictionary makes this harder or virtually impossible (you most often will silently fail). https://m.canouil.dev/gribouille/reference/core/aes.html https://m.canouil.dev/gribouille/reference/core/aes.html I already drifted apart from ggplot2/plotnine in many ways, I don't mind as long as it's not confusing. I've opened a GitHub issue about this question (no ansers at this point): https://github.com/mcanouil/gribouille/issues/143 https://github.com/mcanouil/gribouille/issues/143
- 3mo ago
- elsoja 4mo agoIt seems to be fully written in native Typst, without any WASM backend. I wonder how is the performance like for complex plots or for documents with a large number of figures.
- jeremyscanvic 4mo agoIs ggplot2 considered to be a nice interface to plot things compared to say matplotlib in Python? I'm asking out of curiosity, I haven't touched R much
- stdbrouw 4mo agoYes, ggplot2 is lovely to work with for complex graphs. Whereas a classic plotting library will have one function to create a bar graph, another to create a line graph, etc., in ggplot instead you can stack layers, each with different properties, variables, shapes, data-dependent colors, scales, whatever you want. It also makes it easy to create grids of similar graphs.
- Arodex 4mo agoThe "grammar of graphics" conceptualized in ggplot is a very cohesive way to make (I think almost) any kind of graph, while remaining a high-level language/DSL.
- mightyham 4mo agoI find matplotlib to be clunky and verbose compared to ggplot. When using python, I will often use https://plotnine.org/ https://plotnine.org/ because it gives me a nice ggplot like API.
- NiloCK 4mo agoIs typst a good tool for something like a flyer (eg, printable respecting fold lines) or more generically one-page posters? I see PDF as a blessed output, but it seems mostly in context of longer form typesetting-heavy workflows (books, papers), rather than design-heavy.
- ink_13 4mo agoProbably not. As you point out, it's a typesetting tool like LaTeX, not a page layout tool. You could probably write a template that does the right thing, but that's true of LaTeX as well.
- flexagoon 4mo agoDepends on what the poster is. If it's still mostly text content, just arranged in a certain way, then by all means you can. For example: https://typst.app/universe/package/poster-syndrome https://typst.app/universe/package/poster-syndrome And here's one for foldable cards: https://typst.app/universe/package/keepsake https://typst.app/universe/package/keepsake (Not endorsing those specific packages, they're just the first ones I managed to find) For more free-form layouts, I just use Inkscape. It has built-in PDF export which works great. I assume other similar tools like Figma or Illustrator would also work well.
- mcanouil 3mo agoI do use them to make flyers and other PDF content. You can see an example on my LinkedIn account I posted last week when travelling (it's in French). https://www.linkedin.com/feed/update/urn:li:activity:7472526168886370305/ https://www.linkedin.com/feed/update/urn:li:activity:7472526...
- KolmogorovComp 4mo agoI actually think that with LLM we may very well hit a plateau in innovation here, because now the ugly syntax is not a hurdle anymore, since you don’t write it anymore by hand.