TeX Live

From ArchWiki

According to Wikipedia:

TeX Live is a free software distribution for the TeX typesetting system that includes major TeX-related programs, macro packages, and fonts.

TeX Live includes the tex(1) and pdftex(1) programs, the LaTeX and ConTeXt TeX macro packages and the XeTeX and LuaTeX TeX engines.

Installation

  • The texlive-most group contains most TeX Live packages.
    • texlive-core, the essential package, based on the medium upstream install scheme (all other packages are based on the upstream collections). The package includes pacman hooks to automate mktexlsr, fmtutil and updmap.
    • texlive-bin contains the binaries and libraries (it is a dependency of texlive-core).
    • texlive-latexextra contains many useful packages, such as polyglossia, amsmath and graphicx.
  • The texlive-lang group contains packages providing character sets and features for languages with non-Latin characters.
    • texlive-langextra provides language support for African, Arabic, Armenian, Croatian, Hebrew, Indic, Mongolian, Tibetan and Vietnamese languages.
  • texlive-bibtexextra contains additional BibTeX and BibLaTeX styles and bibliography databases.
  • texlive-fontsextra contains additional fonts, which can be viewed on the LaTeX Font Catalogue.
  • biber provides an alternative bibliography processing backend for BibLaTeX.

To determine which CTAN packages are included in each texlive- package, look up the files /var/lib/texmf/arch/installedpkgs/<package>_<revnr>.pkgs.

Note: Some tools and utilities included in TeX Live rely on ghostscript, perl, python, or ruby. See the optional dependencies of each package for details.
Tip: You may want to install a TeX editor.

tllocalmgr

The tllocalmgr utility, provided by tllocalmgr-gitAUR, lets you install (and update) packages from CTAN as pacman packages. See its usage (-h) for details.

tlmgr

Note:
  • While texlive-core provides the tlmgr script in TEXMFDIST, it is broken. You can either fix it as described below or use tllocalmgr instead.
  • The texconfig(1) command is mostly broken because it partially depends on tlmgr (FS#59094). The interactive mode of texconfig requires dialog.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The "fix" should be incorporated into the texlive-core package. Editing files in TEXMFDIST will not survive package upgrades. (Discuss in Talk:TeX Live)

The tlmgr utility is the standard way of installing and updating packages from CTAN. It requires minor fixes as follows:

First, edit TEXMFDIST/scripts/texlive/tlmgr.pl and replace $Master = "$Master/../.."; with $Master = "${Master}/../../..";. The path prefix TEXMFDIST is not a predefined environment variable, it is defined below in this article. Replace it with the correct value.

Create an alias for the perl script (which you can add in your shell's init file).

alias tlmgr='TEXMFDIST/scripts/texlive/tlmgr.pl --usermode'

Now you can initialize it in user mode (which will use ~/texmf as install prefix):

$ tlmgr init-usertree

Set your preferred mirror, for example:

$ tlmgr option repository http://mirrors.rit.edu/CTAN/systems/texlive/tlnet

Now you can install CTAN packages as usual:

$ tlmgr install package_name

Package documentation

The packages in the official repositories do not contain the documentation or source files of font/macro packages.

For offline access with texdoc you can either install the whole TeX Live documentation and source files with texlive-most-docAUR or install documentation of specific packages with tllocalmgr.

You can also access the documentation online at:

Manual installation

Alternatively you can install TeX Live with the upstream installer, which is packaged as texlive-installerAUR. For more information, see the LaTeX Wikibook and the TeX Live Guide.

Usage

See the following resources:

texmf trees and Kpathsea

texmf trees (texmf stands for TeX and Metafont) should follow the TeX Directory Structure, or files may not be found.[1]

TeX Live uses the Kpathsea library to lookup paths by filename across multiple texmf trees and the current working directory.

Kpathsea searches the following variables in the reverse order (later trees override earlier ones).

Variables Arch default 1) Used by [2]
TEXMFDIST /usr/share/texmf-dist files of the original distribution
TEXMFLOCAL /usr/local/share/texmf:/usr/share/texmf administrators for system-wide installation of additional or updated macros, fonts, etc.
TEXMFSYSVAR /var/lib/texmf updmap and fmtutil (user mode) to store (cached) runtime data
TEXMFSYSCONFIG /etc/texmf updmap and fmtutil (user mode) to store modified configuration data
TEXMFHOME ~/texmf users for their own individual installations of additional or updated macros, fonts, etc.
TEXMFVAR ~/.texlive/texmf-var updmap and fmtutil (sys mode) to store (cached) runtime data
TEXMFCONFIG ~/.texlive/texmf-config updmap and fmtutil (sys mode) to store modified configuration data
TEXMFCACHE $TEXMFSYSVAR;$TEXMFVAR ConTeXt MkIV and LuaLaTeX to store (cached) runtime data
Note: The default values are defined in /etc/texmf/web2c/texmf.cnf[3]; they can be overridden with environment variables.

Kpathsea provides the kpsewhich(1) command to lookup paths. When run with the -var argument it can also print the values of variables.

Kpathsea uses filename databases (ls-R) to speed up searches in system-wide texmf trees (configured with the TEXMFDBS variable). This means that when system-wide file trees are changed, mktexlsr(1) or texhash (a symlink) need to be run as root. Fortunately the texlive-core automates this with a pacman hook targeting all default system-wide texmf trees but /usr/local/share/texmf.[4] So as long as you install system-wide packages via pacman you should not need to run mktexlsr or texhash at all.

Tip: For setting up a local repository you can create the ~/texmf/tex/{format}/ directory structure ({format} is usually latex), where custom classes are located in the root of the ./{format} folder and other local files get placed in a folder with the same name (e.g. mycustompackage.sty goes to ./{formats}/mycustompackage/mycustompackage.sty), then run texhash to update the user database.

Important information

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: ConTeXt nowadays works out of the box. You just sometimes need to run mtxrun --generate.[5] (Discuss in Talk:TeX Live)
  • The ConTeXt formats (for Mark II and IV) are not automatically generated upon installation. See the ConTeXT wiki for instructions on how to do this.
  • TeX Live (upstream) now provides a tool for incremental updates of CTAN packages. On that basis, we also plan to update our packages on a regular basis (we have written tools that almost automate that task).
  • The way to handle font mappings for updmap(1) was improved in September 2009, and installation should now be much more reliable than in the past. In the meantime, if you encounter error messages about unavailable map files, simply remove them by hand from the updmap.cfg file (ideally using updmap-sys --edit). You can also run updmap-sys --syncwithtrees to automatically comment out outdated map lines from the configuration file.

Tips and tricks

Changing default paper size

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: It is possible by directly editing the config files.[6] (Discuss in Talk:TeX Live)

It is currently impossible to set the default page size using the texlive tools, because they do not work with the standard Arch package.

Usually, you would run texconfig or tlmgr, which are also capable of changing other useful settings.

You can edit the configuration files as follows.

  • To set the paper size for the pdftex family of commands (pdftex, pdflatex, etc) edit /etc/texmf/tex/generic/tex-ini-files/pdftexconfig.tex file.

which can also be discovered by running kpsewhich pdftexconfig.tex. Change the two lines that specify the pdfpageheight and pdfpagewidth. For example, to use letter size, change

\pdfpageheight = 297 true mm
\pdfpagewidth  = 210 true mm

to

\pdfpageheight = 11 true in
\pdfpagewidth  = 8.5 true in

Unfortunately, this will not have any effect until the binary .fmt files are rebuilt. You can do this with fmtutil-sys. Re-installing texlive-bin with pacman will also do this for you.

  • For dvips, you can use the -t option to specify the paper size: dvips -t letter foo.dvi. To change the default, edit /etc/texmf/dvips/config/config.ps file.

which can also be discovered with kpsewhich config.ps. The end of this file has sections that list all the paper sizes that dvips knows about. The first listed paper size will be the default. Just move the one that you want to be the default to the top of the list. The behavior of dvips will be affected as soon as the file file is changed.

Making fonts available to Fontconfig

By default, the fonts that come with the various TeX Live packages are not automatically available to Fontconfig. If you want to use them with, say XeTeX or LibreOffice, the easiest approach is to make symlink the font directory to a subdirectory in your user's font path. Run the following for an OpenType font:

$ ln -s /usr/share/texmf-dist/fonts/opentype/public/some_fonts_you_want ~/font_path/OTF/

To make them available to fontconfig, run:

$ fc-cache ~/font_path
$ mkfontscale ~/font_path/OTF
$ mkfontdir ~/font_path/OTF

Similar steps follow for TrueType fonts and Type 1 fonts. In the lines above, substitute opentype with truetype or type1 and substitute OTF with TTF or Type1.

Alternatively, texlive-core contains the file /usr/share/fontconfig/conf.avail/09-texlive-fonts.conf that contains a list of the font directories used by TeX Live. You can use this file with:

# ln -s /usr/share/fontconfig/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/09-texlive-fonts.conf

And then update fontconfig:

$ fc-cache && mkfontscale && mkfontdir
Note:
  • This may cause conflicts with XeTeX/XeLaTeX if the same fonts are (separately) available to both TeX and Fontconfig, i.e. if multiple copies of the same font are available on the search path.
  • Type 1 fonts will not be available in LibreOffice 5.3 and later.

Updating babelbib language definitions

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: You should not change /usr/share/texmf-dist/. (Discuss in Talk:TeX Live)

If you have the very specific problem of babelbib not having the latest language definitions that you need, and you do not want to recompile everything, you can get them manually from https://www.tug.org/texlive/devsrc/Master/texmf-dist/tex/latex/babelbib/ and put them in /usr/share/texmf-dist/tex/latex/babelbib/. For example:

$ cd /usr/share/texmf-dist/tex/latex/babelbib/ 
# wget https://www.tug.org/texlive/devsrc/Master/texmf-dist/tex/latex/babelbib/romanian.bdf
# wget [...all-other-language-files...]
# wget https://www.tug.org/texlive/devsrc/Master/texmf-dist/tex/latex/babelbib/babelbib.sty

Afterwards, you need to run texhash to update the TeX database:

# texhash

Troubleshooting

Error with "formats not generated" upon update

See FS#16467. (Note that if you do not use the experimental engine LuaTeX, you can ignore this.) This situation typically occurs when the configuration files language.def and/or language.dat for hyphenation patterns contain references to files from earlier releases of texlive-core, in particular to the latest experimental hyphenation patterns for German, whose file name changes frequently. Currently they should point to dehyph{n,t}-x-2009-06-19.tex.

To solve this, you need to either remove these files: /etc/texmf/tex/generic/config/language.{def,dat} or update them using the newest version under: /usr/share/texmf/tex/generic/config/language.{def,dat} and then run

# fmtutil-sys --missing

Getting tlmgr working with texliveonfly

The easiest way to get tlmgr working with texliveonfly is to make a script tlmgr in your $PATH (instead of making it an alias) containing:

#!/bin/sh
/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode "$@"

This is because textliveonfly is a Python script which cannot handle aliases.

Alternatives

Alternatives to TeX Live include MikTex and Tectonic, they come with a minimal install, downloading the necessary packages on the go.

See also