Typst: An easy to learn alternative for LaTex
github.com
github.com
We’ve written more about this large-scale PDF generation stack in our blog here: https://zerodha.tech/blog/1-5-million-pdfs-in-25-minutes
We're having problems because until now PDFs are being generated by the ERP system, and it can't keep pace. I know there's a Dev team working on a microservice for PDF generation, but never thinked about doing it with Typst.
I think I'm going to send them @mr-karan link.
We also render shipping labels in PDF, and we have to be VERY strict with that. But we're still not touching that, as that process is not at slow and problematic as the invoicing one.
the end result when you open the file is still a regular pdf. it's just encoded with some areas unpacked
I was under the impressions that pdfs are not that safe. I thought they can do stuff like execute a subset of PostScript and Javascript.
Think about it - you want your reports to look sharp, right? PDFs deliver that professional look every time, no matter who opens them or on what device. Plus, they've got all those nifty features like password protection and digital signatures that the big guys love.
CSV files? They're great for crunching numbers, but let's face it - they look about as exciting as a blank wall. Try sending a CSV report to the board of directors and watch their eyes glaze over.
So, yes, for reporting in a company that's got its security act together, PDFs are your best bet. They're like the well-dressed, security-savvy cousin of other file formats - they look good and keep things safe.
In comparison to LaTeX, overall document typesetting is far more straightforward. However, for long multi-page stretches of equations solving, I feel that LaTeX is easier to type than Typst because its syntax is not that of a functional programming language but more akin to markdown. Thus, one does not need to think as far in advance when typesetting equations with lots of functions, superscript, and subscript.
For now I would not chose to write a paper in typst, because I most certainly need to convert it once it leaves the institution (even arXiv require LaTeX source).
Tooling around LaTeX is quite good today, with a plethora of IDEs helping. Personally I use Emacs' Org-Mode which compiles to LaTeX.
Footnotes might be handled properly in a future version of Typst. Regarding paragraph formatting I'm not so optimistic. I've read the thesis and papers by one of the Typst authors. They either don't seem to be aware of better approaches or they simply don't care about aesthetics.
Edit: Another thing that irks me about Typst is that it does not seem to be a purely not-for-profit project. It is tightly entangled with their commercial offering, whatever that might mean for the future of the "free" version.
One problem we had was over-eager hyphenation. We've addressed that recently. [2]
[1]: https://github.com/typst/typst/blob/9b001e21121ab7b5645aa36f...
Typesetting systems like Typst or LaTeX go beyond this. They're also about presentation, how precisely it is laid out, on mediums such as print or PDF. Is that something you need? If you care more about the content and its meaning, and are happy to have it rendered differently in different situations (a preview in Visual Studio Code, or passed through a markdown-to-html renderer, or viewed in Obsidian, etc), then Markdown might not just be fine, it may be preferable. But if you need to do things like print this on paper for mailing, email in a PDF, that sort of thing, then you'll want something more.
* https://impacts.to/downloads/lowres/impacts.pdf
* https://whitemagicsoftware.com/softcover/technical.pdf
* https://whitemagicsoftware.com/softcover/jekyll-hyde.pdf
Respectfully, keeping presentation logic and content completely separated while having precise control over layout can happen with Markdown, as the example documents demonstrate. The ConTeXt typesetting system makes keeping such separation possible.
The deeper issue relates to the software's architecture, which, IMO, systems like Typst, Obsidian, and others fail to generalize broadly enough. Here's KeenWrite's architecture (the "Proposed" row):
https://gitlab.com/DaveJarvis/KeenWrite/-/raw/main/docs/imag...
Although only Markdown is currently implemented, it's possible to plug other text-based input formats to produce an XHTML document. The instructions for how to typeset XHTML documents are defined by a theme. You can think of a theme as an XML to TeX translation layer. From there, going from XML to TeX is straightforward (when using ConTeXt, at least), allowing full control over the final output format (be it PDF, ePub, and so forth).
I am the author of KeenWrite. The following tutorial shows how its themes work:
https://www.youtube.com/watch?v=3QpX70O5S30&list=PLB-WIt1cZY...
These aren't Markdowns converted to PDFs. These are HTML websites rendered as PDF, where at some early point some text with basic formatting was fed in.
>keeping presentation logic and content completely separated while having precise control over layout
Does anyone really want that? I certainly wouldn't want that separation. I want to create some document and not a sophisticated template, so I am always willing to sacrifice generality over momentary needs, if I can't force the layout, then I need to waste time to implement some generality, which I don't need. Completely the wrong approach to document creation.
This looks like you really want to have a web framework, not a document creation system.
Would you like to see the source Markdown documents? My workflow is:
Markdown -> XML (XHTML) -> TeX -> PDF
If that isn't converting Markdown into PDF, what would you call it?> Does anyone really want that?
At time of writing KeenWrite has had over 4,000 downloads. So, maybe? However, my point wasn't whether people want it (besides me). My point was that it is technically possible to keep a Markdown document's content separated from its final presentation form (e.g., PDF).
> This looks like you really want to have a web framework, not a document creation system.
Not really: I want to write in Markdown (or R Markdown) using interpolated variables and generate PDF documents. I have spent about 9 years working on a cross-platform desktop text editor that allows me to do so.
I am pretty sure I know what they look like from the end result.
My point was that almost all of the design effort wasn't contained in the markdown. So clearly there were at least two major inputs to the documents. But of course you agree with that.
>Not particularly; I want to write in Markdown (or R Markdown) using interpolated variables and generate PDF documents.
To me the total separation only makes sense if you are designing for unknown content. If you control the input of content and formatting, then a closer linkage between both seems superior. Markdown is (intentionally) extremely limited, so everything that markdown can't do needs to be implemented in a general way on the formatting layer. Obviously that is more tedious if you have total separation.
What I meant by "web framework" is that they can't assume content, so need to deal with generality. Essentially what you are writing is a website generator, except with PDF being the end output. But generating general and reusable components doesn't seem to be how I would want to create a document.
Markdown is really more about getting words down in plain text with a very simple structure for rendering on the web.
Typst and LaTex make stark distinctions between composing and typesetting. They are programmatic typesetting systems with very structured and fine grained control over the look and design of a document once it's compiled and rendered as a PDF.
If all you're doing is writing prose then I honestly think typesetting programs are overkill unless you do want very fine grained control over how your documents look.
Markdown does not do any of that, it just gives you html.
You would want to use typst if you want to create a document and need to control how that document looks from the language itself. Even if you were to render the markdown html to a PDF, markdown itself, or even css doesn't give you control over many parameters of the output document.
There basically is no competition between the tools, they target different output formats.
Naturally, a format with more metadata loses metadata when converted to one with less (and the reverse, you may need to add metadata in when going up the chain), but unless your document is bound to a specific format (in which case, I'd pick RST for HTML and LaTeX for pdf), markdown gives you the content and pandoc lets you specify a template (and with pandoc, you can take the markdown and generate slides in HTML, PDF and create notes through the different outputs).
You should start out by defining your desired output and needed input. I realize that 99% of document content can be fully realized in markdown, but the 1% can easily be a total deal breaker and make using markdown a complete nonstarter.
In my experience, it rarely really matters fine control. If the effort is too big to tweak the templates/markdown you export it to an intermediate state (LaTeX/Office/whatever) and drop the original markdown source.
There is no lock-in.
I write markdown and use eleventy + nunjucks templates to build the final result.
It’s pretty easy to create new layouts and styles for really any use case with that setup in minutes.
* 30 year viability. * simple but explicit formatting: I need to specify font size, underline, and red text. * clarity in writing is almost as important as clarity in reading, so I am not fond of formatting directives mixed in with text.
That led me to RTF, since Markdown fails on the second and third point, and LaTeX fails on the last. But you have to determine your own requirements from your use case.
But, yes LaTeX has other benefits, e.g. citing references, or creating PDFs according to layout and typesettings best practices.
1 year ago, 146 comments: https://news.ycombinator.com/item?id=35250210
8 months ago, 34 comments: https://news.ycombinator.com/item?id=38354422
2 years ago, 53 comments: https://news.ycombinator.com/item?id=34423590
2 years ago 30 comments: https://news.ycombinator.com/item?id=32209794
LaTeX's awkward relationship with the web seems like something a competing greenfield project would try to nail right out of the gate (to mix metaphors painfully).
They both face the same problem, namely that the web and paper work completely differently and there are untranslatable concepts. So you have to define some way in which your typesetting gracefully settles into a different environment.
If typst had targeted html immediately it certainly would have made their life a lot easier, but it would have been nothing more than an overly complex site generator. Targeting PDF first means that they actually want to compete with LaTeX.
This division between web and PDF is meaningless to me. The ePub format is a book format based on Web technologies.
A better book format is to the benefit of everyone. To believe HTML can only make websites is counterproductive here.
I make PFDs in LaTeX because I am asked to use it, not because I believe it is a good format.
Targeting ePub is essentially the same as targeting the web, the distinction between having the file locally or retrieving it from a server seems entirely meaningless in this context.
>not because I believe it is a good format.
It is a pretty much perfect format within the constraints.
Starting a new markup system with no plan for making accessible documents was, in my opinion, a very bad idea. I refuse to use typst until it can produce accessible documents.
Mind saying more? Didn't know there'd been progress here.
for input in *.tex; do
pandoc "${input}" \
--from latex \
--to html \
--pdf-engine=latexmk \
--css="styles/texstyle.css" \
--standalone \
--mathjax \
--toc \
--number-sections \
--output="${input%".tex"}.html" ;
done
My pandoc version is: pandoc 3.1.9
Features: +server +lua
Scripting engine: Lua 5.4Why do you think anyone expects that?
Why should anyone looking for a typesetting tool care when it was designed?
Why don't you use a Commodore64? I know it doesn't do anything you need it to do, but you have to cut it some slack, it was designed before any of the things you need to do existed!
I've been using Jinja2 templates to generate TeX files, but Typst can take a JSON over the command line and is easy to use and powerful enough that I can completely remove the Python step.
Not to speak of the compile time that is measured in milliseconds.
The LaTex output was indeed better. My boss loved my work and had no idea that I wasn’t using Word. Feedback from the working group members was also positive. Wow, this kid has real talent! As a startup, making a positive impression on the giant companies represented in the working group was extremely important for the future of the company, if not its survival.
Unfortunately for me, one day my boss said, “could you send that Word doc over to big-whig so-and-so at massive-company-we-might-be-acquired-by? They want to use it as a template for a new document they’re writing.”
I got that sinking feeling similar to when my mom found out my friend and I had peed in my closet as an experiment at age four.
I then hired a friend to work all weekend painstakingly rewriting it in Word. Boss man got the document. Company was acquired for $100M 18 months later.
Either way, LaTex still looks 1,000x better than Word.
[1] https://github.com/overleaf/overleaf
[2] https://github.com/hackmdio/codimd
The issue I have with delimiters is that there is no option for "big", but only for "140%" or whatever, making it harder to be consistent Someone created an issue on this on GitHub if I remember correctly
And automatically chosen sizes are often too large
But then again, apparently so does LaTeX
My guessed probability that LaTex is free and maintained in 15 years: 99.9999%
My guessed probability that $OTHER_NEW_TOOL is free and maintained in 15 years: 5%
If you need something that will be supported for the next 20/30/50/100 years, you pick an already established product that is widely used and does not depend on any single organization. You can't rely on volunteer projects, as volunteers have no duty to maintain and support the product. And you can't rely on anything made by a single company, as companies lose interest and die all the time.
Check this out for example: https://github.com/tabu-issues-for-future-maintainer/tabu
This used to be the most recommended package for tables.
This bug is still not fixed after at least 9 years AFAIK: https://tex.stackexchange.com/questions/203629/longtable-and...
It affects us regularly.
I'm not even going to comment on the fact that all of the following packages provide some sort of tabular feature: array, table, tabu, tabular, tabularx, longtable, supertabular, longtabu, xltabular, lxtable, booktabs, tabularray, ctable. Good luck figuring out which one does what you need and has the least side effects with everything else.
Also, while I'm not familiar with the internals of the LaTeX project, I keep reading the same names, most of which appear to be getting closer and closer to retirement. I wonder if suitable successors will pick up the task of maintaining LaTeX in the future.
The way I learned it, the best practice of using LaTeX has always been based on whitelisting. When you create documents for yourself, you establish a list of packages that work well together and stick to it. And if you expect documents from others, you provide a document class and a list of supported packages.
But despite all these shortcomings, LaTeX is widely supported. Both in the technical sense and in the social sense. Journals and similar entities not only accept but often except LaTeX documents.
Making tools libre as a matter of course and mailing people checks for bug finds just rings different than today's dominant paradigm of landing pages, conversion rates, social media tie-ins and for-profit non-profits...
LaTex is positively arcane, but I still use it for all my writing since it's so incredibly versatile: Academic papers, letters, contracts, forms, invoices, tons of packages, pretty easy to apply regional standards, ...
How I manage to not go insane is Org Mode: I can write almost everything in something similar to Markdown but do inline LaTex as needed (since it compiles from Org to Latex to PDF). I find that incredibly powerful.
The one thing that really makes me excited when using Typst is that I find it very intuitive, meaning the time between not knowing how to do a certain thing and me being pleased with the result is much shorter with Typst compared to latex.
I cannot, reasonably, start using this for work until journals begin accepting papers in the format. But I am following until either that starts happening, or some workaround exists.
- https://typst.app/universe/package/hydra,
- https://typst.app/universe/package/chic-hdr
- https://typst.app/universe/package/wonderous-book
However I believe this functionality should be available in the typst core.
The difference between LaTeX and Typst is that LaTeX wants you to define a template with the "documentclass", if you want the same experience in Typst you want to setup typst with a template, there the headings will be defined for you already.
>However I believe this functionality should be available in the typst core.
You can trivially define headings in typst without using packages.
No true scotsman and all that, but I suspect few documents in the wild are bare Latex.
\documentclass[twoside]{article}
\pagestyle{headings}
in LaTeX. And this also does the right thing on special pages like table of content, appendix, bibliography etc.
Implementing all that in Typst is quite a hassle.
The `article` document class is actually some `article.cls` file that resides somewhere in your TeX install root, is loaded, and implements macros such as `/title`, `/section`, `subsection`, and so on. All LaTeX eventually expands into a pile of TeX macros that are evaluated.
All this is to say... LaTeX comes with the templates, you've been using one all this while.
It's comparable to LaTeX, but better in my opinion.
It looks similar to Gilles Castel's famous note-taking setup:
https://castel.dev/post/lecture-notes-1/
I would love to see someone combine this with Anki for quick math flashcard creation
I'm a mature undergrad, I've never used LaTeX, actively avoided it in fact and am forced to produce word documents. My current workflow is pandoc style markdown and obviously pandoc for conversion, with zotero for citations. I make use of pandoc-crossref for figures, tables, sections, etc.
I'm hopefully moving to a different uni for a masters this year. Can anyone who uses typst comment on whether I should consider moving from my fairly complicated workflow to typst?
If you're asking for other assignments, I'd actually recommend Quarto [1]. It's basically a streamlined version of your current workflow. The other benefit is that it can convert your markdown to Typst if you decide to switch over in the future.
Plus this doesn’t seem to compile down to latex so I also lose the engine. From experience, latex makes beautiful documents and choices which I’ll always prefer over ease of use.
More templates than LaTeX. I have made PDF presentations in LaTeX, which look good, but they all look the same. Some variety is good.
Unicode chars support. I prefer to type α instead of \alpha.
That's it, both things together will make a LaTeX killer for me.
This is not done by default by LaTeX, but if you can bear to \usepackage{unicode-math} then it's readily available. A life changer!
Regarding presentations, what do you mean exactly? There are a lot of weirdly different beamer themes. You can even put a single verbatim block inside each slide and you'll just have a "text mode" presentation, if that is your thing.
About the presentations: All beamer themes look similar to me.
Open PowerPoint template gallery to see how different the designs can really be!
Re-did my resume using one of their templates, and it’s much easier to maintain now.
I've been searching for a good solution for the past 15 years. Never been happy with the solutions, and my PDFs are always very ugly.
Wrapper class I wrote to handle it: <https://gist.github.com/tehbeard/a54a2c77b4b8bf1af26920ce7a7...>
I need to print big tables of data though, I remember hitting limits before when I've tried to pass too much as shell args.
I need to generate udemy-style certificates for a project I am working on. are there any guides on generating PDFs with typst?
Replacing TeX's abysmal macro expansion language with a reasonably normal programming language is one of the reasons you would use it. Look at the example on their GitHub to see how the language works in a document.
The "reasonably normal programming language" part is a turn-off for non-software-devs, and for software devs I'm not sure why I wouldn't generate LaTeX via something like jinja2, or directly create PDFs with reportlab.
You want inspiration for some strange table layouts? There are gazillion ready made; some graph? TiKz/PGF have gazillions of ready made examples... Want a programming language in the middle? Python, Lua etc can be embedded straight away.
So far I've seen few tentative to "replace or hide LaTeX", from the old DocBook to ConTeXt, no one succeed simply because of all the LaTeX already made and easy to import. Having alternatives, especially seen the actual "fragmented" development is nice, but honestly I doubt it can take off. Proprietary products are fast to wane in popularity if a serious competitor pops up because the users does not own them, FLOSS are much calmer since anyone can grab a piece and integrate ideas of someone else without the need to switch.
After using templating languages in Python, yes, I always want this when using LaTeX. And as of ~2 years ago when I last tried this, while sure, I could embed Python in the middle, the interface for interacting with LaTeX via the embedded Python was anemic enough to be not useful. Maybe something had changed in the last 2 years, but if so, it's not more mature.
Example: I wanted to have a daily meditation book, where \chapter{Title} would insert the dates in order with the title of the meditation, instead of chapter numbers, also inserting a table of contents entry with the dates. What I didn't want was to have to go through and change dates if I added a meditation in the middle, or swapped the order of meditations. I'm not picky, I would've been happy to use \section{Title} or \meditation{Title}, or script a solution.
What happened was I spent probably 6 hours of research and never found a solution integrated into LaTeX. I did eventually write a script in Python that naively parsed the chapter titles and changed them in-placed in the LaTeX code, but that meant I had to regenerate the dates as a separate task.
Note that this took me about 5 minutes to figure out with Typst's integrated scripting language.
Typst is not replacing LaTeX in general and should stop advertising being a LaTeX replacement. It isn't a competitor.