TeXLive
11 Aug 2020 • Leave Commentstexmf
You will see name texmf everywhere. It stands for TEX and METAFONT (an old language Knuth used to design fonts).
Overview
To setup a TeX system, you need to do finish two tasks:
- Install TeX by a distribution, like TeXLive, MiKTeX etc.
- Manage TeX system by built-in texconfig or tlmgr of TeXLive, the later of which is far more powerful.
- Install, update, uninstall, backup individual TeX packages.
- Change installation options like paper size and source location.
You can regard tlmgr as package manager similar to dnf, emerge etc.
- Leave TeX installation in a standalone directory. Do not spread it across the LFS.
Installation
OS Package Manager
Installation from package manager is a minimal install and may lack some fundamental TeX packages (error-prone). So, it's not recommended.
CentOS
By default, the XeTeX engin is not installed. Hence, put it on command line too:
~ $ dnf install texlive texlive-xetex
archlinux
~ $ pacman -S texlive-most texlive-lang biber
Net Installer
Net Installer is recommended by TeXLive, but limited by local bandwidth and is prone to network abrupt.
The advantage by net installer is you get the latest updates.
DVD ISO
It's recommended to do a full install from ISO.
ISO contains everything needed to run TeX system and is a fully tested release.
Preparation
- Spare at least 10G disk space.
- Download the ISO (around 5G).
-
texmf trees shoulf follow TeX Directory Structure (TDS). A tree usually includes the following top-level sub-directories:
tex/ fonts/ metafonts/ metapost/ bibtex/ scripts/ doc/ source/ implementation/ program/
Of of all the top-level sub-directories,
tex/
is where TeX macros located, with pathname astexmf/tex/format/package/
. format can be amstex, latex, plain, texinfo. -
Various texmf trees.
TEXMF, TEXDIR, TEXMFROOT (TeXLive release): /usr/local/texlive/{2020,2021} TEXMFDIST, TEXMFMAIN (official TeX tree): /usr/local/texlive/2020/texmf-dist TEXMFLOCAL (system-wide customized tree): /usr/local/texlive/texmf-local TEXMFHOME (per-user customized tree): ~/texmf TEXMFSYSVAR (system-wide runtime cache data): /usr/local/texlive/2020/texmf-var TEXMFVAR (per-user runtime cache data): ~/.texlive2020/texmf-var TEXMFSYSCONFIG (system-wide modified configuration data): /usr/local/texlive/2020/texmf-config TEXMFCONFIG (per-user modified configuration data): ~/.texlive2020/texmf-config
These TeX variables can be overriden by system environment variables like
TEXLIVE_INSTALL_PREFIX
andTEXLIVE_INSTALL_TEXDIR
. Checkinstall-tl --help
for details.
Installation from ISO
~ # mkdir -p /mnt/iso; cd /mnt/iso
~ # mount /path/to/texlive.iso .
# text mode
~ # per ./install-tl
# GUI mode
~ # per ./install-tl -gui
Leave the default settings (full installation) if you dunno what you are doing. There is an option:
create symlinks in standard directories
Please leave it it uncheck, which otherwise may ruin your system bin directories.
It may take half an hour to complete the installation.
TeX environment variables for Unix
There may exist multiple TeX distributions installed alongside. So, it's better to create a current version symlink.
~ # cd /usr/local/texlive/
~ # ln -sv 2020 current
Mainly, adjust the search path.
PATH=/usr/local/texlive/current/bin/x86_64-linux:$PATH; export PATH
MANPATH=/usr/local/texlive/current/texmf-dist/doc/man:$MANPATH; export MANPATH
INFOPATH=/usr/local/texlive/current/texmf-dist/doc/info:$INFOPATH; export INFOPATH
Check Installation Scheme
tlmgr will reveal everythin about the setup.
~ # tlmgr --help
~ # tlmgr conf
~ # kpsewhich -a texmf.cnf
~ # kpsewhich -var-value=TEXMFHOME
~ # kpsewhich foo.sty
~ # kpsewhich bar.cls
Update
It is highly recommened not to update TeX distribution in place. Instead, you'd better install a new distribution version. Alternatively, please update or install individual packages into TEXMFLOCAL or TEXMFHOME.
-
Where should we get updates from?
By default, the
after install, set CTAN as source for package updates
option is checked upon installation.
But we can manually set the update repository afterwards:
~ # tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet
This tells tlmgr to use a nearby CTAN mirror for future updates.
-
# GUI ~ # tlmgr -gui # Text ~ # tlmgr update -all -dry-run ~ # tlmgr update -list ~ # tlmgr update -all ~ # tlmgr -repository /local/mirror/tlnet install collection-xetex ~ # tlmgr show collection-latexextra
Additional Packages and Fonts
Additional new or updated packages and fonts are expected to be in TEXMFLOCAL (system-wide) or TEXMFHOME (per-user, RECOMMENDED), independent of TeX distributions.
For changes under TEXMFLOCAL, we should update the search path for Kpathsea, as TEXMFLOCAL is prefixed with double !!
in texmf.cnf.
~ # mktexlsr [/usr/local/telive/texmf-local/]
# -or-
~ # mktexlsr [$(kpsewhich -var-value=TEXMFLOCAL)]
~ # kpsewhich foobar.sty
-
mktexls acutally just creates a file named ls-R under the specified directory.
Without the directory argument, mktexlsr tries updates all ls-R for the installation.
-
You can also use texhash as it is just a symlink to mktexlsr.