ANN: Tectonic.jl - a wrapper for tectonic

Tectonic.jl: this is a small wrapper package for tectonic. It is currently being registered in General.

From the tectonic project description:

A modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive.

10 Likes

A) let me help you out here https://github.com/MichaelHatherly/Tectonic.jl :wink:
B) Can you provide an example of a workflow that might include this? I’m definitely open to an easy and painless way to handle LaTeX installations, but still a bit confused how Julia would fit in.

Hmm, GR plotting needs LaTeX for some things - I’m not sure if it can use tectonic, but if so, then this package would be quite helpful.

CC @jheinen

Woops, thanks! :smiley:

Definitely won’t fit everybody’s workflows, mostly since they’re not planning to following the usual commandline interface used by the usual TeX engines as far as I know. What it does provide is a relatively tiny initial install size compared to a full distribution since it’ll download and cache files that it actually uses when you start compiling things. Additionally, it’ll recompile automatically as many times as needed to provide a finished document. It’s true that both of those things are possible using tlmgr and Latexmk, but this approach is the simplest way I’ve found to get up and running compiling tex files directly from Julia.

2 Likes

This is really exciting, thanks for working on this.

So I see that you are downloading the executables as artifacts at install time. I take it that this will actually download the style files at runtime?Is it completely automated, or is there a package manager type invocation to install the style files prior to document build. For example, would this be capable of automatically converting a documenter build to PDF? Will the download happen from CTAN?

The Tectonic Typesetting System — The Tectonic Typesetting System probably does a better job explaining how it works that I do. From my experience so far any style files are runtime downloads and get cached in a user directory, this happens when you compile a .tex file, there’s no “manager” visible, it gets done automatically. I guess you could force it to download styles at install by triggering a build of some .tex file.

Here’s a log from travis today of a Tectonic.jl run: Travis CI - Test and Deploy with Confidence. Scroll down and you’ll see an example of what happens on the first run of tectonic.

Probably, not tried yet though.

Apparently from https://dataverse.org/ according to their website.

1 Like

In the meantime, GR can render LaTeX formulas without a TeX distribution, e.g.

using GR
using LaTeXStrings

selntran(0)

settextfontprec(232, 3)
settextalign(2, 3)
chh = 0.036

for phi in LinRange(0, 2pi, 360)
    clearws()
    setcharheight(chh)
    setcharup(sin(phi), cos(phi))
    mathtex(0.5, 0.5, L"- \frac{{\hbar ^2}}{{2m}}\frac{{\partial ^2 \psi (x,t)}}{{\partial x^2 }} + U(x)\psi (x,t) = i\hbar \frac{{\partial \psi (x,t)}}{{\partial t}}")
    updatews()
end

Also much faster than using dvipng:

% time julia math.jl   
julia math.jl  1.96s user 1.10s system 83% cpu 3.654 total 
2 Likes

Oh, nice! Will that also work when GR is called via Plots? How do I tell it not to use LaTeX, is that this selntran(0)?

Similar Plots example:

using Plots
using LaTeXStrings
annotate!(0.5, 0.5, L"- \frac{{\hbar ^2}}{{2m}}\frac{{\partial ^2 \psi (x,t)}}{{\partial x^2 }} + U(x)\psi (x,t) = i\hbar \frac{{\partial \psi (x,t)}}{{\partial t}}")

Does not require a local TeX installation.

Oh, great, thanks! I had issues with Plots complaining about a missing LaTeX in the past (had a “\theta” on a plot axis), but I guess that’s history now?

tectonic wouldn’t have helped us here either - it’s not an API but a standalone tool. Therefore we implemented a “minimal” LaTeX engine in C and integrated it into GR.

:+1: :+1: :+1:

Exactly, definitely not a “minimal” engine in that sense. Though I believe one of their goals is being able to embed within other programs, so maybe one day.

Version 0.5.0 of the package has been tagged, which, unsurprisingly, bundles the tectonic 0.5.0 release. Of significant note in this release of tectonic is the long-awaited inclusion of shell-escape support.

4 Likes