This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

TeX Live

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
Resources

TeX Live is a complete TeX distribution with several programs to create professional documents.

Installation

USE flags

USE flags for app-text/texlive A complete TeX distribution

X Add support for X11
cjk Add support for Multi-byte character languages (Chinese, Japanese, Korean)
context Add support for the ConTeXt format (dev-texlive/texlive-context)
extra Add support for extra TeXLive packages
games Add typesetting support for games (chess, etc.) (dev-texlive/texlive-games)
graphics Add support for several graphics packages (pgf, tikz,...)
humanities Add LaTeX support for the humanities (dev-texlive/texlive-humanities)
luatex Add extra support for luatex
metapost Add support for metapost: A tool for creating graphics in scalable PostScript
music Add support for music typesetting (dev-texlive/texlive-music)
pdfannotextractor Add dev-tex/pdfannotextractor support, for extracting annotations from PDF files
png Add support for libpng (PNG images)
pstricks Add pstricks packages (dev-texlive/texlive-pstricks)
publishers Add support for publishers (dev-texlive/texlive-publishers)
science Add typesetting support for natural and computer sciences (dev-texlive/texlive-mathscience)
tex4ht Add support for dev-tex/tex4ht (for converting (La)TeX to (X)HTML, XML and OO.org)
texi2html Add support for app-text/texi2html which converts texi files to HTML
truetype Add support for FreeType and/or FreeType2 fonts
xetex Add support for XeTeX macros (dev-texlive/texlive-xetex)
xml Add support for XML files

Emerge

Install app-text/texlive:

root #emerge --ask app-text/texlive
Note
When wanting to merge multiple Doxygen PDF files into one PDF file, or book style PDF preferable for E-Reading devices; it is likely the dev-texlive/texlive-latexextra package will be needed to be installed. (i.e. pdflatex refman.tex)


Upgrading

When users try to upgrade TeXLive, they'll meet a failure due to "hard blocking". Here are a solution to overcome it and the reasons behind it.

Solution

First you need to unmerge some packages in dev-texlive:

root #qlist -I dev-texlive/texlive-lang > texlive-lang-packages.txt
root ## Or if you prefer 'eix' to qlist, do instead:
root #eix '-I#' dev-texlive/texlive-lang > texlive-lang-packages.txt
root ## Then
root #emerge --deselect=n --unmerge texlive-latex texlive-basic $(cat texlive-lang-packages.txt)

Now you can upgrade:

root # emerge --ask --oneshot --update app-text/texlive $(cat texlive-lang-packages.txt)

Or simply pull in "world":

root # emerge -uDN1a @world

Why this workaround?

Some dev-texlive/texlive-* packages (see below) do "hard blocking". For example, texlive-basic-2016 hard-blocks <texlive-basic-2016, i.e., older versions of itself. Hard-blocked packages can't be installed simultaneously, even temporarily. But as of 2017, portage can't resolve hard blocks automatically (bug #250286), and users must handle them manually. They are hard instead of normal blocks because of some file moves. (bug #606730)

Thus, to upgrade texlive-basic, users must first unmerge it manually using the above procedure.

Some more details

Although some language packs have only 2012 versions (e.g. texlive-langcroatian-2012), even for them the above solution (re-emerging them afterwards) works, too. It's because blocking in an ebuild file is in fact one-sided, unlike normal dependency, which is checked at "emerge --depclean": Assume virtual/src-0.ebuild contains DEPEND="!!cat/dest", and cat/dest-0.ebuild has no dependency. Then:

  • if you already have cat/dest, then "emerge virtual/src" will fail. However,
  • even if you already have virtual/src, "emerge cat/dest" is allowed.


Hard blocking is specified in ebuilds by the operator !!. As of 2017, the only ebuilds using the !! operator (in our context) are texlive-basic, texlive-latex, and texlive-langcjk. Packages blocked by them are these three themselves plus texlive-lang*.

Usage

Most of the time users will implement TeX Live through the editor of choice. The following is a list of compilers capable of translating a .tex document into .pdf file:

LaTeX:

user $pdflatex mydocument.tex

XeTeX:

user $xelatex mydocument.tex

LuaTeX:

user $luatex mydocument.tex

Editors

There are several editors users can choose from in Gentoo. To list a few pure TeX editors:

Editor Package Homepage Description
kile app-editors/kile http://kile.sourceforge.net/ A KDE based editor, which lets users write in LaTeX code and then compile the document.
texmaker app-office/texmaker http://www.xm1math.net/texmaker/ A Qt based editor, which lets user write in LaTeX code and then compile the document
texstudio app-office/texstudio http://texstudio.sourceforge.net/ Free cross-platform LaTeX editor (former texmakerX)
gummi app-editors/gummi https://github.com/alexandervdm/gummi GTK+ based editor, which lets users write in LaTeX code and then compile the document
latexila app-editors/latexila https://wiki.gnome.org/Apps/LaTeXila GNOME based editor, which lets users write in LaTeX code and then compile the document
lyx app-office/lyx https://www.lyx.org/ Qt based WYSIWYM editor, users type directly into the LaTeX document and can edit LaTeX code afterwards
texworks app-editors/texworks https://www.tug.org/texworks/ Qt based editor, suggested editor by the UK-TUG which lets users write in LaTeX code and then compile the document. Can be found in the betagarden ebuild repository as live ebuild.
winefish app-text/winefish https://github.com/viettug/winefish GTK+ based editor, which lets users write in LaTeX code and then compile the document
Note
The above table is not a comprehensive list of TeX editors.

Most editors support LaTeX syntax highlighting like Vim, emacs (which supports compilation and previewing), gedit or gleany and most development IDE's provide some plugins like dev-util/netbeans.

Programs with LaTeX support

Find the Gentoo package that contains a tex package

app-portage/pfl contains a program to search in an online database for a Gentoo package containing a particular file.

root #emerge --ask app-portage/pfl
user $pfl
user $e-file yhmath.sty
 *  dev-texlive/texlive-mathextra
	Available Versions:	2015 2014 
	Description:		TeXLive Mathematics packages
	Matched Files:		/usr/share/texmf-dist/tex/latex/yhmath/yhmath.sty;

[I] dev-texlive/texlive-mathscience
	Available Versions:	2017 2016 
	Last Installed Ver:	2016 (Thu Jul 20 17:41:05 2017)
	Description:		TeXLive Mathematics and science packages
	Matched Files:		/usr/share/texmf-dist/tex/latex/yhmath/yhmath.sty;  

eselect pdftex

Gentoo would automatically clean out any previous version during upgrade. In order to intentionally install several versions into different slots a script exists that enables easy switching:

root #emerge --ask app-eselect/eselect-pdftex

List available distributions with the following command:

root #eselect pdftex list

To set the distribution:

root #eselect pdftex set 1

texdoc

Shows the original TeX documentation by keywords. For example everything about article:

user $texdoc article

This should open the default PDF viewer with the documentation.

In order to use the texdoc command, the doc USE flag enabled for TeX Live and any other module which users would like documentation available.

To enable the doc USE flag on any TeX Live module automatically, use a wildcard:

root #echo dev-texlive/* doc >> /etc/portage/package.use

A full list of installed TeX modules can be shown with the following command:

root #qlist -C -I texlive

To enable the doc USE flag only for certain modules, add them to /etc/portage/package.use. A quick way of adding them all is by running this command:

root #qlist -C -I texlive | sed 's/$/ doc/' >> /etc/portage/package.use
Note
Afterwards edit the USE flags for each module in /etc/portage/package.use individually

Troubleshooting

Increase main memory

The error message "TeX capacity exceeded, sorry main memory size = xxxxxxxxx" can be prevented by

1. Change the value of main_memory in file /etc/texmf/texmf.d/20sizes.cnf. This should persist through all future texliveupgrades.

2. Regenerate the system-wide texmf.cnf

root #texmf-update

3. Regenerate .fmt files

root #fmtutil-sys --all

External resources