Translation(s): Català - Deutsch - English - Español - Français - Italiano
?Discussion
This page describes how to set up a LaTeX distribution on Debian.
Installation
There are two LaTeX distributions available for Debian: TeX Live and teTeX. The latter is no longer supported, so it is recommended to install TeX Live. Depending on how many features you need, you can choose one of the following packages to install:
texlive - a decent selection of packages that should suffice for the most common tasks.
texlive-base - essential programs and files required for any TeX system (no LaTeX).
texlive-full - a metapackage which pulls in all the relevant texlive packages.
There are also several add-on macro packages available:
If you want to add support for your language (other than english) in TeX Live, search for texlive-lang and install your language.
NOTE: If you choose to install texlive-full, the above-mentioned add-on macro packages and texlive-lang-* packages will all be installed automatically.
For all texlive packages, see texlive or run
aptitude search ~n^texlive
or, in case you do not have aptitude installed
apt search '^texlive'
Custom packages
If you want to install a custom TeX package that is not already in Debian's repositories, take a look at CTAN's web site. Download the package and extract it with tar -xvf foo.tar.gz. Enter the directory, if you see foo.ins, run it trough LaTeX
latex foo.ins
This generates foo.sty. Now you have to copy it to the system LaTeX tree or your personal tree. After installation, you can use the new package by inserting \usepackage{foo} in the preamble of the document.
We will show now, briefly, how to perform the installation in both cases, more detailed information can be found in the LaTeX wikibook.
User install
This method creates a personal texmf tree to your home folder. The files are installed only to the original user.
Create the directory structure:
mkdir -p ~/texmf/tex/latex/foo
It's a good idea to create separate subdirectories in latex for different custom packages. Copy the newly generated foo.sty to your tree. After this, update the LaTeX package cache with
texhash ~/texmf
System install
This method installs the package in the LaTeX system tree. The new package is available to all users.
Create a new directory as root
mkdir /usr/share/texmf/tex/latex/foo
Copy the new file foo.sty to the new folder, and update the LaTeX package cache
texhash
Basic usage
First, make sure the texlive-binaries package is installed, which is the case if you have followed the installation process above.
Create or edit an input file file.tex
- Running LaTeX
latex file.tex
will create a .dvi file which can be opened using xdvi.
- You can also produce a PDF directly using:
pdflatex file.tex
Editors
LaTeX files are plain-text files and thus can be edited with any text editor, like nano, vim or emacs. In addition text editors such as Visual Studio Code can edit LaTeX files using extensions such as LaTex Workshop. There are also other text editors which can edit LaTeX files by means of extensions, for instance, vim with vim-latexsuite and gedit with gedit-latex-plugin. There are also GUI editors, which make editing and compiling the document more user friendly.
Documentation
- Documentation about the TeX Live LaTeX distribution is available through specific packages, e.g.:
Documentation for specific latex package or commands is then accessible using texdoc or texdoctk programs, e.g.:
texdoc makeindex texdoc graphicx