TeX Live 2007 guide Alexis Ballier This guide aims to show you how to install TeX Live 2007 on Gentoo, more specifically what you need to take care of if you already had a TeX distribution installed (like tetex or TeX Live 2005). 1.0 2007-10-27 Clean uninstall
Introduction

In this section we will assume that you have >=app-text/tetex-3 installed. This applies as well if you had installed app-text/texlive-2005. In a perfect world it would be as simple as unmerging it, but unfortunately it is not.

Saving your old configuration

If you had modified your configuration of tetex by editing files in /etc/texmf, you should first save them:

$ cp -rf /etc/texmf /tmp/tetex-texmf
Removing tetex

Then you can unmerge safely tetex:

# emerge -C tetex

Some weird errors have been reported when there were stray configuration files left in /etc/texmf. For safety and a clean install of TeX Live it is recommended to remove the /etc/texmf/texmf.d/00texmf.cnf file:

# rm /etc/texmf/texmf.d/00texmf.cnf
You have not lost anything since you just saved your old configuration files.

Due to tetex using texlinks outside of the scope of the package manager, simply unmerging it will have left some stray symlinks:

$ ls -l /usr/bin/pdftex
lrwxrwxrwx 1 root root 7 2007-07-09 07:34 /usr/bin/pdftex -> pdfetex

Of course, pdfetex has gone with tetex's removal, so the pdftex symlink is a dead one. It can be safely removed. The find command can help finding dead symlinks (with a GNU extension though):

$ find /usr/bin -name "*" -type l ! -xtype f ! -xtype d

/usr/bin/lamed
/usr/bin/latex
/usr/bin/amstex
/usr/bin/elatex
/usr/bin/eplain
/usr/bin/lambda
/usr/bin/pdftex
/usr/bin/pdflatex
/usr/bin/pdfamstex

These are the files left over by my tetex installation.

tetex was also using fmtutil outside of the scope of the package manager to generate the format files. With TeX Live 2007 we are now building most of the format files while compiling the packages; which format files will be installed in /var/lib/texmf. That means you have to make sure that there are no stray format files:

# rm -rf /var/lib/texmf/web2c
Installing TeX Live 2007

If you have passed through all the above steps, now installing TeX Live 2007 should be very easy.

# emerge texlive

In theory this should just go smoothly and install everything. You might want at some point to tune app-text/texlive use flags to install extra TeX packages, but you can do it later; app-text/texlive is just a meta-ebuild that pulls the real packages depending on its use flags.

Nevertheless, it is possible that you get dependencies problems, errors while installing a package, etc. In that case, you are advised to file a bug on https://bugs.gentoo.org. If you do file a bug, please include at least the output of texconfig conf in addition to the error; this output will most often be requested.

Configuration
Introduction

As it was the case for tetex-3, TeX Live on Gentoo has its three main configuration files splitted and handled by texmf-update. These files are, namely, texmf.cnf, fmtutil.cnf, updmap.cfg. They lie in /etc/texmf/web2c; you should not modify them directly because the changes will be lost the next time texmf-update is ran.

texmf.cnf

The texmf.cnf configuration file is the main configuration file for your TeX installation, it contains various variable definitions that will be used by a lot of programs.

The texmf.cnf file is the result of the concatenation of the files in /etc/texmf/texmf.d. In order to modify your TeX environment configuration, you should modify the files there. At the time of writing, Gentoo TeX Live's ebuild install six files there:

00header.cnf
05searchpaths.cnf
10standardpaths.cnf
15options.cnf
20sizes.cnf
25misc.cnf

This is the result of the splitting in their respective sections of a (lightly) modified texmf.cnf file from TeX Live 2007 DVD.

The files 00header.cnf, 05searchpaths.cnf, 10standardpaths.cnf and 25misc.cnf should not be modified and kept as is. If the defaults can be improved, please file a bug.

The TeX Live ebuilds are not aware of paths changes of those files, so if you change any path there, make sure you know what you are doing.

The files 15options.cnf and 20sizes.cnf can be modified with caution. The comments in these files should be explicit of what option means what. For example, in 20sizes.cnf you can increase TeX memory, in case you are trying to compile a too big document and run into TeX capacity exceeded, sorry errors.

If you wish to append some additions to the texmf.cnf file, you can also create a new file in /etc/texmf/texmf.d, called for example 99myadditions.cnf. Beware though to not give it a higher priority than the core configuration files, so it should begin with a two digits number greater than 25.

Packages that need to append something to the texmf.cnf file get the same treatment, they should install a texmf.d file instead:

insinto /etc/texmf/texmf.d
doins 40mytexmfadditions.cnf
updmap.cfg

The updmap.cfg is the configuration file used by updmap (and updmap-sys), unless otherwise specified. It tells it which font maps to update for the various TeX output drivers.

The updmap.cfg file in /etc/texmf/web2c is the result of the concatenation of the files in /etc/texmf/updmap.d. The initial 00updmap.cfg file installed by app-text/texlive-core is the result of updmap --syncwithtrees ran on the texmf tree that it installs (in fact, it just mimics what updmap --syncwithtrees would do, but it is only a technical detail).

Various TeX Live ebuilds will add files to the /etc/texmf/updmap.d directory, when they install fonts. While you can edit those files to disable some font maps to be updated, it would probably be wiser to remove the relevant package.

If a third party package wants to add some font maps, it should install a file in /etc/texmf/updmap.d and let texmf-update handle it.

Sometimes you can see updmap-sys --enable Map=mymap.map in some ebuilds or some installation instructions of a third party font package, while this might work at a first try, the changes will be reverted the next time texmf-update is ran.

The good way of handling it would be to create a file to be installed in /etc/texmf/updmap.d and install it for TeX distributions that support the texmf-update way:

inherit latex-package
...
src_install() {
    ...
    if latex-package_has_tetex_3; then
        insinto /etc/texmf/updmap.d
        doins myfontmapconfig.cfg
    fi
    ...
}
...
pkg_postinst() {
    latex-package_pkg_postinst
    latex-package_has_tetex_3 || updmap-sys --enable Map=mymap.map
}

pkg_postrm() {
    latex-package_pkg_postinst
    latex-package_has_tetex_3 || updmap-sys --disable Map=mymap.map
}

The files in /etc/texmf/updmap.d should respect updmap syntax:

There are two possible entries: Map and MixedMap. Both have one additional
argument: the file name of the map file. MixedMap ("mixed" means that
the font is available as bitmap and as outline) lines will not be used
in the default map of dvips if dvipsPreferOutline is false. Inactive
Map files should be marked by "#! " (without the quotes), not just #.
fmtutil.cnf

The fmtutil.cnf file contains the information on how to build a format file and how to handle it.

The fmtutil.cnf file is the result of the concatenation of the files in /etc/texmf/fmtutil.d. Various TeX Live ebuilds install files there, those files come with the formats they add support for and the symlink to the relevant engine.

The fmtutil.cnf file contains the configuration information for fmtutil(8).
Each line contains the name of the format (e.g., "tex", "latex", "omega"),
the name of the engine that is used by that format (e.g., "tex", "etex", "omega"),
the pattern file (e.g., language.dat, language.def), and any arguments
(name of an .ini file).

Fields are separated by whitespace and complete lines can be commented out with "#".
The "pattern file" field cannot be used to define a file that is used while 
building the format. It tells fmtutil which file the format creation procedure reads 
and it has an effect to the options --showhyphen and --byhyphen.
If the format has no way to customize hyphenation, a "-" can be used to indicate this.

TeX Live ebuilds that install a fmtutil.d file install the relevant format files in /var/lib/texmf/web2c and create the symlink from the format to the engine.

It should be noted that when a support file for a language gets added, texmf-update takes care of adding it to the language.dat file and regenerates the format files so that they support the newly installed language.

Updating your configuration

Now that you know how does TeX Live configuration is managed, you should be able to port the changes you had made to your older TeX distribution configuration to the TeX Live configuration layout.

Common errors
Introduction

In this chapter we will try to give a short summary of the most common errors and explain what has gone wrong.

Format was written by (pdf)etex

Sometimes when installing some packages that requires latex, you'll get this error:

---! //var/lib/texmf/web2c/latex.fmt was written by pdfetex

This is due to old files remaining from an old installation of a TeX distribution based on etex. That most likely means you did not follow entirely this guide, especially the Clean uninstall chapter .

Nevertheless, it is still possible to fix it quickly without having to reinstall anything, just run as root:

# rm -rf /var/lib/texmf/web2c
# texmf-update
Format directory does not exist

When installing e.g., texlive-latex, you might encounter the error:

fmtutil: format directory
`/var/tmp/portage/dev-texlive/texlive-latex-2007/work/texmf-var/web2c' does not
exist.

This is most likely to be due to a wrong configuration. You should try to run the following command and get the same results:

$ kpsewhich --var-value=TEXMFMAIN
/usr/share/texmf

This is very important, since fmtutil looks for mktexdir at this location; if you have a different result then fmtutil will not find mktexdir and thus will fail to create the directory where to temporarily store the compiled formats.

There is no magic command to fix this one, you should check that your configuration is correct, that there is no stray configuration file in /etc/texmf/texmf.d. This will most likely be due to 00texmf.cnf being still there and thus setting wrong definitions for the texmf.cnf file. Please refer to the Clean uninstall chapter .

Missing .tex files

When installing texlive-latex (or any other format that has babel hyphenation support), you might encounter an error like:

===========================================
Local configuration file hyphen.cfg used
===========================================

(/var/tmp/portage/dev-texlive/texlive-latex-2007/work/texmf-dist/tex/generic/ba
bel/hyphen.cfg (/usr/share/texmf/tex/generic/hyphen/hyphen.tex)
(/usr/share/texmf/tex/generic/hyphen/ushyphmax.tex)
(/usr/share/texmf/tex/generic/hyphen/dumyhyph.tex)
(/usr/share/texmf/tex/generic/hyphen/zerohyph.tex)
(/usr/share/texmf/tex/generic/hyphen/zerohyph.tex)
(/usr/share/texmf-dist/tex/generic/xu-hyphen/xu-bahyph.tex
(/usr/share/texmf/tex/generic/hyphen/bahyph.tex))
(/usr/share/texmf-dist/tex/generic/xu-hyphen/xu-bghyphen.tex
! I can't find file `bghyphen.tex'.
l.10   \input bghyphen.tex

Please type another input file name: 
! Emergency stop.
l.10   \input bghyphen.tex

No pages of output.
Transcript written on latex.log.
Error: `pdftex -ini  -jobname=latex -progname=latex
-translate-file=cp227.tcx *latex.ini' failed

In that case, you will have to check which language.dat file is being used:

$ kpsewhich language.dat
/usr/share/texmf/tex/generic/config/language.dat

This file is automatically generated by texmf-update, it is the result of the concatenation of language.*.dat files present in the directory where is language.us. This directory should be /usr/share/texmf/tex/generic/config/. So you should check that there are no other language.*.dat files in that directory than the ones installed by the various dev-texlive/texlive-lang* ebuilds. A file present in that directory means that you want to enable hyphenation support for a specific language; and if you don't have the hyphenation support files this will cause formats that can use this extra hyphenation support to fail to build.