Guix provides packages for the TeX, LaTeX, ConTeXt, LuaTeX, and related typesetting systems, taken from the TeX Live distribution. However, because TeX Live is so huge and because finding your way in this maze is tricky, we thought that you, dear user, would welcome guidance on how to deploy the relevant packages so you can compile your TeX and LaTeX documents.
TeX Live currently comes in two flavors in Guix:
texlivepackage: it comes with every single TeX Live package (more than 7,000 of them), but it is huge (more than 4 GiB for a single package!).
texlive-packages: you install
texlive-base, which provides core functionality and the main commands—
mf, etc.—together with individual packages that provide just the features you need—
texlive-pgffor PGF/TikZ, and so on.
We recommend using the modular package set because it is much less resource-hungry. To build your documents, you would use commands such as:
guix shell texlive-base texlive-wrapfig \ texlive-hyperref texlive-cm-super -- pdflatex doc.tex
You can quickly end up with unreasonably long command lines though. The solution is to instead write a manifest, for example like this one:
(specifications->manifest '("rubber" "texlive-base" "texlive-wrapfig" "texlive-microtype" "texlive-listings" "texlive-hyperref" ;; PGF/TikZ "texlive-pgf" ;; Additional fonts. "texlive-cm-super" "texlive-amsfonts" "texlive-times" "texlive-helvetic" "texlive-courier"))
You can then pass it to any command with the -m option:
guix shell -m manifest.scm -- pdflatex doc.tex
See Writing Manifests, for more on manifests. In the future, we plan to
provide packages for TeX Live collections—“meta-packages” such
provide the set of packages needed in this particular domain. That will
allow you to list fewer packages.
The main difficulty here is that using the modular package set forces you to
select precisely the packages that you need. You can use
search, but finding the right package can prove to be tedious. When a
package is missing,
pdflatex and similar commands fail with an
obscure message along the lines of:
doc.tex: File `tikz.sty' not found. doc.tex:7: Emergency stop.
or, for a missing font:
kpathsea: Running mktexmf phvr7t ! I can't find file `phvr7t'.
How do you determine what the missing package is? In the first case, you’ll find the answer by running:
$ guix search texlive tikz name: texlive-pgf version: 59745 …
In the second case,
guix search turns up nothing. Instead, you
can search the TeX Live package database using the
$ guix shell texlive-base -- tlmgr info phvr7t tlmgr: cannot find package phvr7t, searching for other matches: Packages containing `phvr7t' in their title/description: Packages containing files matching `phvr7t': helvetic: texmf-dist/fonts/tfm/adobe/helvetic/phvr7t.tfm texmf-dist/fonts/tfm/adobe/helvetic/phvr7tn.tfm texmf-dist/fonts/vf/adobe/helvetic/phvr7t.vf texmf-dist/fonts/vf/adobe/helvetic/phvr7tn.vf tex4ht: texmf-dist/tex4ht/ht-fonts/alias/adobe/helvetic/phvr7t.htf
The file is available in the TeX Live
helvetic package, which is
known in Guix as
texlive-helvetic. Quite a ride, but we found it!
There is one important limitation though: Guix currently provides a subset of the TeX Live packages. If you stumble upon a missing package, you can try and import it (see 调用guix import):
guix import texlive package
注: TeX Live packaging is still very much work in progress, but you can help! See 贡献, for more information.