dockerfiles icon indicating copy to clipboard operation
dockerfiles copied to clipboard

Tectonic

Open blaggacao opened this issue 5 years ago • 6 comments

Ever since it has been included as pandoc tex rendering engine, it might be desirable to implement a tectonic pandoc dockerfile variant. Lukily enough, there is a quite recent alpine package.

I haven't tried tectonic, yet, but some of it's choice promise less pain down the road. I'm copying:

  • automatically downloads support files
  • completely reproducible document compiles
  • doesn’t write TeX’s intermediate files (speed!!!)
  • modern OpenType fonts and is fully Unicode-enabled (xetex)
  • completely self-contained library
  • developed in the open in rust

blaggacao avatar May 07 '20 08:05 blaggacao

Eureka: https://github.com/vinay0410/tectonic-docker !

blaggacao avatar May 07 '20 08:05 blaggacao

Cool! I haven't seen tectonic before, it looks very interesting.

So I think, we would inherit from the tectonic image rather than base Alpine. Does that make sense?

We need to make some design decisions e.g. Ubuntu image, so incorporation of tectonic should be done in consideration (should be possible, but may have different structure e.g., base image is Ubuntu).

Do we need to worry about people using both TeX and tectonic?

svenevs avatar May 07 '20 09:05 svenevs

So I think, we would inherit from the tectonic image rather than base Alpine. Does that make sense?

I think, and since there is ans alpine package compiled, it might be simpler to just apk add tectonic and do some pandoc specific cache seeding. It should be a dead simple image. If we shall need a more updated build, doing so with a builder image is also straight forward, but above all, transparent.

Re ubuntu If debian, then a debian-x-slim image to reduce size. Is muslibc really such a pain?!?

Do we need to worry about people using both TeX and tectonic?

Good quesion. Textonic Typesetting seems to be a (pronouncable) xetex flavour. But I'm not sure if it's designed to be a drop in replacement (it doesn't explicitly guarantee that). I guess this depends mostly on the choices pandoc itself has made in his defalut.latex - and if that does influence. But in sight of the people that reportedly build and support tectonic, I'd argue that, eventually and gradually (and hopefully), the ecosystem moght converge to tectonic.

blaggacao avatar May 07 '20 15:05 blaggacao

Just wanted to give you a quick update, @tarleb and I are going to jump on a call soon and map out what needs to happen where (we're kind of cross-stalled), we'll establish the most appropriate way to handle tectonic. It may just end up in the core image, specifically because it's a comparatively small install size (in contrast to e.g., #60). This would also make it so that it's available in the TeX image as well, by default, though it does seem that's not really a big concern.

In the meantime, would you be willing to take a look at the existing tests and try and flesh out if we can just reuse those with a new writer or if we need to add new ones? (I'm most concerned about bibliography / reference stuff with tectonic, we want to make sure that works!).

For development convenience (avoid rebuilding all of pandoc),

  1. Create a child image from core

    ARG base_tag="latest"
    # NOTE: depending on results, we may actually need pandoc/latex:${base_tag}
    FROM pandoc/core:${base_tag}
    RUN apk add tectonic
    
  2. Add an alpine-tectonic target somewhere around this one

    https://github.com/pandoc/dockerfiles/blob/ff2f4e3f850501657b324868b1f0b81fefa97551/Makefile#L34

    Something like (assuming you put that in {root}/alpine/tectonic folder and file named Dockerfile

    alpine-tectonic:
    	docker build \
        --tag pandoc/tectonic:$(PANDOC_VERSION) \
        --build-arg base_tag=$(PANDOC_VERSION) \
        -f $(makefile_dir)/alpine/tectonic/Dockerfile $(makefile_dir)
    
  3. Add a test target, compare existing test targets (note the magic IMAGE setting per-target).

The development is basically PANDOC_VERSION=X make alpine-tectonic followed by PANDOC_VERSION=X make test-alpine-tectonic. So with infrastructure in place, e.g., PANDOC_VERSION=latest make alpine-tectonic.

If it is easier for you, you can open a PR! But there will likely be some significant infrastructure changes as a result of our planning conversation, so don't worry too much about it being "perfect", more just an exploratory experiment on getting the testing side for tectonic up to speed, we'd be very grateful for the help! :heart:

Selfishly, I hope that tectonic emerges as the victor in the ongoing tex splintering hehe. It seems super convenient.

If debian, then a debian-x-slim image to reduce size. Is muslibc really such a pain?!?

Yes, it really is. Primarily because of general lack of support by things that work fine with glibc. On the ubuntu side, we will target a core LTS release. The ubuntu image will be less focused on size, but more for general ease and convenience -- the image is generally larger, but widespread use makes it much less error prone for certain disciplines (thinking of R, data science stuffs, etc) :slightly_smiling_face:

svenevs avatar May 15 '20 19:05 svenevs

I've put a note on a paper in front of my desk.

blaggacao avatar May 16 '20 18:05 blaggacao

As discussed with @tarleb on Twitter: There is this great GitHub action to set up the latest tectonic version with caching and biber https://github.com/WtfJoke/setup-tectonic. This might be a good starting point to create a custom pandoc-tectonic image. Let me know if I can support you.

maehr avatar Jan 10 '22 20:01 maehr