Install LaTeX from Scratch
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 && \ for a in *.ins; do latex $a; done && \ cd - && \ cp -vf $PACKAGE/*.{sty,def,cls} 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 acrotex movie15 datetime
To look for packages check here http://tug.ctan.org/search.html#byDescription. In the long run chances are that you will run into fundamental incompatibilities between old and new packages... in such case it maybe necessary to install from scratch.
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.
Some TeXinfo tools are not included in TeXLive anymore. It is used as a complement to TeX to generate manuals for other programs. To install TeXinfo:
cd ~/soft wget http://ftp.gnu.org/gnu/texinfo/texinfo-4.13a.tar.gz tar -xzvf texinfo-4.13a.tar.gz ./configure --prefix=$HOME/usr make install
Removing TeXLive
rm -rf ~/usr/local/texlive ~/usr/local/bin/*tex*
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.
Custom TeX settings (user space)
You can have your own TeX settings in
~/texmf/texmf.cnf
the file can be in any place as long as you set the variable
export TEXMFCNF=~/othertexmf:
The will take the place of /usr/share/texmf/web2c/texmf.cnf.
It allows us to reserve more memory for TeX. Some packages with intense graphics may require large memory settings. A typical configuration file looks like this
% file ~/texmf/texmf.cnf: % main_memory.hugetex = 20000000 main_memory = 230000000 % default: 1000000 % words of inimemory available; also applies to inimf&mp extra_mem_top = 10000000 % default: 0 % extra high memory for chars, tokens, etc. extra_mem_bot = 10000000 % default: 0 % extra low memory for boxes, glue, breakpoints, etc. save_size = 150000 % default: 5000 % for saving values outside current group stack_size = 150000 % default: 1500 % simultaneous input sources % pool_size = 1250000 % string_vacancies = 90000 % max_strings = 100000 % pool_free = 47500
Install Asymtote
Asymptote is the LaTeX of 2D and 3D graphics. It works by svn
mkdir ~/soft cd ~/soft svn co https://asymptote.svn.sourceforge.net/svnroot/asymptote/trunk asymptote cd asymptote/asymptote ./autogen.sh ./configure --prefix=$HOME/usr wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.1.tar.gz time make -j 8 make install
(2 minutes)
It requires autoheader (package GNU autoconf) and GNU TeXinfo