Switching to a TUG TeXLive Distribution

March 12, 2021, 5:52 p.m.

The TeX Users Group provides a comprehensive TeX system called TeX Live from which Linux distributions build their own system for inclusion in their package repositories. For some time I have noticed some bugs that have caused minor breakage in a long and complex document I have been preparing each time one of the distributions I use regularly updates their distribution. In one case (openSUSE Tumbleweed) it became unusable. The Linux distribution which had the most stable and reliable TeX Live native distribution, and the one I switched to when the other distributions had a problem on the part of the document I was working on the time also had a major problem after an update, I decided to install the TeX Live distribution from TUG. This article describes one of the installation methods of the latest stable release of TeX Live from TUG.

Introduction

I had considered using the TUG's distribution of TeX Live in the past, but the non-ideal experience I had with MikTeX on Windows compared with the simplicity of using a Linux distribution's package manager dissuaded me. I also had the impression that installing the TUG's TeX Live would be more complicated than it turned out to be. When an Arch update finally broke the last completely working TeX Live installation I had of all the installations on all distributions on my G5, I decided to go ahead and uninstall the distributions' version of TeX Live available from their repos and switch to the TeX Live from TUG, installed from the TeX Live ISO image, as opposed to the other installation methods.

This was a good decision, and one I recommend other TeX/LaTeX users consider using. TUG provides a well tested and stable yearly release whose components can be updated, if desired, using a TeX Live management tool included with the installation. It seems Linux distributions base their inclusions in their repositories on these updated components which, unlike the yearly release, are not thoroughly tested, leading to the instabilities and bugs I experienced. Installing this version on all the distributions I use will give me, in addition to stability, a consistent experience on all the distributions I use.

There installation media are available:

Net Installer
The Net installer is an image that includes the installer and associated scripts and other components for the installation but none of the actual programs and resources included in TeX Live. This version of the installer will download the latest updated versions -- not the stable versions included in the yearly release -- of the necessary TeX Live components for the installation. It can be downloaded from a Comprehensive TeX Archive Network (CTAN) mirror that is automatically determined to be the closest by CTAN, a manually chosen CTAN mirror.
Acquiring the Net Installer
Several images can be downloaded, but the recommended one for Linux/Unix systems is install-unx.tar.gz found in the mirror in the subdirectory /systems/texlive/tlnet. Executing install-tl, contained in the downloaded and extracted image, will start the net installer.
TeX Collection DVD
The TeX Collection DVD includes TeX Live, as well as additional collections of applications specifically for macOS and Windows, and a snapshot of the Comprehensive TeX Archive Network (CTAN) repository. This DVD is provided to TUG members as part of their membership.
TeX Live ISO
The TeX Live ISO is like the net installer but all of the TeX Live components are included in the image, so nothing needs to be downloaded during installation. The ISO can be downloaded from a Comprehensive TeX Archive Network (CTAN) mirror that is automatically determined to be the closest by CTAN, a manually chosen CTAN mirror, or from a torrent network.
A Listing of a Mirror Subdirectory that Contains the Available ISOs
The above image shows the index of the available ISO images from one of the mirrors.

I chose the ISO based installation method because:

  • the TeX Live contained in the ISO image is the yearly stable release, and no the latest version, which is not as thoroughly tested
  • after downloading the large image once, it can be repeatedly used to install TeX Live on all of the distributions on my multi-boot system

Install Prerequisites

The installer is a Perl script, so it needs to be installed on the system. Most distributions include it by default. To use the available GUI mode, Tcl and its extension Tk (Tcl/Tk) are required. As I write this on Manjaro, I had already installed TeX Live on Arch, openSUSE Tumbleweed, Kubuntu, and Fedora, but I don't remember if they were already installed, by default or through some other prior package installation. On Manjaro Tcl/Tk is made available by installing the packages tcl andtk, of which tcl was already installed.

Some installer GUI related options, namely the expert, wizard, and perltk options (entered as -gui=expert, -gui=wizard, and -gui=perltk) require the Perl::Tk Perl module. such as advanced advanced and Perl, which is usually installed by Linux distributions. But it requires Perl modules that may not be installed by default in some distributions. If the installer is used in graphical mode, Tcl/TK is required, Perl::Tk for advanced options in GUI installer. In my prior installations I didn't use any of these options, so I don't know if this is generally installed by default. On Manjaro however, it happened to not be installed (which makes sense since Tk wasn't already installed. Installing the package perl-tk makes it available.

The prerequisites are summarized below:

  • Perl, because the installer is a Perl script. This should already be installed on most distributions.
  • Tcl and Tk for the installer's GUI capability
  • Perl::Tk module for some GUI mode options

Installation Preparation

Download ISO

I chose the ISO medium for installation instead of the net installer. The ISO image as well as the files necessary for verifying the authenticity of the image are in the mirror subdirectory at /systems/texlive/Images/ with the obvious extensions. There are two sets of these files, one set named with only the release year, and the other set named with the release year and an appended full date. I downloaded texlive2020.iso.

Prepare System

Before executing the installer, some minor tasks are necessary.

  1. Remove the existing TeX Live installation[1] installed from the Linux distribution's system package manager.
  2. Install the necessary prerequisites.
  3. Create a directory to mount the ISO. /mnt is typically used for this. Create it (or another directory) if it doesn't already exist.
    sudo mkdir -p /mnt
  4. Mount the ISO at the above directory. Don't forget to change the paths as necessary to reflect your system.
    sudo mount -t iso9660 -o ro,loop,noauto /home/brook/DataEXT4/SoftwareDownloads/texlive/texlive2020.iso /mnt
  5. A Listing of the Contents of the Mounted ISO

Installation

Perform the following steps to start the installer.

  1. Change to the mount directory.
    16:53:14 ⏚ [brook@G5-MANJARO:/mnt] $ cd /mnt
  2. Issue the command that starts the installer in GUI mode. For a system with a properly configured sudo [2], this is
    16:53:14 ⏚ [brook@G5-MANJARO:/mnt] 19h48m55s $ sudo perl install-tl -gui
    Because this is executed with root privileges, the installation will be in a path writable by root , by default to /usr/local/texlive/2020 for this release. It is possible to install multiple versions of Tex Live by changing the final directory in the path. For example, when the 2021 version of the stable TeX Live is released it can be installed alongside the 2020 version at /usr/local/texlive/2021. Issuing the command as a regular user, or without using sudo will install it to the user's home directory. I chose the former.

After invoking the command to start the installer with sudo, the splash window shown in the first image in the following set of screenshots is presented very briefly before the screen of the second image is presented. The installer is only one screen with various installation settings displayed, with buttons that can be clicked to change values in a modal window. The details of some of the settings and modals are listed below.

The TUG TeX Live Installation with the GUI Installer

Click on any of the thumbnails to view a slideshow of the images.
Image 2
The first screen after the splash is a minimal window that allows the initiation of the installation process when the Install button is pressed using default settings, with only the default paper size setting to be changed. Activating the Advanced button causes the installer window to change to that shown in Image 3 which makes possible the modification of the default installation settings.
Image 3
Even this screen only shows a subset of all of the modifiable settings. Activating the More button expands the window to that shown in Image 4 so that all installation settings are shown.
Note the "Create symlinks in standard directories" option is unselected. In Image 9 the modal that appears when this option is activated and the Specify directories button is activated.
Image 4
This image shows the expanded installer window with all options shown.
Image 5
Image 5 shows the modal window for changing the path of local additions to TeX Live when the corresponding Change button for the setting is activated. Here I changed the path from /usr/local/texlive/texmf-local to /usr/local/texlive/2020/texmf-local.
Image 6
Image 6 shows the modal for selecting schemes when pressing the Change button corresponding to the scheme to be installed. Schemes are a way to group the TeX Live components to be installed into a named group. By default the full scheme is selected, which will install every TeX Live component. This may be undesirable and results in wasted storage, but it is a way to ensure that a needed package is not missing at some point in the future when preparing a document .
Image 7
I chose a custom scheme, which will display the modal shown here, permitting a more granular choice of groups of components than with the schemes. This modal is also shown when activating the Customize button.
Image 8
Image 8 shows the same modal as the previous image, but with the window expanded by dragging the edge to show all possible collections of TeX Live packages. All collections are selected. I unselected the components that I did not need.
Image 9
This image shows the modal when the Specify directories is chosen. This modal refers to the paths of symlinks that are created to objects in the installation directory when the radio button "Create symlinks in standard directories" is activated (See description of Image 3.)
Dolphin Showing a Filtered View of /usr/local/bin
The directory shown is /usr/local/bin filtered for "luatex". The modal shows the properties of /usr/local/bin, including that it is a symlink that points to /usr/local/texlive/2020/bin/luatex.
The defaults for executable objects, man pages, and info pages are shown. For example, if the defaults are kept, which I chose to do, one of the symlinks is /usr/local/bin/luatex which points to /usr/local/texlive/2020/bin/x86_64-linux/luatex.

Most settings that are shown in the installer refer to the TeX Directory Structure. If not adding any TeX/LaTeX components or LaTeX styles and classes from other sources, it does not need to be investigated. However, if adding these, it is preferable to refer to the The TeX Live Guide—2020, or for more detail, the TeX Directory Structure documentation available as a PDF.

Manually Installing LaTeX Packages

Although the TeXLive distribution is very comprehensive in the packages it includes, there may be a situation where a needed package may not be available in the distribution; or if it is included in the distribution, the version of the package may be problematic. For these situations, it is possible to manually install the package in a path generated by the TeXLive installer just for such manual installations, namely /usr/local/texlive/texmf-local. In our case we modified this path for maual TeX package installations (see Image 5, above) to /usr/local/texlive/2020/texmf-local in order to be able to install multiple versions of TeXLive.

One such package, available at the GitHub repository Holzhaus/latex-rail, is the modernized version of the Rail package for LaTeX which works with a companion c program -- the executable of which is also called rail -- to generate syntax diagrams in the LaTeX document. The c program must be compiled locally and the executable, its associated resources, such as the man page, and the LaTeX package installed manually. A Makefile distributed with latex-rail makes these tasks simple. All that is required is to ensure the compilation requirements are met, and to edit the Makefile to specify the location of the TeXLive installation.

Installing Prerequisites

The README file specifies that " lex and yacc (or compatible programs such as flex and bison) and a C compiler" are required. The requirement for lex can typically be satisfied by installing a package named flex on many distributions. The yacc requirement can be satisfied by a package named byacc. GCC which includes a c compiler should already be installed on most distributions. Before continuing, be sure to install these packages.

Modifying the Makefile for Our TeXLive Installation

The Makefile sets some variables to make the compilation of the program, and the installaiton of the program and the LaTeX package simple. The variables are displayed in the following listing, which shows the variables before editing to make it compatible with our installation of TeXLive.


PREFIX = /usr/local
DESTDIR =

BINDIR=$(PREFIX)/bin
TEXDIR=$(PREFIX)/texlive/texmf-local/tex/latex/rail
MANDIR=$(PREFIX)/share/man

MANSUFFIX=l

Since TeXLive was installed under /usr/local, the value of PREFIX does not have to be modified. None of the other variable values that depend on PREFIX have to be modified either, except the value of TEXDIR. The TEXDIR variable defines the root path of locally installed TeX packages under the main root installation path. Since we modified the main installation path from the default

/usr/local/texlive

to

/usr/local/texlive/2020

we must change the value of TEXDIR from

TEXDIR=$(PREFIXi)/texlive/texmf-local/tex/latex/rail

to

TEXDIR=$(PREFIXi)/texlive/2020/texmf-local/tex/latex/rail

After making the above edit to the Makefile, all that is necessary the is to change directory to the directory to which the distributed files were cloned and to run make as an unprivileged user and make install with elevated privileges. This is shown in the following image.

Compiling the rail Program and LaTeX Package Manually

Conclusion

The TeX Live distribution from the TUG provides an stable alternative to TeX Live as distributed by distributions which may include components that are not as thoroughly tested as those in the yearly TUG release. The installer is easy to use, and after installing as above requires no further configuration.

Installing the distribution form the TUG also allows the installation of multiple yearly releases on the system. As mentioned above, when the 2021 version of the yearly release becomes available, it can be installed to /usr/local/texlive/2021 alongside the 2020 version installed to /usr/local/texlive/2020. This multi-version installation will only require an adjustment of the user's $PATH.

The installation of TeX Live as described here also installs TeX Live Manager, which has a CLI and GUI interface, shown below.

The tlmgr GUI Interface.
Installing TeX Live as above also installs TeX Live Manager, which has a CLI and GUI interface.

It allows users to view information on the installed components, as well as install new components and update existing components. It must be used with care to not introduce instability to the installed packages. For example, without modifying the source of TeX Live components used by the tool, installing new packages may install current versions instead of those that are part of the yearly release.

References

Notes:

  1. [1]

    It may be interesting to some that removing the packages that comprise the existing TeX Live installation with one command in Arch Based distributions required the esoteric command

    sudo pacman -Rncs $(pacman -Qsq texlive)
    .
    16:23:40 ⏚ [brook@G5-MANJARO:~] 1 $ sudo pacman -Rncs $(pacman -Qsq texlive)
    checking dependencies...
    :: ghostscript optionally requires texlive-core: needed for dvipdf
    :: inkscape optionally requires texlive-core: latex formulas
    
    Package (18)          Old Version   Net Change  
    
    kile                  2.9.93-2        -20.91 MiB
    libsigsegv            2.12-2           -0.03 MiB
    libsynctex            2020.54586-6     -0.14 MiB
    t1lib                 5.1.2-8          -1.17 MiB
    texmaker              5.0.4-1         -36.66 MiB
    texlive-bibtexextra   2020.55376-1    -24.42 MiB
    texlive-bin           2020.54586-6    -64.40 MiB
    texlive-core          2020.55416-1   -411.62 MiB
    texlive-fontsextra    2020.55407-1  -1324.82 MiB
    texlive-formatsextra  2020.54498-1     -3.18 MiB
    texlive-games         2020.55271-1     -3.31 MiB
    texlive-humanities    2020.55389-1     -1.99 MiB
    texlive-latexextra    2020.55418-1    -53.05 MiB
    texlive-music         2020.54758-2    -36.09 MiB
    texlive-pictures      2020.55342-1    -23.32 MiB
    texlive-pstricks      2020.55289-1    -39.11 MiB
    texlive-publishers    2020.55415-1    -58.44 MiB
    texlive-science       2020.55390-1    -13.69 MiB
    
    Total Removed Size:  2116.35 MiB
    
    :: Do you want to remove these packages? [Y/n] 

  2. ↩ Return to text.
  3. [2]

    On openSUSE Tumbleweed it was necessary to switch to root first before running the installer because of the following error

    19:10:31 [brook@G5-openSUSE:/mnt] $ perl install-tl -gui
    19:15:24 θ65° [brook@G5-openSUSE:/mnt] 3m4s $ sudo !!
    sudo perl install-tl -gui
    application-specific initialization failed: no display name and no $DISPLAY environment variable
    Error in startup script: no display name and no $DISPLAY environment variable
        while executing
    "load /usr/lib64/libtk8.6.so Tk"
        ("package ifneeded Tk 8.6.10" script)
        invoked from within
    "package require Tk"
        (file "./tlpkg/installer/install-tl-gui.tcl" line 33)

    Executing the command after switching to the root user with the - option, the command executed successfully.

    19:17:13 θ66° [brook@G5-openSUSE:/mnt] 5s $ su - root
    Password: 
    G5-openSUSE:~ # cd /mnt
    G5-openSUSE:/mnt # perl install-tl -gui

  4. ↩ Return to text.