Install LaTeX from Scratch: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
Line 120: Line 120:
and search for missing packages.
and search for missing packages.


=== Removing TeXLive ===
=== Removing this local installation of TeXLive ===


rm -rf ~/usr/local/texlive ~/usr/local/bin/*tex*
rm -rf ~/usr/local/texlive ~/usr/local/bin/*tex* ~/bin/epstopdf ~/bin/kpse* ~/bin/*tex* ~/bin/tlmgr


= Two TeX system coexisting =
= Two TeX system coexisting =

Revision as of 21:12, 3 October 2011

(written by Alfredo Correa, 2011)

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 *.dtx; do if [ -a $a ]; then latex $a; fi; done
for a in *.ins; do if [ -a $a ]; then latex $a; fi; done
cd - 
cp -vf $PACKAGE/*.{sty,def,cls,cfg} tex/latex/$PACKAGE
#other installation commands may be necessary 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 (use PACKAGE = ...)

xkeyval
oberdiek
pgf
pgfplots
acrotex
movie15
datetime
filecontents
changepage
paralist
textcase
placeins
cool
coollist
coolstr
forloop
bbm
type1cm
lastpage
pdfmarginpar
standalone
preview
attachfile

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.

Font packages, -- e.g. bbold--, can be installed in this way also but they are in a different ctan directory. -- e.g. http://mirror.ctan.org/fonts/bbold.zip --.

TeX Directory Structure (TDS)

A later addition to repositories is the TDS system that consists in providing compressed zip files that can be readily decompressed in the local ~/texmf directory. Individual packages can be downloaded from http://www.ctan.org/tex-archive/install/macros/latex/contrib/ and unpacked. For example:

PACKAGE=oberdiek
mkdir -p ~/texmf
cd ~/texmf
wget http://www.ctan.org/tex-archive/install/macros/latex/contrib/$PACKAGE.tds.zip
unzip $PACKAGE.tds.zip
texhash

Unfortunately only a subsets of all the packages are provided in this way.

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).

Non-interactively you can download a ready made File:Installation.profile.txt

wget http://micro.stanford.edu/mediawiki/images/4/4a/Installation.profile.txt -o installation.profile
./install-tl --profile installation.profile

If the connection drops and fails, you can continue by:

yes | ./install-tl --profile installation.profile

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

Completing/Updating packages

To add missing packages (e.g. that the default --not full-- installation left over) you can run

tlmgr -gui

and search for missing packages.

Removing this local installation of TeXLive

rm -rf ~/usr/local/texlive ~/usr/local/bin/*tex* ~/bin/epstopdf ~/bin/kpse* ~/bin/*tex* ~/bin/tlmgr

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. For example if you use bash you can add the following to your ~/.bashrc file

export PATH=${HOME}/usr/local/bin:${HOME}/usr/bin:${PATH}

This will priorize the local (home) installation when calling "pdflatex".

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 --enable-offscreen
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

Ubuntu

Ubuntu 11.04 provides asymptote v2.02

sudo apt-get install asymptote

For the latest version (e.g. v2.13) add the repository (https://launchpad.net/~callegar/+archive/asymptote)

deb http://ppa.launchpad.net/callegar/asymptote/ubuntu natty main

Other Resourses