When I was writing a report for students about LaTeX typesetting system that I was asked to write, I realized that it looks like a huge and clumsy monster to beginners.
LaTeX is a typesetting system based on TeX. LaTeX consists of many packages that create high-level markup language. It is popular in scientific and academic circles. It tries to separate a content and a presentation of documents (WYSIWYM paradigm) and provides powerful system for writing large writings with complex cross-referencing, figures, bibliographies, etc. Many scientific journals accept manuscripts in LaTeX format.
There are problems among these advantages. Every package in LaTeX has its own way to write same things, i.e. LaTeX lacks consistency and uniformity.
For example, there are many ways to create tables:
tabular (default one),
tabular* (if you want to control width),
tabularx (which adds new classifier X, where you cannot just merge columns),
tabu (like tabularx, but abandoned),
array and booktabs (if you want “professional look” table),
longtable (oh, you just wanted table across several pages?)… I think this list is infinite, there isn’t the one perfect table solution.
Each of these packages has unique syntax,
every time you need to mix declarative (\textbf{text}) with imperative style (\Large text \normalsize).
To sum up, there are many yaks to shave: you will spend a lot of time on recompiling big C++ project your paper and on finding
that hyperref package should be loaded earlier than cleveref.
You can read about other problems of LaTeX here: “Is LaTeX worth it?”.
So, Martin Haug and Laurenz Mädje have become tired and started development of Typst in 2019. Let me show you the beauty.
Example document
= My new paper
Some words. Lorem ipsum.
== Oh, this is a section
I will calculate $sin x$ using Taylor series.
Then,
$
sin x approx sum_0^n (-1)^k dot (x^(2k+1))/(2k+1)! ,
$
but,
$
sin x = sum_0^infinity (-1)^k dot (x^(2k+1))/(2k+1)!
$
We can calculate this using recursive functions.
#let taylorDepth = 10
#let sinTaylor(x, k: 0) = {
if k < taylorDepth {
calc.pow(-1, k) * (calc.pow(x, 2*k+1)) / calc.fact(2*k + 1) + sinTaylor(x, k: k + 1)
} else { 0 }
}
#v(20pt)
#let coords = range(0, 20).map(x => calc.pi * x / 10).map(x => (x, sinTaylor(x)))
#figure(
curve(..coords.map(x => curve.line(x.map(y => y * 10pt)))),
caption: [My own sin function plot]
) <sinplot>
This is a table that shows values that created @sinplot.
#table(
columns: 2,
table.header[x][$sin x$],
..for (x,y) in coords {
(str(x), str(y))
}
)
=== Subsection
- one
- two
- sublist
+ some other item
+ auto numbering
+ nice
+ Привет! 你好 مرحبًا
+ Unicode works out of the box!In the example above, you can see the main features:
- Clear Markdown inspired markup
- Clear mathematics typesetting
- Unicode support
- Easy references without
??signs, no double compilation required - Unified functional style interface
- Easy to code, not just Turing-complete
My computer compiled this document immediately unlike smaller TeX.
% time typst compile example.typ
typst compile example.typ 0.27s user 0.12s system 87% cpu 0.444 total
I know it’s a terrible benchmark. Just believe, the preview of the file updates instantly on each keystroke.
Typst is evolving at a great speed. I think, Typst may replace LaTeX for most writers in a couple of years. Maybe, we should stop advising students to use LaTeX for writing essays and diploma works?