Install LaTeX from Scratch

From Micro and Nano Mechanics Group
Jump to navigation Jump to search

These instructions are based on this official TeXLive Quick Install guide modified to have the TeX system installed in the user-space (home directory).

Think Twice (install individual packages)

You have to have a very good reason to install LaTeX from scratch; remember that you can install individual LaTeX packages by adding the files to the user space ~/texmf/tex/latex/packname/*.sty and running texhash.

PACKAGE=pdfcomment
mkdir -p ~/texmf && \
cd ~/texmf && \
wget http://mirror.ctan.org/macros/latex/contrib/$PACKAGE.zip && \
unzip $PACKAGE.zip && \
mkdir -p tex/latex/$PACKAGE && \
cd $PACKAGE && \
cp $PACKAGE/*.sty tex/latex/$PACKAGE && \
#other installation commands may  be necesary here 
texhash

Unexpected dependencies: as you install new packages you will realize that some new packages has dependencies on system installed packages but since they are outdate they will not work. In that case you need to have the manual installation of a newer version of that package.

In particular you may need to update or install

xkeyval
oberdiek
pgf
pgfplots

To look for packages check here http://tug.ctan.org/search.html#byDescription

Installation from Scratch

This method installs the TeXLive LaTeX implementation from the Internet. First download the installer from any CTAN (Comprehensive TeX Archive Network) repository and decompress it. For example,

mkdir ~/soft
cd ~/soft
rm -rf install-tl*
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -zxvf install-tl-unx.tar.gz
cd install-tl-*

The installation will be performed in the user directory

mkdir -p ~/usr

More specifically, the main installation will be located at /usr/local/texlive.

The run the installer

./install-tl

Interactively, it is important to

  • set the installation directory to ~/usr/local/texlive (instead of /usr/local/texlive)
  • set 'letter' as the default paper size (unless you use A4 like in the rest of the civilized world).
  • set 'medium' installation size (600MB), this will include most packages associated with pdfLaTeX (and not for example associated with ConTeXt)
  • optionally, indicate that symlinks to the tex tools should be created in ~/usr/local/bin.

After confirming the options the installation will proceed to download and install around 2000 standard packages (including for example beamer, tikz, revtex, etc, etc, etc, etc).

After that, we have to add the tex tools (for example pdflatex, latex, bibtex) to the PATH. If the links were created in ~/usr/local/bin then that is the directory that should be in the PATH (if not yet). (The real executable files are located in ~/usr/local/texlive/2009/bin/i386-linux/.) The PATH can be set in the .bashrc file for example.

Two TeX system coexisting

Two different TeX systems/installations can coexists. We can force to use one or the other by specifying the full path. For example, in my system I have two versions, the system-wide one (old)

$ /usr/bin/pdflatex -v
pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4)

and the personal (new) one:

$ ~/usr/local/bin/pdflatex -v
pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009)

Which version is used by default depends on how the environment variable PATH is defined.