| July 15, 2010 11:20 pm

Many Linux distributions package the most common LaTeX classes and utilities and then make them available through their repositories.  When you install programs such as LyX or Kile, these packages are downloaded and installed at the same time.

This is tremendously convenient.  It means that most of the software you would ever use is a simple apt-get away; and, under most circumstances, it’s a good idea to use the software available from your distribution repositories.  The package maintainers and other behind-the-scenes people make sure that the available versions are both secure and stable.

Sometimes, however, it can be advantageous to have both the “stable” LaTeX distribution and a “custom” LaTeX distribution installed side by side.  As one example of when this might be useful, consider the following: up until the most recent version of Ubuntu (version 10.04, Lucid Lynx), the only LaTeX distribution available through the package system was TeXLive 2007 (which had actually been released at the end of 2006), which was three years out of date.

During that time, the TeXLive developers had been very hard at work.  Thousands of bugs were resolved, new document classes were introduced, and (best of all) TeXLive added a package manager – which meant that you could add new packages without needing to manually download and install them.  Taken together, this meant that there were some very compelling reasons to use a newer version of TeXLive.

To simply replace TeXLive was possible, but could be difficult and time consuming.   Moreover, it caused problems with package dependencies and could break things.  There is nothing worse than trying to troubleshoot and fix a broken LaTeX solution.  The much better solution was to install only a few core utilities (thereby satisfying the package requirements of LyX, Kile and other tools) and then installing the newer version alongside the old.

This article will explain how you can do that.  It will show you how to manually install a LaTeX distribution and demonstrate how to configure the necessary variables so that the system will use it instead of the older version.

There are three four steps to manually installing a LaTeX distribution:

  1. Download the most recent version of TeXLive from the project homepage.
  2. Run either the command line or GUI installer.
  3. Configure the BASH profile variables so that your “system environment” points to the newly installed LaTeX files rather than to the system files.
  4. (Optional) Modify the folder being used for your texmf tree.

Step 1: Download TexLive

The most recent version of TeXLive can always be found from the project homepage, or from their download page.  Simply choose the version of the installer you would like to use, either the “full” version (which is a very large download), or the “net” installer (which is not).

Step 2: Run the Installer Program

Once you’ve finished downloading the installer program, you will need to extract it and then run it from the command line.   To do this, open up a “Terminal” window and change to your downloads directory:

cd /path/to/download/directory

Then, extract the installation script and go into the expanded directory:

tar -xf install-tl-unx.tar.gz
cd install-tl

Finally, run either the command line or GUI version of the installer.   It’s usually best to run the GUI version, but to do this, you may need to install the perl-tk package.  This can be done by typing:

sudo apt-get install perl-tk

To run the installer, type:

./install-tl –gui wizard

This will launch a wizard that will step you through each of the five steps involved in installing TeXLIve.  These include specifying where you would like to install TeXLive and choosing which programs/document classes you would like to include.  Be sure to make a note of the installation folder.  It will be important in the next step.

Note: Unless you already know which packages you need, I would recommend installing everything.


When ready, press the “Next” button in order to start the installation.

Note: Because a full installation of TeXLive can be quite large, it may take some time to fully download and install.

Step 3: Configure BASH Profile

Once the installation finishes, the final step is to configure your bash .profile so that it points to the newly installed version of TeXLive rather than the system version.  The .profile file is located under you home directory (though it is hidden by default) and includes several important variable definitions that are needed for your system to work correctly.  (Which means that you should be careful when changing things.)

In order for Linux to recognize the version of TeXLive you just installed, we need to edit the values of four variables.  These are PATH, MANPATH, INFOPATH, and TEXINPUTS.  These four variables tell your computer where to look for software, manual pages, and other important system files.  They are composed of a list of folders separated by colons (:).  Because we don’t want to break anything, we will simply add the folder where you installed TeXLive to the front of that list so that it gets searched first.

Here’s what you need to add to .profile:

export PATH=”/path/to/texlive/bin/:$PATH”
export MANPATH=”/path/to/texlive/texmf/doc/man:$MANPATH”
export INFOPATH=”/path/to/texlive/texmf/doc/info:$INFOPATH”
export TEXINPUTS=”/path/to/texlive/2009//:”

You can add it anywhere in the file, but it’s probably best to add it near the end.  On my system (where I installed TeXLIve to /home/roakes/AppData/TexLive-2009), the configuration information looks like this:

export PATH=”/home/roakes/AppData/TexLive-2009/bin/:$PATH”
export MANPATH=”/home/roakes/AppData/TexLive-2009/texmf/doc/man:$MANPATH”
export INFOPATH=”/home/roakes/AppData/TexLive-2009/texmf/doc/info:$INFOPATH”
export TEXINPUTS=”/home/roakes/AppData/TexLive-2009//:”

And that’s it.  Once you’ve added this information, you simply need to log-out and then log back in for it to take effect.

Step 4: Configure the Local texmf Folder (Optional)

Optionally, you might also want to configure the local texmf folder (where you can install your own LaTeX document classes and styles) to point at something other than the default value (/home/user/texmf).  (Personally, I’m a bit neurotic about what goes in my home folder and I dislike having it there.)

To modify the location of the local texmf folder, add one additional variable to .profile, TEXMFLOCAL.

export TEXMFLOCAL=”/path/to/folder”

I like to keep application configuration information in a folder called AppData.  For this reason, I would add this text to my .profile:

export TEXMFLOCAL=”/home/roakes/AppData/texmf-local”


No Responses to “Installing a Custom LaTeX Distribution Alongside TeXLive 2009 (Ubuntu)”

Care to comment?