Skip to content

Instantly share code, notes, and snippets.

@kokx
Last active April 29, 2017 23:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kokx/fd218f5c17cf795d6b8b to your computer and use it in GitHub Desktop.
Save kokx/fd218f5c17cf795d6b8b to your computer and use it in GitHub Desktop.
LaTeX on Travis for Education
install:
- ./texlive-install.sh
- export PATH="$PATH:$HOME/texlive/bin/x86_64-linux"
- tlmgr install wrapfig
script:
- pdflatex file.tex

The Problem

On Travis for Education, Travis VM's do not have any support for LaTeX. And it is also not possible to use sudo on these VM's, so simply installing the right packages using apt-get is not going to work.

Obviously, it is ridiculous that Travis for Education is not supporting the full range of possibilities that Travis Pro has. However, complaining about it doesn't really help that much. Hence, I created a quick and dirty solution that solves this problem.

The (Hacky) Solution

Practically, the solution is to install TeX Live manually. In a directory that the normal travis user can always write to.

Unfortunately, texlive uses an installer, which takes some commands, or a profile. The profiles are relatively complicated to use for installation, and I wanted to get something working quickly, so I simply pipe the commands into the installer.

Explanation of commands in installer

d -- Go into directory edit
1 -- Edit the main directory
~/texlive -- set the main directory
r -- Return to the main menu
s -- Choose a scheme
c -- Choose the scheme 'c' (small scheme (basic + xetex, metapost, a few languages))
r -- Return to the main menu
i -- Start installation

Installing extra packages

Add tlmgr install <package1> <package2> as an installation command to your .travis.yml to install extra packages.

It could be very benificial for the build time to choose a very minimal scheme and to install only the packages that we really need.

Notes

One of the things that I found while testing, is that there definitely is some throttling going on while downloading packages. Sometimes the installation takes few minutes, but sometimes it takes about 30 minutes.

#!/bin/bash
# This file will install texlive in a travis worker that does not allow sudo.
# Hopefully this will become obsolete in the near future.
mkdir ~/texlive
cd ~/texlive
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar xf install-tl-unx.tar.gz
rm install-tl-unx.tar.gz
cd install-tl-*
echo "d
1
~/texlive
r
s
c
r
i
" | ./install-tl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment