Install LaTeX from Scratch: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
Line 14: Line 14:
if [ -f $PACKAGE.ins ]; then latex $PACKAGE.ins; fi && \
if [ -f $PACKAGE.ins ]; then latex $PACKAGE.ins; fi && \
cd - && \
cd - && \
cp -f $PACKAGE/*.{sty,def,cls} tex/latex/$PACKAGE && \
cp -vf $PACKAGE/*.{sty,def,cls} tex/latex/$PACKAGE && \
#other installation commands may be necesary here
#other installation commands may be necesary here
texhash
texhash

Revision as of 22:24, 20 September 2010

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 && \
if [ -f $PACKAGE.ins ]; then latex $PACKAGE.ins; fi && \
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
tufte-latex

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.

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=~/texmf:

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)