Install LaTeX from Scratch: Difference between revisions
| (25 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
(written by Alfredo Correa, 2011) |
|||
These instructions are based on this [http://www.tug.org/texlive/quickinstall.html official TeXLive Quick Install guide] modified to have the TeX system installed in the user-space (home directory). |
These instructions are based on this [http://www.tug.org/texlive/quickinstall.html official TeXLive Quick Install guide] modified to have the TeX system installed in the user-space (home directory). |
||
=== Other options === |
|||
| ⚫ | |||
You have to have a very good reason to install LaTeX from scratch; |
|||
==== Use package manager ==== |
|||
If you can manage your system (for example Ubuntu linux in a desktop) you can complete your installation with packages boundles. (This still may not have the bleeding edge version of packages). The two extremes are |
|||
For a basic installation for writing articles for journals, you can do almost everything by installing |
|||
sudo apt-get install texlive-publishers texlive-fonts-extra |
|||
(this takes approximately 300MB and 10 minutes) |
|||
For a complete installation of the texlive associated with the current system (e.g. Ubuntu 11.04 -> TeXLive2009) |
|||
sudo apt-get install texlive-full |
|||
(warning: this takes 1800MB and ~1 hour of download) |
|||
Sometimes you can look for particular packages using the Synaptic cache, although the search may not give all the results. |
|||
$ apt-cache search attachfile |
|||
texlive-latex-extra - TeX Live: LaTeX supplementary packages |
|||
$ sudo apt-get install texlive-latex-extra |
|||
| ⚫ | |||
remember that you can install individual LaTeX packages by adding the files to the user space ~/texmf/tex/latex/packname/*.sty and running <code>texhash</code>. |
|||
PACKAGE=pdfcomment |
PACKAGE=pdfcomment |
||
mkdir -p ~/texmf |
mkdir -p ~/texmf |
||
cd ~/texmf |
cd ~/texmf |
||
wget http://mirror.ctan.org/macros/latex/contrib/$PACKAGE.zip |
wget http://mirror.ctan.org/macros/latex/contrib/$PACKAGE.zip |
||
unzip $PACKAGE.zip |
unzip $PACKAGE.zip |
||
mkdir -p tex/latex/$PACKAGE |
mkdir -p tex/latex/$PACKAGE |
||
cd $PACKAGE |
cd $PACKAGE |
||
for a in *.dtx; do if [ -a $a ]; then |
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 |
for a in *.ins; do if [ -a $a ]; then latex $a; fi; done |
||
cd - |
cd - |
||
cp -vf $PACKAGE/*.{sty,def,cls,cfg} tex/latex/$PACKAGE |
cp -vf $PACKAGE/*.{sty,def,cls,cfg} tex/latex/$PACKAGE |
||
#other installation commands may be necessary here |
#other installation commands may be necessary here |
||
| Line 36: | Line 59: | ||
cool |
cool |
||
coollist |
coollist |
||
coolstr |
|||
coolstr |
coolstr |
||
forloop |
forloop |
||
| Line 44: | Line 66: | ||
pdfmarginpar |
pdfmarginpar |
||
standalone |
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. |
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--. |
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. Some libraries (like PGF and PGFplots) provide TDS bundles in their respective sites, outside CTAN, for example at http://sourceforge.net/projects/pgf/ and http://sourceforge.net/projects/pgfplots/ |
|||
= Installation from Scratch = |
= Installation from Scratch = |
||
| Line 77: | Line 114: | ||
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 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 <code>~/usr/local/texlive/2009/bin/i386-linux/</code>.) |
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 <code>~/usr/local/texlive/2009/bin/i386-linux/</code>.) |
||
| Line 89: | Line 134: | ||
make install |
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 === |
|||
| ⚫ | |||
= Two TeX system coexisting = |
= Two TeX system coexisting = |
||
| Line 105: | Line 157: | ||
pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009) |
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. |
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) = |
= Custom TeX settings (user space) = |
||
| Line 141: | Line 197: | ||
cd asymptote/asymptote |
cd asymptote/asymptote |
||
./autogen.sh |
./autogen.sh |
||
./configure --prefix=$HOME/usr |
./configure --prefix=$HOME/usr --enable-offscreen |
||
wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.1.tar.gz |
wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.1.tar.gz |
||
time make -j 8 |
time make -j 8 |
||
| Line 149: | Line 205: | ||
It requires autoheader (package GNU autoconf) and GNU TeXinfo |
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 = |
|||
* http://tex.stackexchange.com/ |
|||
* http://www.linuxfromscratch.org/blfs/view/cvs/pst/texlive.html |
|||
Latest revision as of 20:04, 19 February 2012
(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).
Other options
You have to have a very good reason to install LaTeX from scratch;
Use package manager
If you can manage your system (for example Ubuntu linux in a desktop) you can complete your installation with packages boundles. (This still may not have the bleeding edge version of packages). The two extremes are
For a basic installation for writing articles for journals, you can do almost everything by installing
sudo apt-get install texlive-publishers texlive-fonts-extra
(this takes approximately 300MB and 10 minutes)
For a complete installation of the texlive associated with the current system (e.g. Ubuntu 11.04 -> TeXLive2009)
sudo apt-get install texlive-full
(warning: this takes 1800MB and ~1 hour of download)
Sometimes you can look for particular packages using the Synaptic cache, although the search may not give all the results.
$ apt-cache search attachfile texlive-latex-extra - TeX Live: LaTeX supplementary packages $ sudo apt-get install texlive-latex-extra
Install individual packages
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. Some libraries (like PGF and PGFplots) provide TDS bundles in their respective sites, outside CTAN, for example at http://sourceforge.net/projects/pgf/ and http://sourceforge.net/projects/pgfplots/
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/texmf* ~/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