
Tectonic: a modernized, self-contained TeX/LaTeX engine - JoshTriplett
https://users.rust-lang.org/t/tectonic-a-complete-modernized-self-contained-tex-latex-engine/11053
======
santaclaus
> Has a command-line program that is quiet

But what about my overfull hboxes???

~~~
bert_
Thanks for the morning chuckle. Never thought I'd see an hbox joke :)

~~~
Toenex
I, for one, have always preferred all of my `figs` at the end of the document
anyway. ;)

~~~
santaclaus
That, my friend, is badness 10000.

------
mhd
If this wraps 120k lines of actual TeX backbones, why write the API layer in
Rust at all? Yet another dependency, just to be buzzword compliant?

We've come a long way since the original literate TeX program.

~~~
jonchang
I think the eventual goal is to rewrite the backend in Rust, and to make that
available as a library to other applications.

~~~
dom0
I'm not sure that's feasible.. there are exactly zero independent TeX or TeX-
like implementations, everything is patches on top of TeX, which probably has
a reason (given the general open source community's inclination to rewrite
things). I am by no means an expert on TeX internals, but just cursory
browsing of the code makes it look like a rather _massive_ and complex piece
of software.

~~~
pkgwilliams
The C/C++ code add up to about 120,000 lines.

Yes, it is massive and complex.

Fortunately, the core engine is essentially self-contained. Almost all of the
things that make the TeX frustrating come from the UX, or the difficulty of
adding new capabilities that call for somewhat more modern C code. By
compiling all of the C with a Rust wrapper, we get a single binary out in the
end, _plus_ the ability to extend the engine in ways that were just not
feasible before.

Revamping the core engine code from C to Rust would be nice, because it could
be cleaner and more comprehensible, but it actually doesn't buy you anything
in terms of the UX.

 __Edit: __also, I didn 't realize this when I made the decision to fork
XeTeX, but LuaTeX has shifted to a C implementation that is more or less
detached from the original WEB code.

------
cossatot
'Official' website here [0].

This looks great, although I do wonder to what degree the automated
downloading of dependencies limits off-line work. I'm not sure how widespread
this is, but one of my biggest productivity hacks is writing with the wifi
turned off (I go for pencil and paper for first drafts if possible, but
editing, figures and references all require the computer).

[0]: [https://tectonic-typesetting.github.io/en-US/](https://tectonic-
typesetting.github.io/en-US/)

~~~
chrismorgan
> I am exactly of this philosophy so Tectonic is very careful NOT to require
> ANY network access for builds if all of the needed resource files have been
> cached locally. And because the I/O backends are pluggable, you can download
> the "bundle" file containing the install tree and point Tectonic to use it
> for fully network-free operation.

— The author
([https://www.reddit.com/r/rust/comments/6e2x6m/tectonic_a_com...](https://www.reddit.com/r/rust/comments/6e2x6m/tectonic_a_complete_modernized_selfcontained/))

~~~
cossatot
Thanks.

------
jahewson
It's hard to talk about a "TeX" engine when there is eTeX, XeTeX, and LuaTeX
each with their own strengths and weaknesses heading in different directions.
FWIW it seems to me that LuaTeX is actually the most promising of the three,
not because of Lua but because of its extensibility.

~~~
tnecniv
Why would I use one instead of the other? I use LaTeX often, but normally let
my IDE autodetect and deal with all that stuff on its own.

~~~
mkl
LaTeX generates DVI files, which need an extra conversion step to be generally
useful. PDFTeX generates PDFs directly, and is generally preferable (unless
you need legacy Postscript stuff).

XeTeX and LuaTeX deal with Unicode properly and can use normal fonts. Both of
these output PDF files directly, like PDFTeX, but have the above advantages
over it (+more). LuaTeX, as the name suggests, embeds a Lua interpreter which
enables far more sophisticated and performant programmatical things (at the
cost of compatibility). XeTeX can cope with legacy Postscript things like
PSTricks (ick!) by generating the Postscript and automatically converting it,
but that's a slow process, and I often rewrite PSTricks pictures in TikZ or
Asymptote when I have to deal with them.

I generally use XeTeX, or LuaTeX when I'm okay with sacrificing compatibility
for programmability.

~~~
majewsky
Is PSTricks only a compatibility concern, or are people still doing new stuff
in it? I can sort of imagine it... TeX packages are usually not the primary
concern of the document author, so they will keep using what they learned 20
years ago.

When I wrote my diploma thesis in 2010, I was given the thesis template that
the whole working group were using. It was a steaming pile of hacks that had
accumulated over the years, with the recommended compilation method being
latex -> dvips -> ps2pdf, and only using graphics in EPS format (IIRC). And
people were still writing `\"{a}` instead of `ä`. I replaced it with a new
template for use with pdflatex that took advantage of such new-fangled stuff
as inputenc, cmap, pdfx and hyperref, and committed it together with a long
rant of a README that started with something along the lines of "When I looked
on my watch, it was the fucking 21st century."

~~~
mkl
Unfortunately, people are still using PSTricks for new stuff! I work with
teaching materials at a university, and some of the people who wrote it first
learned LaTeX in the 1980s, and haven't kept up with the three decades of
improvements since. The obsolete hoop-jumping is kind of amazing, and I've
been getting really good at complicated regex find and replace.

------
IIAOPSW
I just use overleaf. gets work done, easy to work with collaborators, does the
package install thing automatically, real time preview of what your write, has
dumb-person "rich text" mode etc.

Only downside is its cloud based so I can't be productive on an airplane.

[https://www.overleaf.com/](https://www.overleaf.com/)

~~~
majewsky
> real time preview of what you write

When I need that with a LaTeX document, I have vim with the TeX sources open
on one half on the screen, and mupdf showing the compiled PDF on the other
half, and a terminal in the background is running

    
    
      while inotifywait *.tex *.bib; do
        sleep 0.2
        pdflatex main && killall -HUP mupdf
      done
    

The sleep ensures that vim is finished writing the file before pdflatex runs.
pdflatex is sometimes substituted for make or latexmk or whatever. SIGHUP
makes mupdf reload the PDF. (If you're using e.g. Okular, it will pick up the
changed PDF automatically, so that step can be skipped.)

(My intention is not to belittle cloud solutions, although maybe a little. :)
Just to show how you can implement the real-time-preview feature with a very
small shell script.)

~~~
ConfucianNardin
You can use

    
    
        inotifywait -e move_self,close_write *.tex *.bib
    

and drop the sleep. This also means you will not needlessly recompile the pdf
if you re-open the source file in your editor.

Side note: Only one of move_self and close_write is actually required,
depending on your editor. Some editors (e.g. vim, emacs), will write the
modified content to a separate file, then rename it to the real file name (in
order to make it atomic) => move_self. Others will overwrite the file in-place
(e.g. gedit, nano) => close_write.

------
tuananh
Maybe use another name
[https://coreos.com/tectonic/](https://coreos.com/tectonic/)

~~~
webo
CoreOS Tectonic is not trademarked and is not unique.

Looks like OP's project started around November. I believe that's around when
CoreOS Tectonic was released as well.

~~~
chrismorgan
As discussed elsewhere in the thread, Tectonic _is_ actually trademarked by
CoreOS.

------
petters
> powered by XeTeX

Does XeTeX support microtype these days? It is important if you want "best-in-
the-world output" to PDF.

~~~
kiriakasis
If i read correctly it does not say "powered by XeTeX" but "derived by a XeTeX
Implementation"

~~~
pkgwilliams
Right.

The hope is that the easier development process will make it easier to add
fancy features like microtypography ... but for me the real prize is HTML
output that doesn't suck, so that's going to be the focus of my work.

------
chj
Sounds like a rewrite, but it's just a wrapper.

~~~
steveklabnik
It is currently a wrapper as the first stage of an incremental re-write.

------
SEJeff
This is a terrible idea as Tectonic as a software product already exists:
[https://tectonic.com](https://tectonic.com)

It is a registered "computer software" trademark as well:

[http://tmsearch.uspto.gov/bin/showfield?f=doc&state=4805:npp...](http://tmsearch.uspto.gov/bin/showfield?f=doc&state=4805:nppxvg.2.11)

~~~
samstokes
"Terrible idea" is a rather aggressive way to dismiss hours of someone's work
because you don't like the name.

~~~
SEJeff
Incorrect, the name is fine. The name is also a legally registered trademark
of a company with a commercial business around said name. I'm unsure of how
well you know/understand US Trademark law, but the gist is that you lose a
trademark that you don't defend.

This means that the name should be changed voluntarily or CoreOS will be
obligated to ask them to change it.

    
    
        Word Mark	TECTONIC
        Goods and Services	IC 009. US 021 023 026 036 038. G & S: Computer software, namely, software for developing, managing, updating, and maintaining online server instances and clusters hosted by third parties; computer operating system software; computer operating system software for distributed systems. FIRST USE: 20150406. FIRST USE IN COMMERCE: 20150406
        IC 038. US 100 101 104. G & S: Providing access to hosted computer operating systems and computer applications through the Internet; Peer-to- peer network computer services, namely, electronic transmission of audio, video and other data and documents among computers. FIRST USE: 20150406. FIRST USE IN COMMERCE: 20150406
        Standard Characters Claimed	
        Mark Drawing Code	(4) STANDARD CHARACTER MARK
        Serial Number	86560796
        Filing Date	March 11, 2015
        Current Basis	1A
        Original Filing Basis	1B
        Published for Opposition	December 22, 2015
        Registration Number	5013800
        Registration Date	August 2, 2016
        Owner	(REGISTRANT) CoreOS, Inc. CORPORATION DELAWARE 3043 Mission Stret San Francisco CALIFORNIA 94110
        Attorney of Record	Brian R. Coleman
        Type of Mark	TRADEMARK. SERVICE MARK
        Register	PRINCIPAL
        Live/Dead Indicator	LIVE
    

Courtesy of [http://tmsearch.uspto.gov](http://tmsearch.uspto.gov) TESS search
for Serial 86560796

------
domoritz
So it's like latexmk + lazy downloading? How does it compare against latexmk?

~~~
pkgwilliams
I can't speak for latexmk, but Tectonic has, if I may say so myself, some
quite sophisticated logic for managing reruns and figuring out which
intermediate files can't be written to disk.

That being said, I wouldn't say that the `latexmk`-type functionality is the
thing that is going to make Tectonic unique. Hopefully that will be the HTML
output, but I have to implement that first ...

------
Norfair
Come on, you could have called it TeXtonic, what a missed opportunity for a
pun.

~~~
chrismorgan
[https://tectonic-typesetting.github.io/en-US/](https://tectonic-
typesetting.github.io/en-US/) declares in the section “About the name” that
this is entirely deliberate. I like the rationale and agree with it too:

> The name of the project is “Tectonic,” spelled and pronounced like a regular
> word because it is one. Enough with the cutesy obscurantism. In cases where
> the name might lead to ambiguities, it should be expanded to “Tectonic
> typesetting.”

> If you’re feeling expansive, you can interpret the name as suggesting a
> large change in the TeX world. Or you can think of it as suggesting a
> salubrious offering for weary TeX users. Either way, the root of the word
> does go back to the ancient Greek τέκτων, ”carpenter,” which Donald Knuth —
> the creator of TeX and a devout Christian — might appreciate.

------
RolandBuendia
I failed to see what these three bullet items really bring to the table.

\- Downloads resource files from the internet on-the-fly, preventing the need
for a massive install tree of TeX files

\- Automatically and intelligently loops TeX and BibTeX to produce finished
documents repeatably

\- Has a command-line program that is quiet and never stops to ask for input

My understanding is that both MikTex for Windows, as well as Texlive for
Linux, allow users to install packages on the fly. To compile a file with
BibTex, a user just needs to run TeX twice. And finally, TeX will only ask for
a user input if there is an error.

------
deepnotderp
I'd love to see something akin to "Weebly for LaTeX". Maybe I'm just too much
of a theoretical noob, but I don't quite enjoy feeling like I'm writing code
when trying to write english.

~~~
relyks
Isn't Overleaf [1] or ShareLaTeX [2] kind of already like that?

[1]: [https://www.overleaf.com/](https://www.overleaf.com/)

[2]: [https://www.sharelatex.com/](https://www.sharelatex.com/)

------
rmbeard
It failed to process the first two files I tested it on. I really like the
idea but that is not a great start. Being able to switch between TeX engines
would be a good option, would be great if you you could do that with CL
switch.

------
mrkgnao
This might end up being the Rust "killer app"! (Servo aside, of course.)

~~~
criddell
Is TeX still a big deal? I used it (and LaTeX) for all of my school work 25
years ago but I don't think I've touched it since then. Even back then, most
people were using word processing software to create their documents.

Can a variant of an already somewhat fringe piece of software really become a
killer app?

~~~
chriswarbo
TeX is certainly still a big deal, and is not at all fringe. That's my
experience from academic Physics and Computer Science. I've heard that
different disciplines vary in this regard (e.g. humanities may use more word
processing, possibly because they don't need TeX to typeset math).

Anecdotally: when giving a presentation last week, the event organiser was
surprised that my slides were HTML (from pandoc; I'm an ex-Web dev), as she'd
never seen such a thing. Everyone else used beamer (TeX slideshow package).

~~~
criddell
That may be true, but the world of academic Physics and Computer Science
people is still a relatively small one.

Anecdotally: in the 20+ years I've been out of school I've sat through
hundreds of presentations. I don't think any of them were created with TeX
(unless TeX is the underlying technology of PowerPoint, Keynote, Prezi,
Impress, etc...).

~~~
pkgwilliams
TeX used to have numerous unique features: fairly good fonts; automatic
hyphenation, which makes it feasible to lay out text with full justification;
support for non-English Latin characters, etc. The rest of the world has
caught up with these.

IMO the ways in which it is still special are: (1) good math typography; (2)
integration with automated bibliography systems; (3) easily generatable by
other tools. (Lots of things that eventually turn into HTML hit #3, but not
lots of things that eventually turn into really good-looking PDFs do.)

These points certainly aren't important in all cases ... but for what it's
worth, arxiv.org hosts more than a million scientific papers, the vast
majority of which are written in TeX.

------
wolfi1
why does it use xdvipdfmx? xetex would output pdf as well, doesn't it?

~~~
pkgwilliams
XeTeX accomplishes PDF output by piping through xdvipdfmx in the background,
so it's the same process.

------
rmbeard
Given the name issues, why not change the name to rustex?

