Notes on TeX Live setup: Difference between revisions

From STMDocs
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:
This page describes steps to install [http://tug.org/texlive TeX Live] (TL from now) and needed tweaks so that other kpathsea programs that are not part of TL can also use TL data. This is useful if we recompile some program from sources and want it to be able to find TL data. For example, one might want to recompile pdftex with some patch, and use it instead of the binary coming with TL.
This page describes steps to install [http://tug.org/texlive TeX Live] (TL from now) and needed tweaks so that other kpathsea programs that are not part of TL can also use TL data. This is useful if we recompile some program from sources and want it to be able to find TL data. For example, one might want to recompile pdftex with some patch, and use it instead of the binary coming with TL.


This guide was written for Ubuntu linux 8.01 and should work with no or little change for other Linux/UNIX systems.
This guide was written for TL2008 on Ubuntu linux 8.01 and should work with no or little change for other Linux/UNIX systems.  


==Prerequisites==
When in doubt, please refer to the [http://www.tug.org/texlive/doc/texlive-en/texlive-en.html official TeX Live documentation]. This guide serves as a quick guide for some very specific purposes:
* root access
* install TL with minimal effort
* enough disk space (~5GB)
* use TL data with non-TL binaries
* basic command-line skills


== Install TL ==
== Install TL ==
Line 19: Line 18:
* mount the TL image:
* mount the TL image:
<geshi lang="bash">
<geshi lang="bash">
sudo mkdir -p /mnt/texlive2008
mkdir -p /mnt/texlive2008
sudo mount -t iso 9660 -o loop /opt/iso-images/texlive2008.iso /mnt/texlive2008/
mount -t iso 9660 -o loop /opt/iso-images/texlive2008.iso /mnt/texlive2008/
</geshi>
</geshi>
* run the TL installer:
* run the TL installer:
<geshi lang="bash">
<geshi lang="bash">
sudo perl /mnt/texlive2008/install-tl
perl /mnt/texlive2008/install-tl
</geshi>
</geshi>
* when the menu is up, choose '''<V> set up for running from DVD''' by entering '''v<Enter>'''
* in next menu, change the destination of installation to '''/opt/texlive/2008''' by entering:
* in next menu, change the destination of installation to '''/opt/texlive/2008''' by entering:
<pre>
<pre>
Line 36: Line 34:
* start the installation process by entering '''i<Enter>'''. When the installation process is done, the last messages should like this:
* start the installation process by entering '''i<Enter>'''. When the installation process is done, the last messages should like this:
<pre>
<pre>
  ...
  pre-generating all format files (fmtutil-sys --all), be patient...done


  See  
  See  
   /mnt/texlive2008/index.html  
   /opt/texlive/2008/index.html  
  for links to documentation.  The TeX Live web site (http://tug.org/texlive/)  
  for links to documentation.  The TeX Live web site (http://tug.org/texlive/)  
  contains any updates and corrections.
  contains any updates and corrections.
Line 47: Line 45:
  list of groups is available on the web at http://tug.org/usergroups.html.
  list of groups is available on the web at http://tug.org/usergroups.html.


  Add /mnt/texlive2008/texmf/doc/man to MANPATH.
  Add /opt/texlive/2008/texmf/doc/man to MANPATH.
  Add /mnt/texlive2008/texmf/doc/info to INFOPATH.
  Add /opt/texlive/2008/texmf/doc/info to INFOPATH.
  Set TEXMFCNF to /opt/texlive/2008/texmf-var/web2c.
  Most importantly, add /opt/texlive/2008/bin/i386-linux
Most importantly, add /mnt/texlive2008/bin/i386-linux
  to your PATH for current and future sessions.
  to your PATH for current and future sessions.


Line 58: Line 55:
Logfile: /opt/texlive/2008/install-tl.log
Logfile: /opt/texlive/2008/install-tl.log
</pre>
</pre>
* make a copy of the main TL configuration file:
<geshi lang="bash">
cp /opt/texlive/2008/texmf/web2c/texmf.cnf /opt/texlive/2008/texmf-var/web2c/
</geshi>
* change some environment variables permanently by adding to '''/etc/profile''' the following lines:
* change some environment variables permanently by adding to '''/etc/profile''' the following lines:
<geshi lang="bash">
<geshi lang="bash">
Line 64: Line 65:
MANPATH=/mnt/texlive2008/texmf/doc/man:$MANPATH
MANPATH=/mnt/texlive2008/texmf/doc/man:$MANPATH
INFOPATH=/mnt/texlive2008/texmf/doc/info:$INFOPATH
INFOPATH=/mnt/texlive2008/texmf/doc/info:$INFOPATH
PATH=/mnt/texlive2008/bin/i386-linux:$PATH
PATH=/opt/texlive/2008/bin/i386-linux:$PATH
export TEXMFCNF MANPATH INFOPATH PATH
export TEXMFCNF MANPATH INFOPATH PATH
</geshi>
</geshi>
Line 70: Line 71:
<geshi lang="bash">
<geshi lang="bash">
exec bash -login
exec bash -login
</geshi>
* ensure that the new configuration file can be searched:
<geshi lang="bash">
texhash /opt/texlive/2008/texmf-var/
</geshi>
</geshi>
* test the installation:
* test the installation:
<geshi lang="bash">
<geshi lang="bash">
cd /tmp
pdflatex sample2e
pdflatex sample2e
</geshi>
</geshi>
* if things go well, we should get the below log:
* if things go well, we should get a log similar to the below:
<pre>
<pre>
$ pdflatex sample2e
$ pdflatex sample2e
Line 84: Line 88:
(/mnt/texlive2008/texmf-dist/tex/latex/base/sample2e.tex
(/mnt/texlive2008/texmf-dist/tex/latex/base/sample2e.tex
LaTeX2e <2005/12/01>
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
.
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
.
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
.
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.
(/mnt/texlive2008/texmf-dist/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/mnt/texlive2008/texmf-dist/tex/latex/base/size10.clo))
No file sample2e.aux.
(/mnt/texlive2008/texmf-dist/tex/latex/base/omscmr.fd) [1{/opt/texlive/2008/tex
mf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] (./sample2e.aux) )</mnt/tex
live2008/texmf-dist/fonts/type1/bluesky/cm/cmbx12.pfb></mnt/texlive2008/texmf-d
ist/fonts/type1/bluesky/cm/cmex10.pfb></mnt/texlive2008/texmf-dist/fonts/type1/
bluesky/cm/cmmi10.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmmi7
.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr10.pfb></mnt/texliv
e2008/texmf-dist/fonts/type1/bluesky/cm/cmr12.pfb></mnt/texlive2008/texmf-dist/
fonts/type1/bluesky/cm/cmr17.pfb></mnt/texlive2008/texmf-dist/fonts/type1/blues
ky/cm/cmr6.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr7.pfb></m
nt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr8.pfb></mnt/texlive2008/tex
mf-dist/fonts/type1/bluesky/cm/cmsy10.pfb></mnt/texlive2008/texmf-dist/fonts/ty
pe1/bluesky/cm/cmsy7.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cm
ti10.pfb>
Output written on sample2e.pdf (3 pages, 69560 bytes).
Output written on sample2e.pdf (3 pages, 69560 bytes).
Transcript written on sample2e.log.
Transcript written on sample2e.log.
Line 117: Line 99:
<geshi lang="bash">
<geshi lang="bash">
cd /opt/texlive/2008/texmf-var/web2c
cd /opt/texlive/2008/texmf-var/web2c
sudo cp texmf.cnf texmf.cnf.orig
cp texmf.cnf texmf.cnf.orig
sudo sed -i -e 's:.SELFAUTOPARENT:/mnt/texlive2008:' texmf.cnf  
sed -i -e 's:.SELFAUTOPARENT:/mnt/texlive2008:' texmf.cnf  
</geshi>
</geshi>


Line 124: Line 106:
Suppose we have tetex previously installed to '''/opt/tetex-3.0'''. The tetex texmf tree is then located at '''/opt/tetex-3.0/share/texmf'''. To add this texmf tree to our setup, we do this:
Suppose we have tetex previously installed to '''/opt/tetex-3.0'''. The tetex texmf tree is then located at '''/opt/tetex-3.0/share/texmf'''. To add this texmf tree to our setup, we do this:
<geshi lang="bash">
<geshi lang="bash">
sudo ln -s /opt/tetex-3.0/share/texmf /opt/texlive/texmf-tetex
ln -s /opt/tetex-3.0/share/texmf /opt/texlive/texmf-tetex
sudo sed -i '
sed -i '
/^TEXMFLOCAL/ a\
/^TEXMFLOCAL/ a\
TEXMFTETEX = /opt/texlive/texmf-tetex
TEXMFTETEX = /opt/texlive/texmf-tetex
s/^TEXMF = .*TEXMFLOCAL/&,!!$TEXMFTETEX/
s/^TEXMF = .*TEXMFLOCAL/&,!!$TEXMFTETEX/
s/^TEXMFDBS = .*TEXMFLOCAL/&;!!$TEXMFTETEX/
s/^TEXMFDBS = .*TEXMFLOCAL/&,!!$TEXMFTETEX/
s/^SYSTEXMF = .*TEXMFLOCAL/&;$TEXMFTETEX/
s/^SYSTEXMF = .*TEXMFLOCAL/&;$TEXMFTETEX/
' /opt/texlive/2008/texmf-var/web2c/texmf.cnf
' /opt/texlive/2008/texmf-var/web2c/texmf.cnf
Line 139: Line 121:
* adjust the above commands accordingly.
* adjust the above commands accordingly.


The order of the texmf trees given in '''TEXMF''' is important: earlier trees take predecence over later ones in '''TEXMF'''. Edit '''texmf.cnf''' manually to change the order if needed.
Some notes on the relevant variables above:
* '''TEXMF''': specifies whhich texmf trees are searched, and in which order. The order of the texmf trees given in '''TEXMF''' is important: earlier trees take predecence over later ones in '''TEXMF'''. Edit '''texmf.cnf''' manually to change the order if needed.
* '''TEXMFDBS''': contains list of texmf trees with '''ls-R''' filename databases. Running '''texhash''' without arguments will re-generating '''ls-R''' for texmf trees listed in '''TEXMFDBS'''. It's OK to have ls-R in a tree not listed in TEXMFDBS; it will be used, but will not be updated by running '''texhash'''.
* '''SYSTEXMF''': contains a list of ''system'' texmf trees; its meaning is roughly this: if the source of a font is found in a system texmf tree and that tree is not writeable for the current user, then the scripts '''mktexpk''', '''mktextfm''', and '''mktexmf''' will install their output into '''VARTEXFONTS'''.


== Run pdftex compiled from sources ==
== Run pdftex compiled from sources ==
Line 197: Line 182:
pdftex2 story \\bye
pdftex2 story \\bye
pdflatex2 sample2e
pdflatex2 sample2e
</geshi>
== Keeping packages up-to-date ==
* Tell TL that we want to update packages from TL site:
<geshi lang="bash">
tlmgr option location http://mirror.ctan.org/systems/texlive/tlnet/2008
</geshi>
* check which packages can be updated:
<geshi lang="bash">
tlmgr update --list
</geshi>
* update one package (rerun without --dry-run when you are sure):
<geshi lang="bash">
tlmgr update --dry-run <package-name>
</geshi>
* update all package (rerun without --dry-run when you are sure):
<geshi lang="bash">
tlmgr update --dry-run --all
</geshi>
</geshi>



Revision as of 15:38, 22 September 2008

Introduction

This page describes steps to install TeX Live (TL from now) and needed tweaks so that other kpathsea programs that are not part of TL can also use TL data. This is useful if we recompile some program from sources and want it to be able to find TL data. For example, one might want to recompile pdftex with some patch, and use it instead of the binary coming with TL.

This guide was written for TL2008 on Ubuntu linux 8.01 and should work with no or little change for other Linux/UNIX systems.

When in doubt, please refer to the official TeX Live documentation. This guide serves as a quick guide for some very specific purposes:

  • install TL with minimal effort
  • use TL data with non-TL binaries

Install TL

  • start with a shell where no tex-related environment variables are defined. A quick check can be done by
    (set;env) | fgrep TEX
  • download latest TL iso image to /opt/iso-images (this is my preference, feel free to use any location you prefer)
  • unpack the image:

<geshi lang="bash"> cd /opt/iso-images unlzma texlive2008.iso.lzma </geshi>

  • mount the TL image:

<geshi lang="bash"> mkdir -p /mnt/texlive2008 mount -t iso 9660 -o loop /opt/iso-images/texlive2008.iso /mnt/texlive2008/ </geshi>

  • run the TL installer:

<geshi lang="bash"> perl /mnt/texlive2008/install-tl </geshi>

  • in next menu, change the destination of installation to /opt/texlive/2008 by entering:
d<Enter>
1<Enter>
/opt/texlive/2008<Enter>
r<Enter>
  • start the installation process by entering i<Enter>. When the installation process is done, the last messages should like this:
 pre-generating all format files (fmtutil-sys --all), be patient...done

 See 
   /opt/texlive/2008/index.html 
 for links to documentation.  The TeX Live web site (http://tug.org/texlive/) 
 contains any updates and corrections.

 TeX Live is a joint project of the TeX user groups around the world;
 please consider supporting it by joining the group best for you. The
 list of groups is available on the web at http://tug.org/usergroups.html.

 Add /opt/texlive/2008/texmf/doc/man to MANPATH.
 Add /opt/texlive/2008/texmf/doc/info to INFOPATH.
 Most importantly, add /opt/texlive/2008/bin/i386-linux
 to your PATH for current and future sessions.

 Welcome to TeX Live!

/mnt/texlive2008/install-tl: done.
Logfile: /opt/texlive/2008/install-tl.log
  • make a copy of the main TL configuration file:

<geshi lang="bash"> cp /opt/texlive/2008/texmf/web2c/texmf.cnf /opt/texlive/2008/texmf-var/web2c/ </geshi>

  • change some environment variables permanently by adding to /etc/profile the following lines:

<geshi lang="bash">

    1. added for TeX Live

TEXMFCNF=/opt/texlive/2008/texmf-var/web2c MANPATH=/mnt/texlive2008/texmf/doc/man:$MANPATH INFOPATH=/mnt/texlive2008/texmf/doc/info:$INFOPATH PATH=/opt/texlive/2008/bin/i386-linux:$PATH export TEXMFCNF MANPATH INFOPATH PATH </geshi>

  • logout and login again to ensure that the above environment variables are set. With bash as the default shell, it can be done by saying:

<geshi lang="bash"> exec bash -login </geshi>

  • ensure that the new configuration file can be searched:

<geshi lang="bash"> texhash /opt/texlive/2008/texmf-var/ </geshi>

  • test the installation:

<geshi lang="bash"> pdflatex sample2e </geshi>

  • if things go well, we should get a log similar to the below:
$ pdflatex sample2e
This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(/mnt/texlive2008/texmf-dist/tex/latex/base/sample2e.tex
LaTeX2e <2005/12/01>
.
.
.
Output written on sample2e.pdf (3 pages, 69560 bytes).
Transcript written on sample2e.log.

Use non-TL binaries with TL data

Change the TL configuration file to get rid of $SELFAUTOPARENT, so that non-TL binaries work with TL data as well: <geshi lang="bash"> cd /opt/texlive/2008/texmf-var/web2c cp texmf.cnf texmf.cnf.orig sed -i -e 's:.SELFAUTOPARENT:/mnt/texlive2008:' texmf.cnf </geshi>

Add another texmf tree

Suppose we have tetex previously installed to /opt/tetex-3.0. The tetex texmf tree is then located at /opt/tetex-3.0/share/texmf. To add this texmf tree to our setup, we do this: <geshi lang="bash"> ln -s /opt/tetex-3.0/share/texmf /opt/texlive/texmf-tetex sed -i ' /^TEXMFLOCAL/ a\ TEXMFTETEX = /opt/texlive/texmf-tetex s/^TEXMF = .*TEXMFLOCAL/&,!!$TEXMFTETEX/ s/^TEXMFDBS = .*TEXMFLOCAL/&,!!$TEXMFTETEX/ s/^SYSTEXMF = .*TEXMFLOCAL/&;$TEXMFTETEX/ ' /opt/texlive/2008/texmf-var/web2c/texmf.cnf </geshi>

We can repeat the above steps to add as many texmf trees as we need. For each texmf tree we must:

  • choose a variable name that it's not used yet (TEXMFTETEX in the above example)
  • locate the path to the texmf tree, and make a symlink in /opt/texlive
  • adjust the above commands accordingly.

Some notes on the relevant variables above:

  • TEXMF: specifies whhich texmf trees are searched, and in which order. The order of the texmf trees given in TEXMF is important: earlier trees take predecence over later ones in TEXMF. Edit texmf.cnf manually to change the order if needed.
  • TEXMFDBS: contains list of texmf trees with ls-R filename databases. Running texhash without arguments will re-generating ls-R for texmf trees listed in TEXMFDBS. It's OK to have ls-R in a tree not listed in TEXMFDBS; it will be used, but will not be updated by running texhash.
  • SYSTEXMF: contains a list of system texmf trees; its meaning is roughly this: if the source of a font is found in a system texmf tree and that tree is not writeable for the current user, then the scripts mktexpk, mktextfm, and mktexmf will install their output into VARTEXFONTS.

Run pdftex compiled from sources

Sometimes it's desirable to run a different version of pdftex than the one comming with TL, for example when we want to run pdftex with some features or bugfixes not included in the version in TL. Then we must compile pdftex from sources and do some extra steps.

  • compiling pdftex from sources: download pdftex sources tarball and apply patches if needed. Suppose that we have unpacked pdftex sources to $HOME/src/pdftex-1.40.9, then to build it:

<geshi lang="bash"> cd $HOME/src/pdftex-1.40.9 ./build.sh </geshi>

  • when the above process finishes, the pdftex binary should be located at $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex
  • edit /home/opt/texlive/2008/texmf-var/web2c/fmtutil.cnf to apply the below changes:

<geshi lang="diff"> $ diff -u fmtutil.cnf.orig fmtutil.cnf --- fmtutil.cnf.orig 2008-09-21 17:03:06.642547786 +0200 +++ fmtutil.cnf 2008-09-21 17:03:11.086872146 +0200 @@ -95,6 +95,7 @@

# $Id: format.latex.cnf 9357 2008-07-08 11:58:23Z preining $
latex           pdftex language.dat    -translate-file=cp227.tcx *latex.ini
pdflatex        pdftex language.dat    -translate-file=cp227.tcx *pdflatex.ini

+pdflatex2 pdftex2 language.dat -translate-file=cp227.tcx *pdflatex2.ini

#
lualatex        luatex  language.dat    lualatex.ini
pdflualatex     luatex  language.dat    pdflualatex.ini

@@ -126,6 +127,7 @@

etex           pdftex  language.def    -translate-file=cp227.tcx *etex.ini
pdfetex                pdftex  language.def    -translate-file=cp227.tcx *pdfetex.ini
pdftex         pdftex  language.def    -translate-file=cp227.tcx *pdfetex.ini

+pdftex2 pdftex2 language.def -translate-file=cp227.tcx *pdfetex2.ini

# ------------------------------------------------------------------
# $Id: format.physe.cnf 8442 2008-05-31 23:30:56Z karl $
physe           pdftex -               physe.ini

</geshi>

  • create a file $HOME/texmf/tex/generic/config/pdfetex2.ini with the contents

<geshi lang="tex"> \input pdfetex.ini </geshi>

  • create a file $HOME/texmf/tex/generic/config/pdflatex2.ini with the contents

<geshi lang="tex"> \input pdflatex.ini </geshi>

  • make symlinks (suppose that $HOME/bin is in $PATH):

<geshi lang="bash"> ln -s $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex $HOME/bin/pdftex2 ln -s $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex $HOME/bin/pdflatex2 </geshi>

  • create formats:

<geshi lang="bash"> fmtutil --byfmt pdftex2 fmtutil --byfmt pdflatex2 </geshi>

  • the new formats will be located in $HOME/.texlive2008/texmf-var/web2c/pdftex2. To make it searchable to pdftex, we need to:

<geshi lang="bash"> ln -s $HOME/.texlive2008/texmf-var/web2c/pdftex2 $HOME/.texlive2008/texmf-var/web2c/pdftex </geshi>

  • test the new binary:

<geshi lang="bash"> pdftex2 story \\bye pdflatex2 sample2e </geshi>

Keeping packages up-to-date

  • Tell TL that we want to update packages from TL site:

<geshi lang="bash"> tlmgr option location http://mirror.ctan.org/systems/texlive/tlnet/2008 </geshi>

  • check which packages can be updated:

<geshi lang="bash"> tlmgr update --list </geshi>

  • update one package (rerun without --dry-run when you are sure):

<geshi lang="bash"> tlmgr update --dry-run <package-name> </geshi>

  • update all package (rerun without --dry-run when you are sure):

<geshi lang="bash"> tlmgr update --dry-run --all </geshi>

Maintain packages installed locally

If we keep installing local packages to a texmf tree for some time, we will find out that it's getting difficult to keep track of what has been installed, and how to remove or upgrade a package. This is the place where a package management system is useful. We will use miktex tools to maintain our local packages.

(to be continued)