Install native texlive in parallel to repo version

Disclaimer: I have found a solution and it seems to work well.

Update: I can now confirm that the procedure below works as well with Texlive 2015.

In general it looks like working with parallel installations is easier than expected. To setup the native version I did the following:

  • Download the net installer, and extract it in a temporary location (the net installer is an interactive command line tool, allowing to modify various settings during setup).

  • Run the installer portable mode, i.e., install-tl -portable. This will bring up the main menu of the installer.

  • In this setting menu, I simply changed the TEXDIR (by pressing D) to a path within my home, e.g., ~/bin/texlive. This automatically changes the other TEXDIR* as well. I did not change anything else (installation scheme was set to scheme-full). Overall, the installation with the net installer is very convenient.

Inspired by the documentation section "Environment variables for Unix" I created a file setenv.sh in the installation directory with the following content:

dir=`cd \`dirname $0\` && pwd`
export PATH="$dir/bin/x86_64-linux:$PATH"
export MANPATH="$dir/texmf-dist/doc/man:$MANPATH"
export INFOPATH="$dir/texmf-dist/doc/info:$INFOPATH"

In order to switch to the new texlive distribution I simply source this file. So far, it looks like everything is working well with both the existing and the new texlive distribution.

It looks like Kpathsea is the tool in texlive which is responsible for locating the different parts/directories of the distribution (Kpathsea path searching). I wrote the following script to check whether switching to the new distribution really changes all those TEXMF* directories:

echo "which kpsexpand: `which kpsexpand`"
echo "TEXMFDIST:       `kpsexpand '$TEXMFDIST'`"
echo "TEXMFLOCAL:      `kpsexpand '$TEXMFLOCAL'`"
echo "TEXMFHOME:       `kpsexpand '$TEXMFHOME'`"
echo "TEXMFCONFIG:     `kpsexpand '$TEXMFCONFIG'`"
echo "TEXMFSYSCONFIG:  `kpsexpand '$TEXMFSYSCONFIG'`"
echo "TEXMFVAR:        `kpsexpand '$TEXMFVAR'`"
echo "TEXMFSYSVAR:     `kpsexpand '$TEXMFSYSVAR'`"
echo "TEXMFCACHE:      `kpsexpand '$TEXMFCACHE'`"

Running this without sourcing my setenv.sh file gives the following output:

which kpsexpand: /usr/bin/kpsexpand
TEXMFDIST:       /usr/share/texmf-texlive
TEXMFLOCAL:      /usr/local/share/texmf
TEXMFHOME:       /home/bluenote/texmf
TEXMFCONFIG:     /home/bluenote/.texmf-config
TEXMFSYSCONFIG:  /etc/texmf
TEXMFVAR:        /home/bluenote/.texmf-var
TEXMFSYSVAR:     /var/lib/texmf
TEXMFCACHE:      $TEXMFCACHE

This shows that the standard texlive from the Ubuntu repositories is in use. After sourcing, the output becomes:

which kpsexpand: /home/bluenote/bin/texlive/2013/bin/x86_64-linux/kpsexpand
TEXMFDIST:       /home/bluenote/bin/texlive/2013/texmf-dist
TEXMFLOCAL:      /home/bluenote/bin/texlive/2013/../texmf-local
TEXMFHOME:       /home/bluenote/bin/texlive/2013/../texmf-local
TEXMFCONFIG:     /home/bluenote/bin/texlive/2013/texmf-config
TEXMFSYSCONFIG:  /home/bluenote/bin/texlive/2013/texmf-config
TEXMFVAR:        /home/bluenote/bin/texlive/2013/texmf-var
TEXMFSYSVAR:     /home/bluenote/bin/texlive/2013/texmf-var
TEXMFCACHE:      /home/bluenote/bin/texlive/2013/texmf-var:/home/bluenote/bin/texlive/2013/texmf-var

I don't fully understand why using a different binary causes all these "tex variables" to change as well. I was expecting that the binary has no information that it is part of a different distribution, but fortunately it has! Note that these "tex variables" are no unix-like environment variables (that's why it is important to use single quotes when passing them to kpsexpand). I'm a bit surprised that I did not have to modify any of them via export -- in fact, they are all undefined. But so far everything seems to be working.