LaTeX + snap

Is it feasible to package TeX Live 2022 as a snap given that it install many GB on the harddrive?

Thanks,

LRP

1 Like

I’d love to know that Too! I was thinking if this is posible.

Hmm. This does sound feasible depending on what the intended use case is. A good test might be to see how a snapped version of texlive plays with pandoc.

I was originally trying to use texlive as part of a snap package but having no luck due to conflicts with the deb texlive package and the gnome extension snap. It would be interesting to see if we could use TexLive as a build and standalone snap.

I’d love to collaborate on making this happen — even pay a modest bounty.

Here’re official TeX Live installation notes for Linux:

Linux:

  1. cd /tmp # working directory of your choice
  2. wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
  3. zcat install-tl-unx.tar.gz | tar xf -
  4. cd install-tl-*
  5. perl ./install-tl --no-interaction
  6. Finally, prepend /usr/local/texlive/YYYY/bin/PLATFORM to your PATH, e.g., /usr/local/texlive/2022/bin/x86_64-linux

Changing defaults:

  • The default paper size is a4. If you want the default to be letter, add --paper=letter to the install-tl command.
  • By default, everything is installed (7+GB).
  • To install a smaller scheme, pass --scheme=scheme to install-tl. For example, --scheme=small corresponds to the BasicTeX variant of MacTeX.
  • To omit installation of the documentation resp. source files for the packages, pass --no-doc-install --no-src-install to install-tl.- To change the main installation directories (rarely needed), add --texdir=/install/dir to the install-tl command. To change the location of the per-user directories (where TEXMFHOME and others will be found), specify --texuserdir=/your/dir.
  • To change anything and everything else, omit the --no-interaction. Then you are dropped into an interactive installation menu.
  • Many of these options were added to install-tl in June 2022. For earlier versions, just use the interactive menus. All the best,

LRP

1 Like

Hello again,

My use case is work-in-progress toward most efficient possible self-publishing workflow.

I’m writing several books for self-publishers but fear current TeX Live installation methods are too challenging for most of the self-publishers I know.

Apt is easy for Debian et. al. users, but keeping TeX Live up to date seems to be an issue. Plus, it doesn’t work for other Linux distributions nor MacOS.

Is my understanding that snap works across all major OS installations and automatically updates the application correct?

Best wishes to all,

LRP

1 Like

Yes! snaps will work on any major distribution. For the best experience, you should use one of the distros mentioned on the website, but it should work with any distro that can support snapd (the service used to manage snap packages).

Let me take a look at snapping texlive. Somebody already reserved the name, but if I can get somewhere I will probably file a dispute to claim the name for the Snapcrafters.

1 Like

Yes! Outstanding!

Please do keep me posted.

Thanks,

LRP

Hi Jason,

Some thoughts about naming:

The full TeX Live installation is more than 4 GB of LaTeX packages. To make this more manageable, TL provides “schemes,” e.g. smaller specialized collections of LaTeX packages. One can select a scheme by clicking a radio button midway through the install.

I’m interested in a snap that installs the book publishing scheme. So the name “texlive-bp” or similar qualification might work. This could be distinguished from “texlive-fi” for full install.

Best wishes,

LRP

1 Like

Good idea. I have a rough snapcraft.yaml file that successfully installs the full texlive distribution, but now I am trying to figure out how to correctly prime the components so that folks who install the snap can access them. override-build does the trick for running the perl installer:

# apps:
   # TODO: Define all the apps for texlive

parts:
  texlive:
    plugin: nil
    build-packages:
      - gzip
      - perl-base
      - wget
    override-build: |
      craftctl default
      wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
      zcat install-tl-unx.tar.gz | tar xf -
      rm install-tl-unx.tar.gz
      cd install-tl-*
      perl ./install-tl --no-interaction

Now I need to figure out how to what to put for the apps section of the snapcraft.yaml document.

1 Like

Wow! This is outstanding.

I’ll be setting up a Ubuntu system within the next few days. Looking forward to testing.

Many thanks,

LRP

Hi Jason,

Any more progress on the TeX Live snap?

Best,

Lloyd

Hi! I I volunteer for testing! I too think that TexLive in snap format would be great and naming with the schemas is a good idea, because a full install is too large, maybe even make the same for languages packages by region could be nice to have

Hi! quick update

Manage to make a snap that works with the basic scheme of TexLive. Tested in strict mode

My GitHub repo with the code

name: texlive-basic # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: testing for snapping texlive-basic schema # 79 char long summary
description: |
  testing snap for texlive-basic schema

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  texlive-small:
    # See 'snapcraft plugins'
    plugin: nil
    build-packages:
      - gzip
      - perl-base
      - wget
    override-build: |
      cd /tmp
      wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
      zcat install-tl-unx.tar.gz | tar xf -
      rm install-tl-unx.tar.gz
      cd install-tl-*
      perl ./install-tl --scheme=basic --texdir=$SNAPCRAFT_PART_INSTALL --no-interaction

After installing the snap you just need to PATH=/snap/texlive-basic/current/bin/x86_64-linux:$PATH; export PATH like in the documentation

I think this snap can work like another really good snap that I frequently use openjdk-snap by jgneff where the snap export to PATH the java installation

What do you think?

For me this way is much easier but there are some downsides:

  • Need frequent build since CTAN packages are constantly updated I think if you install the regular way install-tl downloads the updated packages.
  • Need to add the PATH to the snap folder
  • TEXMFHOME and TEXMFLOCAL I dont know where they are inside snap or can be mapped using SNAP_COMMON or SNAP_DATA or SNAP_USER_COMMON or SNAP_USER_DATA

Hi Edurojas,

Outstanding!

Selective scheme install is a definite plus.

I plan to bring up a new NUC next week. This will be a good opportunity to test.

Many many thanks for your work.

LRP

This is great! I should have something with the publishers collection later. I already have a snap repo set up (I get a 404 errors when I click on the link to your repository). I am thinking we can combine our snap build recipes in a single repo in the Snapcrafters organization that folks can reference. I will post the link to the repo later today!

Reason why I think this group repo will be beneficial is that you need to use a different texlive.profile if selecting a specific collection or build for a different arch. I have found that by default install-tl will only build for x86_64.

1 Like

Also, regarding TEXMFHOME and TEXMLOCAL, they should be mappable via the apps section. This will require manually specifying where the executables are, but it should be rather trivial.

Hi @nuccitheboss link fixed!

I’m not a snap expert (just a curious mind with machine learning experience). Maybe snap layouts are the way to implement the TEXMFHOME and TEXMLOCAL or it’s better with apps environment?

UPDATE: I updated my repo, as I say earlier, I like the implementation of openjdk snap, so I added a way to the snap to export the PATH I don’t know if this is a good idea btw

Layouts are more for pointing to configuration files located under /etc. Some programs have the location of their configuration files hardcoded in, so layouts are essentially for convincing the program that the path is still valid (even if the config file is located under $SNAP/current). There is an environment tag that you can use in the snapcraft.yaml file to set TEXMFHOME and TEXMLOCAL.

Even if the apps are added in, you can still use the openjdk implementation that you are referring to. Having the apps just prevents needing users to modify their environment on their Linux machine.

Here’s my spin on the texlive snap, but with the publishers collection specifically. It should be working in strict confinement, I just need some testers. I specified all the CLI utilities as apps, and I set TEXMFLOCAL and TEXMFHOME within the snap.

@edurojas --texdir ended up being the missing piece. I was wondering how to get the executables to stage correctly, so thanks for sharing your experimentation. You can check out my branch here: https://github.com/NucciTheBoss/texlive.

I am planning on publishing the package tomorrow (along with requests for aliases) along with my full scheme package version on the Snap Store, so if you wanted to submit a pull request with your basic scheme version to my repo, I can publish that package as well. My plan is that after the public testing period, I will transfer the packages to the Snapcrafters organization on GitHub.

Hi Jason,

Terrific!

I really look forward to testing and using this snap. I’ll be configuring a NUC later this week or next, so we’ll have a good testbed.

I’m currently working on a typesetting how-to book for self-publishers. This snap promises to greatly simplify the getting started chapter. I’ll definitely give you credit in the book.

Very much appreciate your work.

Lloyd