Subject: bug#56556: TeXlive packaging issues

From: Emmanuel Beffara <[email-masked]>
Date: Tue, 28 Mar 2023 21:30:44 +0200

Hello Guix,

I would like to share a few thoughts on how TeXlive is currently handled in
Guix. The package `texlive` contains all of TeXlive, it works fine but it is
arguably too big to be practical. The documentation rightfully says

> We recommend using the modular package set because it is much less
> resource-hungry. 

Yet assembling modular sets is problematic for various reasons.

Firstly, unless I am missing something, creating a manifest with the right set
of packages is tedious: one has to guess the Guix package that matches each
LaTeX package, and the correspondence is not obvious. Thankfully, with a
working installation, `tlmgr show something.sty` helps finding the TeXlive
package that contains the file and `guix search texlive something` finds the
corresponding Guix package if there is one (it could be named
`texlive-something` or `texlive-latex-something`, this feels somewhat
inconsistent). When trying to compile a complex document, doing that for every
package and dependency is time-consuming (compile, read compilation errors,
install more packages, restart).

Secondly, many packages are missing. Apparently, `(gnu packages tex)` contains
an arbitrary set of common packages, likely defined by people who needed them
and had the skill to produce a patch for them. It is fairly easy to produce
new definitions using `guix import texlive something` and adjusting the
result, still it feels more complicated than it ought to be. Considering how
well TeXlive is organized, it should be possible to automatically extract the
set of all packages in a given release and turn the result into a big
comprehensive Guile module.

Besides, importing TeXlive "collections" could be a useful intermediate
between taking the whole system and picking packages individually.

Thirdly, formats are apparently not handled right. The main issue is with
hyphenation (hence the cc on an open issue): hyphenation patterns need to be
compiled into the formats to be available in documents, so the format files
should be built depending on which `texlive-hyphen-something` packages are
installed. Currently this is not the case:

```
$ guix shell --pure coreutils texlive-base texlive-latex-base -- /bin/sh -c 'realpath $GUIX_TEXMF/web2c/pdflatex.fmt'
/gnu/store/m1vh5mm4gjlqzaylfxmxbx5g3j20k8wn-texlive-latex-base-59745/share/texmf-dist/web2c/pdflatex.fmt
$ guix shell --pure coreutils texlive-base texlive-latex-base texlive-hyphen-base texlive-hyphen-french -- /bin/sh -c 'realpath $GUIX_TEXMF/web2c/pdflatex.fmt'
/gnu/store/m1vh5mm4gjlqzaylfxmxbx5g3j20k8wn-texlive-latex-base-59745/share/texmf-dist/web2c/pdflatex.fmt
```

If the format is always the same, then no modular installation can do any
hyphenation, as reported in https://issues.guix.gnu.org/56556. There might be
other things than hyphenation that require similar treatment.

That said, I don't know what would be the best way to contribute.

-- 
Emmanuel