gnu: Add texlive-hyphen-portuguese.
[jackhill/guix/guix.git] / gnu / packages / tex.scm
index a1caac0..aea120d 100644 (file)
@@ -3,13 +3,13 @@
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
-;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
   #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:hide (zip)))
 
+(define* (simple-texlive-package name locations hash
+                                 #:key trivial?)
+  "Return a template for a simple TeX Live package with the given NAME,
+downloading from a list of LOCATIONS in the TeX Live repository, and expecting
+the provided output HASH.  If TRIVIAL? is provided, all files will simply be
+copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used."
+  (define with-documentation?
+    (and trivial?
+         (any (lambda (location)
+                (string-prefix? "/doc" location))
+              locations)))
+  (package
+    (name name)
+    (version (number->string %texlive-revision))
+    (source (texlive-origin name version
+                            locations hash))
+    (outputs (if with-documentation?
+                 '("out" "doc")
+                 '("out")))
+    (build-system (if trivial?
+                      gnu-build-system
+                      texlive-build-system))
+    (arguments
+     (let ((copy-files
+            `(lambda* (#:key outputs inputs #:allow-other-keys)
+               (let (,@(if with-documentation?
+                           `((doc (string-append (assoc-ref outputs "doc")
+                                                 "/share/texmf-dist/")))
+                           '())
+                     (out (string-append (assoc-ref outputs "out")
+                                         "/share/texmf-dist/")))
+                 ,@(if with-documentation?
+                       '((mkdir-p doc)
+                         (copy-recursively
+                          (string-append (assoc-ref inputs "source") "/doc")
+                          (string-append doc "/doc")))
+                       '())
+                 (mkdir-p out)
+                 (copy-recursively (assoc-ref inputs "source") out)
+                 ,@(if with-documentation?
+                       '((delete-file-recursively (string-append out "/doc")))
+                       '())
+                 #t))))
+       (if trivial?
+           `(#:tests? #f
+             #:phases
+             (modify-phases %standard-phases
+               (delete 'configure)
+               (replace 'build (const #t))
+               (replace 'install ,copy-files)))
+           `(#:phases
+             (modify-phases %standard-phases
+               (add-after 'install 'copy-files ,copy-files))))))
+    (home-page #f)
+    (synopsis #f)
+    (description #f)
+    (license #f)))
+
+(define hyph-utf8-scripts
+  (origin
+    (method svn-fetch)
+    (uri (texlive-ref "generic" "hyph-utf8"))
+    (file-name (string-append "hyph-utf8-scripts-"
+                              (number->string %texlive-revision)
+                              "-checkout"))
+    (sha256
+     (base32
+      "1ix8h637hwhz4vrdhilf84kzzdza0wi8fp26nh7iws0bq08sl517"))))
+
+(define (texlive-hyphen-package name code locations hash)
+  (let ((parent (simple-texlive-package
+                 name locations hash #:trivial? #t)))
+    (package
+      (inherit parent)
+      (arguments
+       (substitute-keyword-arguments (package-arguments parent)
+         ((#:modules _ '())
+          '((guix build gnu-build-system)
+            (guix build utils)
+            (ice-9 match)))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (replace 'build
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (root (string-append out "/share/texmf-dist"))
+                        (patterns
+                         (string-append root "/tex/generic/hyph-utf8/patterns/txt/"))
+                        (loaders
+                         (string-append root "/tex/generic/hyph-utf8/loadhyph"))
+                        (ptex
+                         (string-append root "/tex/generic/hyph-utf8/patterns/ptex"))
+                        (filter-expression
+                         (match ',code
+                           ((? string?)
+                            (format #f "\nlanguages.select!{|l| l.code == \"~a\"}\n" ',code))
+                           ((a b ...)
+                            (format #f "\nlanguages.select!{|l| [~{\"~a\",~}].include? l.code }\n" ',code)))))
+                   (mkdir "scripts")
+                   (copy-recursively
+                    (assoc-ref inputs "hyph-utf8-scripts") "scripts")
+
+                   ;; Prepare target directories
+                   (mkdir-p patterns)
+                   (mkdir-p loaders)
+                   (mkdir-p ptex)
+
+                   ;; Generate plain patterns
+                   (with-directory-excursion "scripts"
+                     (substitute* "languages.rb"
+                       (("../../../tex/generic/") "../tex/generic/"))
+                     (substitute* "generate-plain-patterns.rb"
+                       ;; Ruby 2 does not need this.
+                       (("require 'unicode'") "")
+                       (("Unicode.upcase\\(ch\\)") "ch.upcase")
+                       ;; Write directly to the output directory
+                       (("\\$path_root=File.*")
+                        (string-append "$path_root=\"" out "/share/texmf-dist/\"\n"))
+                       ;; Create quote directory when needed
+                       (("f = File.open\\(\"#\\{\\$path_quote\\}" m)
+                        (string-append "require 'fileutils'; FileUtils.mkdir_p $path_quote;" m))
+                       ;; Only generate patterns for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-plain-patterns.rb")
+
+                     ;; Build pattern loaders
+                     (substitute* "generate-pattern-loaders.rb"
+                       (("\\$path_tex_generic=File.*")
+                        (string-append "$path_tex_generic=\"" root "/tex/generic\"\n"))
+                       ;; Only generate loader for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-pattern-loaders.rb")
+
+                     ;; Build ptex patterns
+                     (substitute* "generate-ptex-patterns.rb"
+                       (("\\$path_root=File.*")
+                        (string-append "$path_root=\"" root "\"\n"))
+                       ;; Only generate ptex patterns for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-ptex-patterns.rb")))))))))
+      (native-inputs
+       `(("ruby" ,ruby)
+         ("hyph-utf8-scripts" ,hyph-utf8-scripts)))
+      (home-page "https://ctan.org/pkg/hyph-utf8"))))
+
 (define texlive-extra-src
   (origin
     (method url-fetch)
        (base32
         "0khyi6h015r2zfqgg0a44a2j7vmr1cy42knw7jbss237yvakc07y"))
       (patches
-       (list
-        ;; This is required for compatibility with Poppler 0.64.0 and to fix a
-        ;; segmentation fault in dvipdfm-x from XeTeX.
-        (origin
-          (method url-fetch)
-          (uri (string-append "http://www.linuxfromscratch.org/patches/blfs/"
-                              "svn/texlive-" version "-source-upstream_fixes-1.patch"))
-          (file-name "texlive-poppler-compat.patch")
-          (sha256
-           (base32
-            "0f8vhyj167y4xj0jx47vkybrcacfpxw0wdn1b777yq3xmhlahhlg")))))))
+       (let ((arch-patch
+              (lambda (name revision hash)
+                (origin
+                  (method url-fetch)
+                  (uri (string-append "https://git.archlinux.org/svntogit/packages.git"
+                                      "/plain/trunk/" name "?h=packages/texlive-bin"
+                                      "&id=" revision))
+                  (file-name (string-append "texlive-bin-" name))
+                  (sha256 (base32 hash)))))
+             (arch-revision "e1975bce0b9d270d7c9773c5beb7e87d61ee8f57"))
+         (append (search-patches  "texlive-bin-CVE-2018-17407.patch"
+                                  "texlive-bin-luatex-poppler-compat.patch")
+                 (list
+                  (arch-patch "pdftex-poppler0.72.patch" arch-revision
+                              "0p46b6xxxg2s3hx67r0wpz16g3qygx65hpc581xs3jz5pvsiq3y7")
+                  (arch-patch "xetex-poppler-fixes.patch" arch-revision
+                              "1jj1p5zkjljb7id9pjv29cw0cf8mwrgrh4ackgzz9c200vaqpsvx")))))))
    (build-system gnu-build-system)
    (inputs
     `(("texlive-extra-src" ,texlive-extra-src)
           ;; ps2eps.pl uses the "gswin32c" ghostscript executable on Windows,
           ;; and the "gs" ghostscript executable on Unix. It detects Unix by
           ;; checking for the existence of the /usr/bin directory. Since
-          ;; GuixSD does not have /usr/bin, it is also detected as Windows.
+          ;; Guix System does not have /usr/bin, it is also detected as Windows.
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "utils/ps2eps/ps2eps-src/bin/ps2eps.pl"
               (("gswin32c") "gs"))
             #t))
         (add-after 'unpack 'use-code-for-new-poppler
           (lambda _
-            (copy-file "texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc"
+            (copy-file "texk/web2c/pdftexdir/pdftoepdf-poppler0.72.0.cc"
                        "texk/web2c/pdftexdir/pdftoepdf.cc")
-            (copy-file "texk/web2c/pdftexdir/pdftosrc-newpoppler.cc"
+            (copy-file "texk/web2c/pdftexdir/pdftosrc-poppler0.72.0.cc"
                        "texk/web2c/pdftexdir/pdftosrc.cc")
             #t))
         (add-after 'unpack 'disable-failing-test
@@ -257,99 +411,16 @@ This package contains the binaries.")
    (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
    (home-page "https://www.tug.org/texlive/")))
 
-(define-public texlive-dvips
-  (package
-    (name "texlive-dvips")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/dvips"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1ky6wc173jhf0b33lhyb4r3bx1d4bmiqkn6y1hxn92kwjdzl42p7"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let* ((root (string-append (assoc-ref %outputs "out")
-                                     "/share/texmf-dist"))
-                (dvips (string-append root "/dvips"))
-                (maps  (string-append root "/fonts/map/dvips"))
-                (encs  (string-append root "/fonts/enc/dvips/base")))
-           (mkdir-p dvips)
-           (copy-recursively (assoc-ref %build-inputs "source") dvips)
-           (mkdir-p maps)
-           (copy-recursively (assoc-ref %build-inputs "dvips-font-maps") maps)
-           (mkdir-p encs)
-           (copy-recursively (assoc-ref %build-inputs "dvips-base-enc") encs)
-           #t))))
-    (native-inputs
-     `(("dvips-font-maps"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/map/dvips"))
-                 (revision %texlive-revision)))
-           (file-name (string-append "dvips-font-maps-" version "-checkout"))
-           (sha256
-            (base32
-             "0nxvfbb5vsvakiw0iviicghdc2sxk05cj056ilqnpa62fffc36a6"))))
-       ("dvips-base-enc"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/enc/dvips/base"))
-                 (revision %texlive-revision)))
-           (file-name (string-append "dvips-base-enc-" version "-checkout"))
-           (sha256
-            (base32
-             "1xnf6ms0h87r55kxik4vicwr1907scj789lhqflqns8svvsli5iy"))))))
-    (home-page "https://www.ctan.org/pkg/dvips")
-    (synopsis "DVI to PostScript drivers")
-    (description "This package provides files needed for converting DVI files
-to PostScript.")
-    ;; Various free software licenses apply to individual files.
-    (license (list license:lppl1.3c+
-                   license:expat
-                   license:lgpl3+))))
-
-(define-public texlive-generic-unicode-data
+\f
+(define-public texlive-unicode-data
   (package
-    (name "texlive-generic-unicode-data")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/unicode-data"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "0r1v16jyfpz6dwqsgm6b9jcj4kf2pkzc9hg07s6fx9g8ba8qglih"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/unicode-data")))
-             (mkdir-p target)
-             (copy-recursively (assoc-ref %build-inputs "source") target)
-             #t))))
+    (inherit (simple-texlive-package
+              "texlive-unicode-data"
+              (list "/tex/generic/unicode-data/"
+                    "/doc/generic/unicode-data/")
+              (base32
+               "1j63kz29arfiydb8r1a53q1r4zyk1yjbcq0w9i93zddczgqzgbfb")
+              #:trivial? #t))
     (home-page "https://www.ctan.org/pkg/unicode-data")
     (synopsis "Unicode data and loaders for TeX")
     (description "This bundle provides generic access to Unicode Consortium
@@ -363,68 +434,63 @@ set up and one for initializing XeTeX character classes as has been carried
 out to date by @code{unicode-letters.tex}. ")
     (license license:lppl1.3c+)))
 
-(define-public texlive-generic-dehyph-exptl
+(define-public texlive-generic-unicode-data
+  (deprecated-package "texlive-generic-unicode-data" texlive-unicode-data))
+
+(define-public texlive-hyphen-base
+  (package
+    (inherit (simple-texlive-package
+              "texlive-hyphen-base"
+              (list "/tex/generic/config/language.dat"
+                    "/tex/generic/config/language.dat.lua"
+                    "/tex/generic/config/language.def"
+                    "/tex/generic/config/language.us"
+                    "/tex/generic/config/language.us.def"
+                    "/tex/generic/config/language.us.lua"
+                    "/tex/generic/hyphen/dumyhyph.tex"
+                    "/tex/generic/hyphen/hyphen.tex"
+                    "/tex/generic/hyphen/hypht1.tex"
+                    "/tex/generic/hyphen/zerohyph.tex")
+              (base32
+               "002g5zhzbj3ikgg8zidagdp605ac9f4qmfl148mp0mbpz1svk0ni")
+              #:trivial? #t))
+    (home-page "https://tug.org/texlive/")
+    (synopsis "Core hyphenation support files")
+    (description "This package includes Knuth's original @file{hyphen.tex},
+@file{zerohyph.tex} to disable hyphenation, @file{language.us} which starts
+the autogenerated files @file{language.dat} and @file{language.def} (and
+default versions of those), etc.")
+    (license license:knuth)))
+
+;; TODO: This package should not exist.  There should not be a single package
+;; containing all of /dvips.  These really belong to different packages.
+(define-public texlive-dvips
   (package
-    (name "texlive-generic-dehyph-exptl")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/dehyph-exptl"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "03yj1di9py92drp6gpfva6q69vk2iixr79r7cp7ja570s3pr0m33"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/dehyph-exptl")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
-    (home-page "http://projekte.dante.de/Trennmuster/WebHome")
-    (synopsis "Hyphenation patterns for German")
-    (description "The package provides experimental hyphenation patterns for
-the German language, covering both traditional and reformed orthography.  The
-patterns can be used with packages Babel and hyphsubst from the Oberdiek
-bundle.")
-    ;; Hyphenation patterns are under the Expat license; documentation is
-    ;; under LPPL.
-    (license (list license:expat license:lppl))))
+    (inherit (simple-texlive-package
+              "texlive-dvips"
+              (list "/fonts/map/dvips/"
+                    "/fonts/enc/dvips/base/"
+                    "/dvips/")
+              (base32
+               "1di07wx8wjczddmagq5z082l2has3inzk5jwkqh4i6wv1qdfqpp6")
+              #:trivial? #t))
+    (home-page "https://www.ctan.org/pkg/dvips")
+    (synopsis "DVI to PostScript drivers")
+    (description "This package provides files needed for converting DVI files
+to PostScript.")
+    ;; Various free software licenses apply to individual files.
+    (license (list license:lppl1.3c+
+                   license:expat
+                   license:lgpl3+))))
 
-(define-public texlive-generic-tex-ini-files
+(define-public texlive-tex-ini-files
   (package
-    (name "texlive-generic-tex-ini-files")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/tex-ini-files"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1wh42n1lmzcvi3g6mm31nm3yd5ha5bl260xqc444jg1m9fdp3wz5"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/tex-ini-files")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
+    (inherit (simple-texlive-package
+              "texlive-tex-ini-files"
+              (list "/tex/generic/tex-ini-files/")
+              (base32
+               "0q1g62jg0qiqslm93ycvm30bw8ydmssjdshzsnzl7n2vpd62qfi2")
+              #:trivial? #t))
     (home-page "https://www.ctan.org/pkg/tex-ini-files")
     (synopsis "Files for creating TeX formats")
     (description "This bundle provides a collection of model \".ini\" files
@@ -434,62 +500,8 @@ allow existing format source files to be used with newer engines, for example
 to adapt the plain e-TeX source file to work with XeTeX and LuaTeX.")
     (license license:public-domain)))
 
-(define-public texlive-generic-hyph-utf8
-  (package
-    (name "texlive-generic-hyph-utf8")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/hyph-utf8"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1alnn9cd60m2c12vym9f9q22ap1ngywxpkjl9dk472why44g1dmy"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/hyph-utf8")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
-    (home-page "https://ctan.org/pkg/hyph-utf8")
-    (synopsis "Hyphenation patterns expressed in UTF-8")
-    (description "Modern native UTF-8 engines such as XeTeX and LuaTeX need
-hyphenation patterns in UTF-8 format, whereas older systems require
-hyphenation patterns in the 8-bit encoding of the font in use (such encodings
-are codified in the LaTeX scheme with names like OT1, T2A, TS1, OML, LY1,
-etc).  The present package offers a collection of conversions of existing
-patterns to UTF-8 format, together with converters for use with 8-bit fonts in
-older systems.  Since hyphenation patterns for Knuthian-style TeX systems are
-only read at iniTeX time, it is hoped that the UTF-8 patterns, with their
-converters, will completely supplant the older patterns.")
-    ;; Individual files each have their own license.  Most of these files are
-    ;; independent hyphenation patterns.
-    (license (list license:lppl1.0+
-                   license:lppl1.2+
-                   license:lppl1.3
-                   license:lppl1.3+
-                   license:lppl1.3a+
-                   license:lgpl2.1
-                   license:lgpl2.1+
-                   license:lgpl3+
-                   license:gpl2+
-                   license:gpl3+
-                   license:mpl1.1
-                   license:asl2.0
-                   license:expat
-                   license:bsd-3
-                   license:cc0
-                   license:public-domain
-                   license:wtfpl2))))
+(define-public texlive-generic-tex-ini-files
+  (deprecated-package "texlive-generic-tex-ini-files" texlive-tex-ini-files))
 
 (define-public texlive-metafont-base
   (package
@@ -543,6 +555,42 @@ converters, will completely supplant the older patterns.")
 build fonts using the Metafont system.")
     (license license:knuth)))
 
+(define-public texlive-tex-fontinst-base
+  (package
+    (name "texlive-tex-fontinst-base")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/tex/fontinst/base"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "12gnb8hc45p47pqn31msvi4mpr3wxbbbf2k4xhmshjqykwzlx508"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((target (string-append (assoc-ref %outputs "out")
+                                      "/share/texmf-dist/tex/fontinst/base")))
+           (mkdir-p target)
+           (copy-recursively (assoc-ref %build-inputs "source") target)
+           #t))))
+    (home-page "https://www.ctan.org/pkg/fontinst")
+    (synopsis "Tools for converting and installing fonts for TeX and LaTeX")
+    (description "This package provides TeX macros for converting Adobe Font
+Metric files to TeX metric and virtual font format.  Fontinst helps mainly
+with the number crunching and shovelling parts of font installation.  This
+means in practice that it creates a number of files which give the TeX
+metrics (and related information) for a font family that TeX needs to do any
+typesetting in these fonts.")
+    (license license:lppl1.1+)))
+
 (define-public texlive-fontname
   (package
     (name "texlive-fontname")
@@ -579,19 +627,15 @@ documents.")
 
 (define-public texlive-fonts-cm
   (package
-    (name "texlive-fonts-cm")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/fonts/source/public/cm"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "0vfjhidr9pha613h8mfhnpcpvld6ahdfb449918fpsfs93cppkyj"))))
+    (inherit (simple-texlive-package
+              "texlive-fonts-cm"
+              (list "/fonts/source/public/cm/"
+                    "/fonts/map/dvips/cm/cmtext-bsr-interpolated.map"
+                    "/doc/fonts/cm/README"
+                    "/doc/fonts/cm/README-cmps.txt")
+              (base32
+               "1h0q71paqmg1xjg6k35ni2i6m93kmlq9rdwm913xg9n4qngywl18")))
+    (outputs '("out" "doc"))
     (build-system gnu-build-system)
     (arguments
      `(#:modules ((guix build gnu-build-system)
@@ -609,58 +653,57 @@ documents.")
                (setenv "MFBASES" (string-append mf "/share/texmf-dist/web2c"))
                ;; Tell mf where to look for source files
                (setenv "MFINPUTS"
-                       (string-append (getcwd) ":"
+                       (string-append (getcwd) "/fonts/source/public/cm/:"
                                       mf "/share/texmf-dist/metafont/base")))
-             (mkdir "build")
-             (mkdir-p "pk/ljfour/public/cm/dpi600")
-             (for-each (lambda (font)
-                         (format #t "building font ~a\n" font)
-                         (invoke "mf" "-progname=mf"
-                                 "-output-directory=build"
-                                 (string-append "\\"
-                                                "mode:=ljfour; "
-                                                "mag:=1+0/600; "
-                                                "batchmode; "
-                                                "input "
-                                                (basename font ".mf")))
-                         (invoke "gftopk"
-                                 (string-append "build/"
-                                                (basename font ".mf") ".600gf")
-                                 (string-append "pk/ljfour/public/cm/dpi600/"
-                                                (basename font ".mf") ".pk")))
-                       (find-files "." "cm(.*[0-9]+.*|inch)\\.mf$"))
+             (for-each make-file-writable
+                       (cons "fonts/source/public/cm/"
+                             (find-files "fonts/source/public/cm/" ".*")))
+             (let ((build (string-append (getcwd) "/build"))
+                   (pkdir (string-append (getcwd) "/pk/ljfour/public/cm/dpi600")))
+               (mkdir-p pkdir)
+               (mkdir-p build)
+               (with-directory-excursion "fonts/source/public/cm/"
+                 (for-each (lambda (font)
+                             (format #t "building font ~a\n" font)
+                             (invoke "mf" "-progname=mf"
+                                     (string-append "-output-directory=" build)
+                                     (string-append "\\"
+                                                    "mode:=ljfour; "
+                                                    "mag:=1+0/600; "
+                                                    "scrollmode; "
+                                                    "input "
+                                                    (basename font ".mf")))
+                             (invoke "gftopk"
+                                     (string-append build "/"
+                                                    (basename font ".mf") ".600gf")
+                                     (string-append pkdir "/"
+                                                    (basename font ".mf") ".pk")))
+                           (find-files "." "cm(.*[0-9]+.*|inch)\\.mf$"))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out   (assoc-ref outputs "out"))
-                    (fonts (string-append out "/share/texmf-dist/fonts/"))
-                    (pk    (string-append fonts "pk"))
-                    (tfm   (string-append fonts "tfm/public/cm"))
-                    (mf    (string-append fonts "source/public/cm"))
-                    (type1 (string-append fonts "type1/public/amsfonts/cm")))
+             (let* ((out    (assoc-ref outputs "out"))
+                    (doc    (assoc-ref outputs "doc"))
+                    (source (assoc-ref inputs "source"))
+                    (fonts  (string-append out "/share/texmf-dist/fonts/"))
+                    (pk     (string-append fonts "pk"))
+                    (tfm    (string-append fonts "tfm/public/cm"))
+                    (mf     (string-append fonts "source/public/cm")))
                (for-each (cut install-file <> tfm)
                          (find-files "build" "\\.*"))
                (for-each (cut install-file <> mf)
                          (find-files "." "\\.mf"))
                (copy-recursively "pk" pk)
-               (mkdir-p type1)
-               (copy-recursively (assoc-ref inputs "cm-type1") type1)
+               (copy-recursively
+                (string-append source "/doc")
+                (string-append doc "/doc"))
+               (install-file
+                (string-append source "/fonts/map/dvips/cm/cmtext-bsr-interpolated.map")
+                (string-append fonts "/map/dvips/cm/cmtext-bsr-interpolated.map"))
                #t))))))
     (native-inputs
      `(("texlive-bin" ,texlive-bin)
-       ("texlive-metafont-base" ,texlive-metafont-base)
-       ("cm-type1"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/type1/public/amsfonts/cm"))
-                 (revision %texlive-revision)))
-           (file-name (string-append name "-type1-" version "-checkout"))
-           (sha256
-            (base32
-             "12jyl9jp3hidifa4l5pmi47p71d5mb5kj5rknxkygilix8yz2iy6"))))))
+       ("texlive-metafont-base" ,texlive-metafont-base)))
     (home-page "https://www.ctan.org/pkg/cm")
     (synopsis "Computer Modern fonts for TeX")
     (description "This package provides the Computer Modern fonts by Donald
@@ -852,13 +895,17 @@ Computers & Typesetting series.")
                        (string-append (getcwd) ":"
                                       mf "/share/texmf-dist/metafont/base")))
              (mkdir "build")
-             (invoke "mf" "-progname=mf"
-                     "-output-directory=build"
-                     (string-append "\\"
-                                    "mode:=ljfour; "
-                                    "mag:=1; "
-                                    "batchmode; "
-                                    "input manfnt"))))
+             (for-each (lambda (font)
+                         (format #t "building font ~a\n" font)
+                         (invoke "mf" "-progname=mf"
+                                 "-output-directory=build"
+                                 (string-append "\\"
+                                                "mode:=ljfour; "
+                                                "mag:=1; "
+                                                "batchmode; "
+                                                "input " font)))
+                       (find-files "." "(manfnt|logo.+)\\.mf$"))
+             #t))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -957,11 +1004,103 @@ class), line and circle fonts (for use in the picture environment) and LaTeX
 symbol fonts.")
     (license license:lppl1.2+)))
 
-(define-public texlive-fonts-amsfonts
+(define-public texlive-latex-mflogo
   (package
-    (name "texlive-fonts-amsfonts")
+    (name "texlive-latex-mflogo")
     (version (number->string %texlive-revision))
-    (source (origin
+    (source
+     (origin
+       (method svn-fetch)
+       (uri (texlive-ref "latex" "mflogo"))
+       (sha256
+        (base32
+         "15i2ib6nvhf31g1b92c6njf7n0g29znlq7hbfp9ii7qabhcwwvrj"))))
+    (build-system texlive-build-system)
+    (arguments '(#:tex-directory "latex/mflogo"))
+    (home-page "http://www.ctan.org/pkg/mflogo")
+    (synopsis "LaTeX support for Metafont logo fonts")
+    (description
+     "This package provides LaTeX and font definition files to access the
+Knuthian mflogo fonts described in The Metafontbook and to typeset Metafont
+logos in LaTeX documents.")
+    (license license:lppl)))
+
+(define-public texlive-fonts-mflogo-font
+  (package
+    (name "texlive-fonts-mflogo-font")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/fonts/type1/hoekwater/mflogo-font"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "09fsxfpiyxjljkrb52b197728bjnkcnv3bdwm4hl6hf23mbmqadf"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils)
+                  (ice-9 match))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match))
+         (let ((root (string-append (assoc-ref %outputs "out")
+                                    "/share/texmf-dist/"))
+               (pkgs '(("source"    . "fonts/type1/hoekwater/mflogo-font")
+                       ("afm"       . "fonts/afm/hoekwater/mflogo-font")
+                       ("fonts-map" . "fonts/map/dvips/mflogo-font"))))
+           (for-each (match-lambda
+                       ((pkg . dir)
+                        (let ((target (string-append root dir)))
+                          (mkdir-p target)
+                          (copy-recursively (assoc-ref %build-inputs pkg)
+                                            target))))
+                     pkgs)
+           #t))))
+    (native-inputs
+     `(("afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/hoekwater/mflogo-font"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0bx1mfhhzsk9gj1pha36q2rk0jd0y285qm62zgvdvzzzlfnk8sdb"))))
+       ("fonts-map"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/map/dvips/mflogo-font/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-fonts-map-" version "-checkout"))
+           (sha256
+            (base32
+             "044xrrpl8hnvj55cx2ql1ib1bcyr33nzanx5nkwxpai7fb7pg4y6"))))))
+    (home-page "https://www.ctan.org/pkg/mflogo-font")
+    (synopsis "Metafont logo font")
+    (description
+     "These fonts were created in METAFONT by Knuth, for his own publications.
+At some stage, the letters P and S were added, so that the METAPOST logo could
+also be expressed.  The fonts were originally issued (of course) as METAFONT
+source; they have since been autotraced and reissued in Adobe Type 1 format by
+Taco Hoekwater.")
+    (license license:knuth)))
+
+(define-public texlive-fonts-amsfonts
+  (package
+    (name "texlive-fonts-amsfonts")
+    (version (number->string %texlive-revision))
+    (source (origin
               (method svn-fetch)
               (uri (svn-reference
                     (url (string-append "svn://www.tug.org/texlive/tags/"
@@ -976,6 +1115,7 @@ symbol fonts.")
     (arguments
      `(#:modules ((guix build gnu-build-system)
                   (guix build utils)
+                  (ice-9 match)
                   (srfi srfi-1)
                   (srfi srfi-26))
        #:tests? #f                      ; no tests
@@ -984,7 +1124,7 @@ symbol fonts.")
          (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((mf (assoc-ref inputs "texlive-metafont-base"))
+             (let ((mf (assoc-ref inputs "texlive-union"))
                    (cwd (getcwd)))
                ;; Make METAFONT reproducible
                (setenv "SOURCE_DATE_EPOCH" "1")
@@ -1014,24 +1154,112 @@ symbol fonts.")
                                                   (getcwd) "/"
                                                   (basename font ".mf")))))
                        (find-files "." "[0-9]+\\.mf$"))
+
+             ;; There are no metafont sources for the Euler fonts, so we
+             ;; convert the afm files instead.
+             (mkdir "build/euler")
+             (for-each (lambda (font)
+                         (format #t "converting afm font ~a\n" (basename font ".afm"))
+                         (invoke "afm2tfm" font
+                                 (string-append "build/euler/"
+                                                (basename font ".tfm"))))
+                       (find-files (assoc-ref inputs "amsfonts-afm")
+                                   "\\.afm$"))
+
+             ;; Frustratingly, not all fonts can be created this way.  To
+             ;; generate eufm8.tfm, for example, we first scale down
+             ;; eufm10.afm to eufm8.pl, and then generate the tfm file from
+             ;; the pl file.
+             (with-directory-excursion "build/euler"
+               (setenv "TEXINPUTS"
+                       (string-append (getcwd) "//:"
+                                      (assoc-ref inputs "amsfonts-afm") "//:"
+                                      (assoc-ref inputs "texlive-union") "//"))
+               (for-each (match-lambda
+                           (((target-base target-size)
+                             (source-base source-size))
+                            (let ((factor (number->string
+                                           (truncate/ (* 1000 target-size)
+                                                      source-size))))
+                              (invoke "tex"
+                                      "-interaction=scrollmode"
+                                      (string-append "\\input fontinst.sty "
+                                                     "\\transformfont{" target-base "}"
+                                                     "{\\scalefont{" factor "}"
+                                                     "{\\fromafm{" source-base "}}} "
+                                                     "\\bye")))
+                            (invoke "pltotf"
+                                    (string-append target-base ".pl")
+                                    (string-append target-base ".tfm"))
+                            (delete-file (string-append target-base ".pl"))))
+
+                         '((("eufm8" 8) ("eufm10" 10))
+
+                           (("eufb6" 6) ("eufb7" 7))
+                           (("eufb8" 8) ("eufb10" 10))
+                           (("eufb9" 9) ("eufb10" 10))
+
+                           (("eufm6" 6) ("eufb7" 7))
+                           (("eufm9" 9) ("eufb10" 10))
+
+                           (("eurb6" 6) ("eurb7" 7))
+                           (("eurb8" 8) ("eurb10" 10))
+                           (("eurb9" 9) ("eurb10" 10))
+
+                           (("eurm6" 6) ("eurm7" 7))
+                           (("eurm8" 8) ("eurm10" 10))
+                           (("eurm9" 9) ("eurm10" 10)))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (fonts (string-append out "/share/texmf-dist/fonts"))
-                    (tfm (string-append fonts "/tfm/public/amsfonts"))
-                    (mf  (string-append fonts "/source/public/amsfonts"))
-                    (type1 (string-append fonts "/type1/public/amsfonts")))
-               (for-each (cut install-file <> tfm)
-                         (find-files "build" "\\.*"))
-               (for-each (cut install-file <> mf)
-                         (find-files "." "\\.mf"))
-               (copy-recursively (assoc-ref inputs "amsfonts-type1") type1)
-               #t))))))
+             (let* ((out  (assoc-ref outputs "out"))
+                    (root (string-append out "/share/texmf-dist/fonts/"))
+                    (pkgs '(("amsfonts-afm"   . "afm/public/amsfonts")
+                            ("amsfonts-type1" . "type1/public/amsfonts")
+                            ("amsfonts-map"   . "map/dvips/amsfonts"))))
+               (for-each (match-lambda
+                           ((pkg . dir)
+                            (let ((target (string-append root dir)))
+                              (mkdir-p target)
+                              (copy-recursively (assoc-ref inputs pkg)
+                                                target))))
+                         pkgs)
+               (copy-recursively (assoc-ref inputs "amsfonts-plain")
+                                 (string-append out "/share/texmf-dist/tex/plain/amsfonts"))
+               (let* ((tfm (string-append root "tfm/public/amsfonts"))
+                      (mf  (string-append root "source/public/amsfonts")))
+                 (copy-recursively "build" tfm)
+                 (for-each (cut install-file <> mf)
+                           (find-files "." "\\.mf"))
+                 #t)))))))
     (native-inputs
-     `(("texlive-fonts-cm" ,texlive-fonts-cm)
-       ("texlive-metafont-base" ,texlive-metafont-base)
-       ("texlive-bin" ,texlive-bin)
+     `(("texlive-union" ,(texlive-union (list texlive-tex-fontinst-base
+                                              texlive-fonts-cm
+                                              texlive-metafont-base)))
+       ("amsfonts-plain"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/tex/plain/amsfonts"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-plain-" version "-checkout"))
+           (sha256
+            (base32
+             "1hi8c9rkfb6395sxf7fhkr91xygfg8am1hqij9g3h2c7qx3714qp"))))
+       ("amsfonts-map"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/map/dvips/amsfonts"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-map-" version "-checkout"))
+           (sha256
+            (base32
+             "1lrj3bd9ybj4aawzlygc6qvakbrwc5s0mc5n9rpic331frv3axfs"))))
        ("amsfonts-type1"
         ,(origin
            (method svn-fetch)
@@ -1043,7 +1271,19 @@ symbol fonts.")
            (file-name (string-append name "-type1-" version "-checkout"))
            (sha256
             (base32
-             "1zfz33vn6gm19njy74n8wmn7sljrimfhwns5z8qqhxqfh1g4qip2"))))))
+             "1zfz33vn6gm19njy74n8wmn7sljrimfhwns5z8qqhxqfh1g4qip2"))))
+       ("amsfonts-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/public/amsfonts"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "1fifzkaihmjgchnk7dmw0c23k0cz999dxnc78ivmqvgi1dhx0iv8"))))))
     (home-page "https://www.ctan.org/pkg/amsfonts")
     (synopsis "TeX fonts from the American Mathematical Society")
     (description
@@ -1083,6 +1323,26 @@ by the amsfonts package.  It provides @code{amsfonts.sty}, with names of
 individual symbols defined in @code{amssymb.sty}.")
     (license license:silofl1.1)))
 
+(define-public texlive-mkpattern
+  (package
+    (inherit (simple-texlive-package
+              "texlive-mkpattern"
+              (list "/doc/plain/mkpattern/README"
+                    "/doc/plain/mkpattern/mkpatdoc.tex"
+                    "/doc/plain/mkpattern/mkpatter.pdf"
+                    "/doc/plain/mkpattern/mkpattern-exmpl.tex"
+                    "/tex/plain/mkpattern/mkpatter.tex")
+              (base32
+               "0sxnkbcc802jl3fj56x9hvg978bpv15lhrwj0aykb4syq29l47ga")
+              #:trivial? #t))
+    (home-page "https://ctan.org/pkg/mkpattern")
+    (synopsis "Utility for making hyphenation patterns")
+    (description "Mkpattern is a general purpose program for the generation of
+hyphenation patterns, with definition of letter sets and template-like
+constructions.  It also provides an easy way to handle different input and
+output encodings, and features generation of clean UTF-8 patterns.")
+    (license license:lppl)))
+
 ;; This provides etex.src which is needed to build various formats, including
 ;; luatex.fmt and pdflatex.fmt
 (define-public texlive-tex-plain
@@ -1119,140 +1379,1012 @@ TeXbook, together with various supporting files (some also discussed in the
 book).")
     (license license:knuth)))
 
-(define-public texlive-latex-base
-  (let ((texlive-dir
-         (lambda (dir hash)
-           (origin
-             (method svn-fetch)
-             (uri (svn-reference
-                   (url (string-append "svn://www.tug.org/texlive/tags/"
-                                       %texlive-tag "/Master/texmf-dist/"
-                                       dir))
-                   (revision %texlive-revision)))
-             (file-name (string-append "texlive-generic-"
-                                       (last (string-split
-                                               (string-drop-right dir 1) #\/))
-                                       "-" (number->string %texlive-revision)
-                                       "-checkout"))
-             (sha256 (base32 hash))))))
+(define-public texlive-hyphen-afrikaans
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-afrikaans" "af"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-af.tex")
+              (base32
+               "1vb3jccqnn1pm0680yqx52kvz595fmxnwa0cbf8qman6zglsssiw")))
+    (synopsis "Hyphenation patterns for Afrikaans")
+    (description "The package provides hyphenation patterns for the Afrikaans
+language.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-ancientgreek
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-ancientgreek" "grc"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-grc.tex"
+                    "/tex/generic/hyphen/grahyph5.tex"
+                    "/tex/generic/hyphen/ibyhyph.tex")
+              (base32
+               "0kwrqsz7wdr1d9kylzwp60ka3wfbj8iad029k5h6y94nb86mf7zv")))
+    (synopsis "Hyphenation patterns for ancient Greek")
+    (description "The package provides hyphenation patterns for ancient
+Greek.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-armenian
+  (let ((template (texlive-hyphen-package
+                   "texlive-hyphen-armenian" "hy"
+                   (list "/source/generic/hyph-utf8/languages/hy/generate_patterns_hy.rb")
+                   (base32
+                    "0z666y580w1kpxssdanz67ykq257lf11a1mnp1jrn08zijvfrw9c"))))
     (package
-      (name "texlive-latex-base")
-      (version (number->string %texlive-revision))
-      (source (origin
-                (method svn-fetch)
-                (uri (texlive-ref "latex" "base"))
-                (file-name (string-append name "-" version "-checkout"))
-                (sha256
-                 (base32
-                  "17bqrzzjz16k52sc7ydl4vw7ddy2z3g0p1xsk2c35h1ynq9h3wwm"))))
-      (build-system gnu-build-system)
+      (inherit template)
       (arguments
-       `(#:modules ((guix build gnu-build-system)
-                    (guix build utils)
-                    (ice-9 match)
-                    (srfi srfi-1)
-                    (srfi srfi-26))
-         #:tests? #f                    ; no tests
-         #:phases
-         (modify-phases %standard-phases
-           (delete 'configure)
-           (replace 'build
-             (lambda* (#:key inputs #:allow-other-keys)
-               ;; Find required fonts
-               (setenv "TFMFONTS"
-                       (string-append (assoc-ref inputs "texlive-fonts-cm")
-                                      "/share/texmf-dist/fonts/tfm/public/cm:"
-                                      (assoc-ref inputs "texlive-fonts-latex")
-                                      "/share/texmf-dist/fonts/tfm/public/latex-fonts:"
-                                      (assoc-ref inputs "texlive-fonts-knuth-lib")
-                                      "/share/texmf-dist/fonts/tfm/public/knuth-lib"))
-               (setenv "TEXINPUTS"
-                       (string-append
-                        (getcwd) ":"
-                        (getcwd) "/build:"
-                        (string-join
-                         (map (match-lambda ((_ . dir) dir)) inputs)
-                         "//:")))
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda _
+                 (let ((target (string-append (getcwd)
+                                              "/tex/generic/hyph-utf8/patterns/tex")))
+                   (mkdir-p target)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/hy/"
+                     (substitute* "generate_patterns_hy.rb"
+                       (("\\$file = File.new.*")
+                        (string-append "$file = File.new(\"" target
+                                       "/hyph-hy.tex\",\"w\")\n")))
+                     (invoke "ruby" "generate_patterns_hy.rb"))
+                   #t)))
+             (add-after 'install 'install-hyph-hy.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (synopsis "Hyphenation patterns for Armenian")
+      (description "The package provides hyphenation patterns for the Armenian
+language.")
+      ;; Any version of the LGPL.
+      (license license:lgpl3+))))
+
+(define-public texlive-hyphen-basque
+  (let ((template (texlive-hyphen-package
+                    "texlive-hyphen-basque" "eu"
+                    (list "/source/generic/hyph-utf8/languages/eu/generate_patterns_eu.rb")
+                    (base32
+                     "1yhsbzf1g9dm70jfixsz51hsfvn26cwfkfxvhg7xv2piynr4v51l"))))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda _
+                 (let ((target (string-append (getcwd)
+                                              "/tex/generic/hyph-utf8/patterns/tex")))
+                   (mkdir-p target)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/eu/"
+                     (substitute* "generate_patterns_eu.rb"
+                       (("\\$file = File.new.*")
+                        (string-append "$file = File.new(\"" target
+                                       "/hyph-eu.tex\",\"w\")\n")))
+                     (invoke "ruby" "generate_patterns_eu.rb"))
+                   #t)))
+             (add-after 'install 'install-hyph-eu.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (synopsis "Hyphenation patterns for Basque")
+      (description "The package provides hyphenation patterns for the Basque
+language.")
+      ;; "Free for any purpose".
+      (license (license:fsf-free
+                "/source/generic/hyph-utf8/languages/eu/generate_patterns_eu.rb")))))
+
+(define-public texlive-hyphen-belarusian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-belarusian" "be"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-be.tex")
+              (base32
+               "1xvffph824rg43gi2xs3ny9gzlp708fyxj9zfhckmg8pzh9vv3n6")))
+    (synopsis "Hyphenation patterns for Belarusian")
+    (description "The package provides hyphenation patterns for the Belarusian
+language.")
+    (license license:expat)))
+
+(define-public texlive-hyphen-bulgarian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-bulgarian" "bg"
+              (list "/doc/generic/hyph-utf8/bg/azbukaExtended.pdf"
+                    "/doc/generic/hyph-utf8/bg/azbukaExtended.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-bg.tex")
+              (base32
+               "06dxkk9azsggbri04i6g62lswygzadsx3rpqvbyzvbxc5wxz1dj1")))
+    (synopsis "Hyphenation patterns for Bulgarian")
+    (description "The package provides hyphenation patterns for the Bulgarian
+language in T2A and UTF-8 encodings.")
+    (license (license:non-copyleft
+              "file:///tex/generic/hyph-utf8/patterns/tex/hyph-bg.tex"
+              "Ancestral BSD variant"))))
+
+(define-public texlive-hyphen-catalan
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-catalan" "ca"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-ca.tex")
+              (base32
+               "0cisx76jpw8kpd3an37m9h8ppiysnizgfzl48y9d9n3fvx8jyykb")))
+    (synopsis "Hyphenation patterns for Catalan")
+    (description "The package provides hyphenation patterns for Catalan in
+T1/EC and UTF-8 encodings.")
+    (license license:lppl1.0+)))
 
-               ;; Create an empty texsys.cfg, because latex.ltx wants to include
-               ;; it.  This file must exist and it's fine if it's empty.
-               (with-output-to-file "texsys.cfg"
-                 (lambda _ (format #t "%")))
+(define-public texlive-hyphen-chinese
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-chinese" "zh-latn-pinyin"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-zh-latn-pinyin.tex")
+              (base32
+               "07gbrn5fcl5d3hyg1zpai3zp1ggl73cmvpalwvh7ah313f57gjkk")))
+    (synopsis "Hyphenation patterns for unaccented Chinese pinyin")
+    (description "The package provides hyphenation patterns for unaccented
+Chinese pinyin T1/EC and UTF-8 encodings.")
+    (license license:gpl2+)))
 
-               (mkdir "build")
-               (mkdir "web2c")
-               (invoke "luatex" "-ini" "-interaction=batchmode"
-                       "-output-directory=build" "unpack.ins")
-               (invoke "tex" "-ini" "-interaction=batchmode"
-                       "-output-directory=web2c" "tex.ini")
-               ;; LaTeX, pdfetex/pdftex, and XeTeX require e-TeX, which
-               ;; is enabled only in extended mode (activated with a
-               ;; leading asterisk).  We should not use luatex here,
-               ;; because that would make the generated format files
-               ;; incompatible with any other TeX engine.
-               (for-each (lambda (format)
-                           (invoke "latex" "-ini" "-interaction=batchmode"
-                                   "-output-directory=web2c"
-                                   "-translate-file=cp227.tcx"
-                                   (string-append "*" format ".ini")))
-                         '("latex"
-                           "pdflatex"
-                           "pdfetex"))
-               (for-each (lambda (format)
-                           (invoke format "-ini" "-interaction=batchmode"
-                                   "-output-directory=web2c"
-                                   (string-append "*" format ".ini")))
-                         '("xetex"
-                           "xelatex"))
-               (for-each (lambda (format)
-                           (invoke "luatex" "-ini" "-interaction=batchmode"
-                                   "-output-directory=web2c"
-                                   (string-append format ".ini")))
-                         '("dviluatex" "dvilualatex" "luatex" "lualatex"))
-               #t))
-           (replace 'install
-             (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (target (string-append
-                               out "/share/texmf-dist/tex/latex/base"))
-                      (web2c (string-append
-                              out "/share/texmf-dist/web2c"))
-                      (support-files (assoc-ref inputs "texlive-latex-base-support-files")))
-                 (mkdir-p target)
-                 (mkdir-p web2c)
-                 (for-each delete-file (find-files "." "\\.(log|aux)$"))
-                 (for-each (cut install-file <> target)
-                           (find-files "build" ".*"))
-                 (for-each (cut install-file <> web2c)
-                           (find-files "web2c" ".*"))
-                 ;; pdftex is really just the same as pdfetex, but since it
-                 ;; doesn't have its own format file, we need to copy it.
-                 (copy-file "web2c/pdfetex.fmt"
-                            (string-append web2c "/pdftex.fmt"))
-                 ;; "source" is missing the support files as per doc/latex/base/manifest.txt.
-                 ;; FIXME: We are probably not packaging this right.
-                 (for-each (lambda (file)
-                             (install-file
-                              (string-append support-files "/" file)
-                              target))
-                           '("ltxguide.cls" "ltnews.cls" "minimal.cls" "idx.tex"
-                             "lablst.tex" "testpage.tex" "ltxcheck.tex"))
-                 ;; Install configurations
-                 (copy-recursively
-                  (assoc-ref inputs "texlive-latex-latexconfig")
-                  (string-append out "/share/texmf-dist/tex/latex/latexconfig"))
-                 (copy-recursively
-                  (assoc-ref inputs "texlive-generic-config")
-                  (string-append out "/share/texmf-dist/tex/generic/config"))
-                 (copy-recursively
-                  (assoc-ref inputs "texlive-generic-hyphen")
-                  (string-append out "/share/texmf-dist/tex/generic/hyphen"))
-                 (copy-recursively
-                  (assoc-ref inputs "texlive-generic-ruhyphen")
-                  (string-append out "/share/texmf-dist/tex/generic/ruhyphen"))
-                 (copy-recursively
-                  (assoc-ref inputs "texlive-generic-ukrhyph")
-                  (string-append out "/share/texmf-dist/tex/generic/ukrhyph"))
+(define-public texlive-hyphen-churchslavonic
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-churchslavonic" "cu"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-cu.tex")
+              (base32
+               "0xkqlz3ixyl4fxsnzrbxqrb82p0n67rhgpddbiyv3qwfnbr2b5a4")))
+    (synopsis "Hyphenation patterns for Church Slavonic")
+    (description "The package provides hyphenation patterns for Church
+Slavonic in UTF-8 encoding.")
+    (license license:expat)))
+
+(define-public texlive-hyphen-coptic
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-coptic" "cop"
+              (list "/tex/generic/hyph-utf8/patterns/tex-8bit/copthyph.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-cop.tex")
+              (base32
+               "07i03jpdfy4ip7zbg4gnk4hk8zwj8rlni9dgrb1p8mfw2w19d80c")))
+    (synopsis "Hyphenation patterns for Coptic")
+    (description "The package provides hyphenation patterns for Coptic in
+UTF-8 encoding as well as in ASCII-based encoding for 8-bit engines.")
+    ;; No explicit license declaration, so we use the project license.
+    (license license:lppl)))
+
+(define-public texlive-hyphen-croatian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-croatian" "hr"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-hr.tex")
+              (base32
+               "129nz2nqilyq2477n2clx20xfbxh1qxm69zg4n2f6c4d4a8711nc")))
+    (synopsis "Hyphenation patterns for Croatian")
+    (description "The package provides hyphenation patterns for Croatian in
+T1/EC and UTF-8 encodings.")
+    (license license:lppl1.0+)))
+
+(define-public texlive-hyphen-czech
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-czech" "cs"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-cs.tex")
+              (base32
+               "1k5516gbfp1d5p97j247byag9sdgds5zwc11bwxfk58i6zq1v0m6")))
+    (synopsis "Hyphenation patterns for Czech")
+    (description "The package provides hyphenation patterns for Czech in T1/EC
+and UTF-8 encodings.")
+    (license license:gpl2+)))
+
+(define-public texlive-hyphen-danish
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-danish" "da"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-da.tex")
+              (base32
+               "0zxzs1b1723mav76i0wiyq4w82x8715cykvwa2bc60ldc2amv0vs")))
+    (synopsis "Hyphenation patterns for Danish")
+    (description "The package provides hyphenation patterns for Danish in
+T1/EC and UTF-8 encodings.")
+    ;; Either LPPL 1.3 or later, or Expat
+    (license (list license:lppl1.3+ license:expat))))
+
+(define-public texlive-hyphen-dutch
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-dutch" "nl"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-nl.tex")
+              (base32
+               "0cq46cmgjc4y2x0xs9b0a5zca3jmszv4rkzmrhgjb5z2nm3xkrpi")))
+    (synopsis "Hyphenation patterns for Dutch")
+    (description "The package provides hyphenation patterns for Dutch in T1/EC
+and UTF-8 encodings.")
+    (license license:lppl1.0+)))
+
+(define-public texlive-hyphen-english
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-english" '("en-gb" "en-us")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-en-gb.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-en-us.tex")
+              (base32
+               "08hyih8hn2w2q12gc4zygz0ckbz00mkzzn9898z2bicky02zg3kc")))
+    (synopsis "Hyphenation patterns for American and British English")
+    (description "The package provides additional hyphenation patterns for
+American and British English in ASCII encoding.")
+    (license (license:non-copyleft
+              "file:///tex/generic/hyph-utf8/patterns/tex/hyph-en-us.tex"
+              "FSF all permissive license"))))
+
+(define-public texlive-hyphen-esperanto
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-esperanto" "eo"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-eo.tex")
+              (base32
+               "03xbjbzasznsyf4wd45bya6f4snfmzpdzg5zpvqj5q6gjykdg54k")))
+    (synopsis "Hyphenation patterns for Esperanto")
+    (description "The package provides hyphenation patterns for Esperanto ISO
+Latin 3 and UTF-8 encodings.")
+    (license license:lppl1.0+)))
+
+(define-public texlive-hyphen-estonian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-estonian" "et"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-et.tex")
+              (base32
+               "0idl6xajkkgxqngjn19jcfd29is5rhfn59v0z8h4sv8yjv6k934m")))
+    (synopsis "Hyphenation patterns for Estonian")
+    (description "The package provides hyphenation patterns for Estonian in
+T1/EC and UTF-8 encodings.")
+    ;; Dual licensed under either license.
+    (license (list license:lppl1.3+ license:expat))))
+
+(define-public texlive-hyphen-ethiopic
+  (let ((template (texlive-hyphen-package
+                   "texlive-hyphen-ethiopic" "mul-ethi"
+                   (list "/source/generic/hyph-utf8/languages/mul-ethi/generate_patterns_mul-ethi.lua")
+                   (base32
+                    "1dp5qn1mhv62kj27lqc7s0ca65z9bziyavkvif9ds5ivk7aq9drw"))))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((tex (string-append (getcwd)
+                                           "/tex/generic/hyph-utf8/patterns/tex/")))
+                   (mkdir-p tex)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/mul-ethi/"
+                     (substitute* "generate_patterns_mul-ethi.lua"
+                       (("\"UnicodeData.txt\"")
+                        (string-append "\""
+                                       (assoc-ref inputs "UnicodeData.txt")
+                                       "\"")))
+                     (invoke "texlua" "generate_patterns_mul-ethi.lua")
+                     (rename-file "hyph-mul-ethi.tex"
+                                  (string-append tex "/hyph-mul-ethi.tex"))
+                     #t))))
+             (add-after 'install 'install-hyph-mul-ethi.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (native-inputs
+       `(,@(package-native-inputs template)
+         ("texlive-bin" ,texlive-bin)
+         ("UnicodeData.txt"
+          ,(origin
+             (method url-fetch)
+             (uri (string-append "http://www.unicode.org/Public/10.0.0/ucd/"
+                                 "UnicodeData.txt"))
+             (sha256
+              (base32
+               "1cfak1j753zcrbgixwgppyxhm4w8vda8vxhqymi7n5ljfi6kwhjj"))))))
+      (synopsis "Hyphenation patterns for Ethiopic scripts")
+      (description "The package provides hyphenation patterns for languages
+written using the Ethiopic script for Unicode engines.  They are not supposed
+to be linguistically relevant in all cases and should, for proper typography,
+be replaced by files tailored to individual languages.")
+      (license license:lppl))))
+
+(define-public texlive-hyphen-finnish
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-finnish" "fi"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-fi.tex")
+              (base32
+               "03n6s8dwwa5vfk9bbyhcdf7p0bc0d1rrr312hpgbz8jfc9fbgd7n")))
+    (synopsis "Hyphenation patterns for Finnish")
+    (description "The package provides hyphenation patterns for Finnish in
+T1/EC and UTF-8 encodings.")
+    (license license:public-domain)))
+
+(define-public texlive-hyphen-french
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-french" "fr"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-fr.tex")
+              (base32
+               "1q82mmwvy7fdkm42958ajb53w89qkcdwybswxlwcvqngvhpy3zf0")))
+    (synopsis "Hyphenation patterns for French")
+    (description "The package provides hyphenation patterns for French in
+T1/EC and UTF-8 encodings.")
+    (license license:expat)))
+
+(define-public texlive-hyphen-friulan
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-friulan" "fur"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-fur.tex")
+              (base32
+               "07m975p0ghzs9sjqqgxy7qdkqmgvg4rx4xp08zwm1parqsdlwd5d")))
+    (synopsis "Hyphenation patterns for Friulan")
+    (description "The package provides hyphenation patterns for Friulan in
+ASCII encodings.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-galician
+  (let ((template (texlive-hyphen-package
+                   "texlive-hyphen-galician" "gl"
+                   (list "/source/generic/hyph-utf8/languages/gl/README"
+                         "/source/generic/hyph-utf8/languages/gl/glhybiox.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glhyextr.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glhymed.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glhyquim.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glhytec.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glhyxeog.tex"
+                         "/source/generic/hyph-utf8/languages/gl/glpatter-utf8.tex")
+                   (base32
+                    "1yj1gxhkqqlyaand5gd6ij6xwffskryzlbcigdam3871a9p8x18w"))))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((tex (string-append (getcwd)
+                                           "/tex/generic/hyph-utf8/patterns/tex/")))
+                   (mkdir-p tex)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/gl/"
+                     (setenv "TEXINPUTS"
+                             (string-append (getcwd) "//:"
+                                            (assoc-ref inputs "texlive-mkpattern") "//"))
+                     (invoke "tex" "-ini" "-8bit" "glpatter-utf8.tex")
+                     (rename-file "hyph-gl.tex"
+                                  (string-append tex "/hyph-gl.tex"))
+                     #t))))
+             (add-after 'install 'install-hyph-gl.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (native-inputs
+       `(,@(package-native-inputs template)
+         ("texlive-bin" ,texlive-bin)
+         ("texlive-mkpattern" ,texlive-mkpattern)))
+      (synopsis "Hyphenation patterns for Galician")
+      (description "The package provides hyphenation patterns for Galician in
+T1/EC and UTF-8 encodings.")
+      ;; glhyextr.tex is the only file in the public domain.
+      (license (list license:lppl1.3 license:public-domain)))))
+
+(define-public texlive-hyphen-georgian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-georgian" "ka"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-ka.tex")
+              (base32
+               "01zhn6mflpiqw4lyi8dx8syiz5mky9jrxm87cgw31hanis5cml4l")))
+    (synopsis "Hyphenation patterns for Georgian")
+    (description "The package provides hyphenation patterns for Georgian in
+T8M, T8K, and UTF-8 encodings.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-german
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-german" '("de-1901" "de-1996" "de-ch-1901")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-de-1901.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-de-1996.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-de-ch-1901.tex"
+                    "/tex/generic/hyphen/dehyphn.tex"
+                    "/tex/generic/hyphen/dehypht.tex"
+                    "/tex/generic/hyphen/dehyphtex.tex"
+                    "/tex/generic/hyphen/ghyphen.README")
+              (base32
+               "1g0vhpvl2l69rn2lx7lkw0inrjbcxkj2sjgwd2fq7hdi4yb2ms76")))
+    (synopsis "Hyphenation patterns for German")
+    (description "This package provides hyphenation patterns for German in
+T1/EC and UTF-8 encodings, for traditional and reformed spelling, including
+Swiss German.")
+    ;; The patterns are released under the Expat license; the dehyph* files
+    ;; are released under the LPPL version 1 or later.
+    (license (list license:expat license:lppl1.0+))))
+
+(define-public texlive-hyphen-greek
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-greek" '("el-monoton" "el-polyton")
+              (list "/doc/generic/elhyphen/"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-el-monoton.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-el-polyton.tex"
+                    "/tex/generic/hyphen/grmhyph5.tex"
+                    "/tex/generic/hyphen/grphyph5.tex")
+              (base32
+               "04626jhlrv2flgdygm7sfv6xpqhfwiavi16gy2ac04iliyk4rypg")))
+    (synopsis "Hyphenation patterns for Greek")
+    (description "This package provides hyphenation patterns for Modern Greek
+in monotonic and polytonic spelling in LGR and UTF-8 encodings.")
+    (license license:lppl)))
+
+(define-public texlive-hyphen-hungarian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-hungarian" "hu"
+              (list "/doc/generic/huhyphen/"
+                    "/doc/generic/hyph-utf8/hu/"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-hu.tex")
+              (base32
+               "0c81w2569cqsi4j56azwz0lfx16541zhiqgmn3m4iwh7mpx3rji8")))
+    (synopsis "Hyphenation patterns for Hungarian")
+    (description "This package provides hyphenation patterns for Hungarian in
+T1/EC and UTF-8 encodings.")
+    ;; Any of these licenses
+    (license (list license:gpl2 license:lgpl2.1+ license:mpl1.1))))
+
+(define-public texlive-hyphen-icelandic
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-icelandic" "is"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-is.tex")
+              (base32
+               "1ah1f82lgfhqgid4ngsfiypybx10v8gwxnb12396vfsj3bq6j0ba")))
+    (synopsis "Hyphenation patterns for Icelandic")
+    (description "This package provides hyphenation patterns for Icelandic in
+T1/EC and UTF-8 encodings.")
+    (license license:lppl1.2+)))
+
+(define-public texlive-hyphen-indic
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-indic"
+              '("as" "bn" "gu" "hi" "kn" "ml" "mr" "or" "pa" "ta" "te")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-as.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-bn.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-gu.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-hi.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-kn.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-ml.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-mr.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-or.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-pa.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-ta.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-te.tex")
+              (base32
+               "1v8zc3wdbkhzjrflndmz4gdj11syz8vrcg0vwvm5bwhkx23g91lv")))
+    (synopsis "Indic hyphenation patterns")
+    (description "This package provides hyphenation patterns for Assamese,
+Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Panjabi, Tamil
+and Telugu for Unicode engines.")
+    (license license:expat)))
+
+(define-public texlive-hyphen-indonesian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-indonesian" "id"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-id.tex")
+              (base32
+               "0mf0hr9c952kb2hmzid7fqg5whshwpribbyndb3ba092wh02abh5")))
+    (synopsis "Indonesian hyphenation patterns")
+    (description "This package provides hyphenation patterns for
+Indonesian (Bahasa Indonesia) in ASCII encoding.  They are probably also
+usable for Malay (Bahasa Melayu).")
+    (license license:gpl2)))
+
+(define-public texlive-hyphen-interlingua
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-interlingua" "ia"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-ia.tex")
+              (base32
+               "1aihgma3rix4jkc1z5k1lh6hlfrncn66yj0givd3j6xjqflafr2g")))
+    (synopsis "Interlingua hyphenation patterns")
+    (description "This package provides hyphenation patterns for Interlingua
+in ASCII encoding.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-irish
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-irish" "ga"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-ga.tex")
+              (base32
+               "02k1fykgj3xamczjq16i9fsjjsh78pp5ypmh93p64izk2vymfwk0")))
+    (synopsis "Irish hyphenation patterns")
+    (description "This package provides hyphenation patterns for
+Irish (Gaeilge) in T1/EC and UTF-8 encodings.")
+    ;; Either of these licenses
+    (license (list license:gpl2+ license:expat))))
+
+(define-public texlive-hyphen-italian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-italian" "it"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-it.tex")
+              (base32
+               "1a65q3hjn2p212cgv6p7wa0wcn34qnxcz2pl3v3ip0xmb16qqsk5")))
+    (synopsis "Italian hyphenation patterns")
+    (description "This package provides hyphenation patterns for Italian in
+ASCII encoding.  Compliant with the Recommendation UNI 6461 on hyphenation
+issued by the Italian Standards Institution (Ente Nazionale di Unificazione
+UNI).")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-kurmanji
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-kurmanji" "kmr"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-kmr.tex")
+              (base32
+               "1145ykfd0b0hgklindlxdgkqmsnj3cai3cwgllz411yqmrhjc6y9")))
+    (synopsis "Kurmanji hyphenation patterns")
+    (description "This package provides hyphenation patterns for
+Kurmanji (Northern Kurdish) as spoken in Turkey and by the Kurdish diaspora in
+Europe, in T1/EC and UTF-8 encodings.")
+    (license license:lppl1.3)))
+
+(define-public texlive-hyphen-latin
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-latin" '("la-x-classic" "la-x-liturgic" "la")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-la-x-classic.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-la-x-liturgic.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-la.tex")
+              (base32
+               "1d8d6b47r4r000gqgzyl0sy9is0y0dg41jp8fw4gqq8qmcgdxgsg")))
+    (synopsis "Liturgical Latin hyphenation patterns")
+    (description "This package provides hyphenation patterns for Latin in
+T1/EC and UTF-8 encodings, mainly in modern spelling (u when u is needed and v
+when v is needed), medieval spelling with the ligatures @code{\\ae} and
+@code{\\oe} and the (uncial) lowercase 'v' written as a 'u' is also supported.
+Apparently there is no conflict between the patterns of modern Latin and those
+of medieval Latin.  It also includes hyphenation patterns for the Classical
+Latin in T1/EC and UTF-8 encodings.  Classical Latin hyphenation patterns are
+different from those of 'plain' Latin, the latter being more adapted to modern
+Latin.  It also provides hyphenation patterns for the Liturgical Latin in
+T1/EC and UTF-8 encodings.")
+    ;; Either of these licenses
+    (license (list license:lppl1.0+ license:expat))))
+
+(define-public texlive-hyphen-latvian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-latvian" "lv"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-lv.tex")
+              (base32
+               "1xbh5s6nwfjbv7g4kmcpjkm02a6s767p7jn9qjcnz5ip0ndl5g66")))
+    (synopsis "Latvian hyphenation patterns")
+    (description "This package provides hyphenation patterns for Latvian in
+L7X and UTF-8 encodings.")
+    ;; Either of these licenses.
+    (license (list license:gpl2 license:lgpl2.1))))
+
+(define-public texlive-hyphen-lithuanian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-lithuanian" "lt"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-lt.tex")
+              (base32
+               "0v9spw0qkygkihj5app2immzqqr98w81pz460bcgvj1ah35jdfsl")))
+    (synopsis "Lithuanian hyphenation patterns")
+    (description "This package provides hyphenation patterns for Lithuanian in
+L7X and UTF-8 encodings.")
+    ;; "Do ... whatever ... as long as you respect the copyright"; as part of
+    ;; the hyph-utf8 package we choose the LPPL license.
+    (license license:lppl)))
+
+(define-public texlive-hyphen-mongolian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-mongolian" '("mn-cyrl-x-lmc" "mn-cyrl")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-mn-cyrl-x-lmc.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-mn-cyrl.tex")
+              (base32
+               "0lqq3jgwgnclb1cn3x99xmk90xra9q51b00ypwy5crssmy023hqc")))
+    (synopsis "Mongolian hyphenation patterns in Cyrillic script")
+    (description "This package provides hyphenation patterns for Mongolian in
+T2A, LMC and UTF-8 encodings.")
+    ;; Either of these licenses
+    (license (list license:lppl1.3+ license:expat))))
+
+(define-public texlive-hyphen-norwegian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-norwegian" '("nb" "nn" "no")
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-nb.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-nn.tex"
+                    "/tex/generic/hyph-utf8/patterns/tex/hyph-no.tex")
+              (base32
+               "1fxnf671yz0p3lmdkspna7fjh96br1jy6yf7v17yh4fxwry3s4yz")))
+    (synopsis "Norwegian Bokmal and Nynorsk hyphenation patterns")
+    (description "This package provides hyphenation patterns for Norwegian
+Bokmal and Nynorsk in T1/EC and UTF-8 encodings.")
+    (license (license:non-copyleft
+              "/tex/generic/hyph-utf8/patterns/tex/hyph-no.tex"
+              "FSF All permissive license"))))
+
+(define-public texlive-hyphen-occitan
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-occitan" "oc"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-oc.tex")
+              (base32
+               "1y6j6ac9ncn79p7hnp6mdwdsw9ij14zyjby5iwdhpvzzn7yyc7p8")))
+    (synopsis "Occitan hyphenation patterns")
+    (description "This package provides hyphenation patterns for Occitan in
+T1/EC and UTF-8 encodings.  They are supposed to be valid for all the Occitan
+variants spoken and written in the wide area called 'Occitanie' by the French.
+It ranges from the Val d'Aran within Catalunya, to the South Western Italian
+Alps encompassing the southern half of the French pentagon.")
+    (license license:lppl1.0+)))
+
+(define-public texlive-hyphen-piedmontese
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-piedmontese" "pms"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-pms.tex")
+              (base32
+               "00fqzymkg374r3dzf1y82k6b18bqrf688vnjv0vkvw5a45srlb5r")))
+    (synopsis "Piedmontese hyphenation patterns")
+    (description "This package provides hyphenation patterns for Piedmontese
+in ASCII encoding.  Compliant with 'Gramatica dla lengua piemonteisa' by
+Camillo Brero.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-polish
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-polish" "pl"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-pl.tex")
+              (base32
+               "0dzq8ca96q7m5bslh51x8d30pdb86glh2gn3mmvq5ip813ckwh3s")))
+    (synopsis "Polish hyphenation patterns")
+    (description "This package provides hyphenation patterns for Polish in QX
+and UTF-8 encodings.")
+    ;; No differing license declared, so we choose the project license.
+    (license license:lppl)))
+
+(define-public texlive-hyphen-portuguese
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-portuguese" "pt"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-pt.tex")
+              (base32
+               "1waxrmm33fd2qfc4kiaiblg8kwzasrvgq4j3l14z733d0hlg4rfz")))
+    (synopsis "Portuguese hyphenation patterns")
+    (description "This package provides hyphenation patterns for Portuguese in
+T1/EC and UTF-8 encodings.")
+    (license license:bsd-3)))
+
+(define-public texlive-hyph-utf8
+  (package
+    (inherit (simple-texlive-package
+              "texlive-hyph-utf8"
+              (list "/source/generic/hyph-utf8/"
+                    "/source/luatex/hyph-utf8/"
+                    "/doc/luatex/hyph-utf8/"
+                    "/tex/luatex/hyph-utf8/etex.src"
+                    ;; Used to extract luatex-hyphen.lua
+                    "/tex/latex/base/docstrip.tex"
+
+                    ;; Documentation; we can't use the whole directory because
+                    ;; it includes files from other packages.
+                    "/doc/generic/hyph-utf8/CHANGES"
+                    "/doc/generic/hyph-utf8/HISTORY"
+                    "/doc/generic/hyph-utf8/hyph-utf8.pdf"
+                    "/doc/generic/hyph-utf8/hyph-utf8.tex"
+                    "/doc/generic/hyph-utf8/hyphenation-distribution.pdf"
+                    "/doc/generic/hyph-utf8/hyphenation-distribution.tex"
+                    "/doc/generic/hyph-utf8/img/miktex-languages.png"
+                    "/doc/generic/hyph-utf8/img/texlive-collection.png")
+              (base32
+               "10y8svgk68sivmgzrv8gv137r7kv49cs256cq2wja9ms437pxvbj")))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; there are none
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 match))
+       #:make-flags
+       (list "-C" "source/luatex/hyph-utf8/"
+             (string-append "DO_TEX = tex --interaction=nonstopmode '&tex' $<")
+             (string-append "RUNDIR =" (assoc-ref %outputs "out") "/share/texmf-dist/tex/luatex/hyph-utf8/")
+             (string-append "DOCDIR =" (assoc-ref %outputs "doc") "/share/texmf-dist/doc/luatex/hyph-utf8/")
+             ;; hyphen.cfg is neither included nor generated, so let's only build the lua file.
+             (string-append "UNPACKED = $(NAME).lua"))
+       #:phases
+       (modify-phases %standard-phases
+         ;; TeX isn't usable at this point, so we first need to generate the
+         ;; tex.fmt.
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Target directories must exist.
+             (mkdir-p (string-append (assoc-ref %outputs "out")
+                                     "/share/texmf-dist/tex/luatex/hyph-utf8/"))
+             (mkdir-p (string-append (assoc-ref %outputs "doc")
+                                     "/share/texmf-dist/doc/luatex/hyph-utf8/"))
+
+             ;; We cannot build the documentation because that requires a
+             ;; fully functional pdflatex, which depends on this package.
+             (substitute* "source/luatex/hyph-utf8/Makefile"
+               (("all: .*") "all: $(RUNFILES)\n"))
+
+             ;; Find required fonts for building tex.fmt
+             (setenv "TFMFONTS"
+                     (string-append (assoc-ref inputs "texlive-fonts-cm")
+                                    "/share/texmf-dist/fonts/tfm/public/cm:"
+                                    (assoc-ref inputs "texlive-fonts-knuth-lib")
+                                    "/share/texmf-dist/fonts/tfm/public/knuth-lib"))
+             ;; ...and find all tex files in this environment.
+             (setenv "TEXINPUTS"
+                     (string-append
+                      (getcwd) ":"
+                      (string-join
+                       (map (match-lambda ((_ . dir) dir)) inputs)
+                       "//:")))
+
+             ;; Generate tex.fmt.
+             (let ((where "source/luatex/hyph-utf8"))
+               (mkdir-p where)
+               (with-directory-excursion where
+                 (invoke "tex" "-ini"
+                         (string-append (assoc-ref inputs "texlive-tex-plain")
+                                        "/share/texmf-dist/tex/plain/config/tex.ini"))))))
+         (add-before 'build 'build-loaders-and-converters
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((root (string-append (assoc-ref outputs "out")
+                                         "/share/texmf-dist"))
+                    (conv
+                     (string-append root
+                                    "/tex/generic/hyph-utf8/conversions")))
+
+               ;; Build converters
+               (mkdir-p conv)
+               (with-directory-excursion "source/generic/hyph-utf8"
+                 (substitute* "generate-converters.rb"
+                   (("\\$path_root=File.*")
+                    (string-append "$path_root=\"" root "\"\n"))
+                   ;; Avoid error with newer Ruby.
+                   (("#1\\{%") "#1{%%"))
+                 (invoke "ruby" "generate-converters.rb"))
+               #t)))
+         (replace 'install
+           (lambda* (#:key source outputs #:allow-other-keys)
+             (let ((doc (assoc-ref outputs "doc"))
+                   (out (assoc-ref outputs "out")))
+               (mkdir-p doc)
+               (copy-recursively
+                (string-append source "/doc")
+                (string-append doc "/doc"))
+               (install-file
+                (string-append source "/tex/luatex/hyph-utf8/etex.src")
+                (string-append out "/share/texmf-dist/tex/luatex/hyph-utf8/")))
+             #t)))))
+    (native-inputs
+     `(("ruby" ,ruby)
+       ("texlive-bin" ,texlive-bin)
+       ;; The following packages are needed for build "tex.fmt", which we need
+       ;; for a working "tex".
+       ("texlive-tex-plain" ,texlive-tex-plain)
+       ("texlive-fonts-cm" ,texlive-fonts-cm)
+       ("texlive-fonts-knuth-lib" ,texlive-fonts-knuth-lib)
+       ("texlive-hyphen-base" ,texlive-hyphen-base)))
+    (home-page "https://ctan.org/pkg/hyph-utf8")
+    (synopsis "Hyphenation patterns expressed in UTF-8")
+    (description "Modern native UTF-8 engines such as XeTeX and LuaTeX need
+hyphenation patterns in UTF-8 format, whereas older systems require
+hyphenation patterns in the 8-bit encoding of the font in use (such encodings
+are codified in the LaTeX scheme with names like OT1, T2A, TS1, OML, LY1,
+etc).  The present package offers a collection of conversions of existing
+patterns to UTF-8 format, together with converters for use with 8-bit fonts in
+older systems.  Since hyphenation patterns for Knuthian-style TeX systems are
+only read at iniTeX time, it is hoped that the UTF-8 patterns, with their
+converters, will completely supplant the older patterns.")
+    ;; Individual files each have their own license.  Most of these files are
+    ;; independent hyphenation patterns.
+    (license (list license:lppl1.0+
+                   license:lppl1.2+
+                   license:lppl1.3
+                   license:lppl1.3+
+                   license:lppl1.3a+
+                   license:lgpl2.1
+                   license:lgpl2.1+
+                   license:lgpl3+
+                   license:gpl2+
+                   license:gpl3+
+                   license:mpl1.1
+                   license:asl2.0
+                   license:expat
+                   license:bsd-3
+                   license:cc0
+                   license:public-domain
+                   license:wtfpl2))))
+
+(define-public texlive-generic-hyph-utf8
+  (deprecated-package "texlive-generic-hyph-utf8" texlive-hyph-utf8))
+
+(define-public texlive-dehyph-exptl
+  (package
+    (inherit (simple-texlive-package
+              "texlive-dehyph-exptl"
+              (list "/tex/generic/dehyph-exptl/"
+                    "/doc/generic/dehyph-exptl/")
+              (base32
+               "1w2danvvy2f52hcb4acvjks53kcanwxr9s990fap6mj279hpgmh2")
+              #:trivial? #t))
+    (propagated-inputs
+     `(("texlive-hyphen-base" ,texlive-hyphen-base)
+       ("texlive-hyph-utf8" ,texlive-hyph-utf8)))
+    (home-page "http://projekte.dante.de/Trennmuster/WebHome")
+    (synopsis "Hyphenation patterns for German")
+    (description "The package provides experimental hyphenation patterns for
+the German language, covering both traditional and reformed orthography.  The
+patterns can be used with packages Babel and hyphsubst from the Oberdiek
+bundle.")
+    ;; Hyphenation patterns are under the Expat license; documentation is
+    ;; under LPPL.
+    (license (list license:expat license:lppl))))
+
+(define-public texlive-generic-dehyph-exptl
+  (deprecated-package "texlive-generic-dehyph-exptl" texlive-dehyph-exptl))
+
+(define-public texlive-latex-base
+  (let ((texlive-dir
+         (lambda (dir hash)
+           (origin
+             (method svn-fetch)
+             (uri (svn-reference
+                   (url (string-append "svn://www.tug.org/texlive/tags/"
+                                       %texlive-tag "/Master/texmf-dist/"
+                                       dir))
+                   (revision %texlive-revision)))
+             (file-name (string-append "texlive-generic-"
+                                       (last (string-split
+                                               (string-drop-right dir 1) #\/))
+                                       "-" (number->string %texlive-revision)
+                                       "-checkout"))
+             (sha256 (base32 hash))))))
+    (package
+      (name "texlive-latex-base")
+      (version (number->string %texlive-revision))
+      (source (origin
+                (method svn-fetch)
+                (uri (texlive-ref "latex" "base"))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "17bqrzzjz16k52sc7ydl4vw7ddy2z3g0p1xsk2c35h1ynq9h3wwm"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (ice-9 match)
+                    (srfi srfi-1)
+                    (srfi srfi-26))
+         #:tests? #f                    ; no tests
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'build
+             (lambda* (#:key inputs #:allow-other-keys)
+               ;; Find required fonts
+               (setenv "TFMFONTS"
+                       (string-append (assoc-ref inputs "texlive-fonts-cm")
+                                      "/share/texmf-dist/fonts/tfm/public/cm:"
+                                      (assoc-ref inputs "texlive-fonts-latex")
+                                      "/share/texmf-dist/fonts/tfm/public/latex-fonts:"
+                                      (assoc-ref inputs "texlive-fonts-knuth-lib")
+                                      "/share/texmf-dist/fonts/tfm/public/knuth-lib"))
+               (setenv "TEXINPUTS"
+                       (string-append
+                        (getcwd) ":"
+                        (getcwd) "/build:"
+                        (string-join
+                         (map (match-lambda ((_ . dir) dir)) inputs)
+                         "//:")))
+
+               ;; Create an empty texsys.cfg, because latex.ltx wants to include
+               ;; it.  This file must exist and it's fine if it's empty.
+               (with-output-to-file "texsys.cfg"
+                 (lambda _ (format #t "%")))
+
+               (mkdir "build")
+               (mkdir "web2c")
+               (invoke "luatex" "-ini" "-interaction=batchmode"
+                       "-output-directory=build" "unpack.ins")
+               (invoke "tex" "-ini" "-interaction=batchmode"
+                       "-output-directory=web2c" "tex.ini")
+               ;; LaTeX, pdfetex/pdftex, and XeTeX require e-TeX, which
+               ;; is enabled only in extended mode (activated with a
+               ;; leading asterisk).  We should not use luatex here,
+               ;; because that would make the generated format files
+               ;; incompatible with any other TeX engine.
+               (for-each (lambda (format)
+                           (invoke "latex" "-ini" "-interaction=batchmode"
+                                   "-output-directory=web2c"
+                                   "-translate-file=cp227.tcx"
+                                   (string-append "*" format ".ini")))
+                         '("latex"
+                           "pdflatex"
+                           "pdfetex"))
+               (for-each (lambda (format)
+                           (invoke format "-ini" "-interaction=batchmode"
+                                   "-output-directory=web2c"
+                                   (string-append "*" format ".ini")))
+                         '("xetex"
+                           "xelatex"))
+               (for-each (lambda (format)
+                           (invoke "luatex" "-ini" "-interaction=batchmode"
+                                   "-output-directory=web2c"
+                                   (string-append format ".ini")))
+                         '("dviluatex" "dvilualatex" "luatex" "lualatex"))
+               #t))
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (target (string-append
+                               out "/share/texmf-dist/tex/latex/base"))
+                      (web2c (string-append
+                              out "/share/texmf-dist/web2c"))
+                      (support-files (assoc-ref inputs "texlive-latex-base-support-files")))
+                 (mkdir-p target)
+                 (mkdir-p web2c)
+                 (for-each delete-file (find-files "." "\\.(log|aux)$"))
+                 (for-each (cut install-file <> target)
+                           (find-files "build" ".*"))
+                 (for-each (cut install-file <> web2c)
+                           (find-files "web2c" ".*"))
+                 ;; pdftex is really just the same as pdfetex, but since it
+                 ;; doesn't have its own format file, we need to copy it.
+                 (copy-file "web2c/pdfetex.fmt"
+                            (string-append web2c "/pdftex.fmt"))
+                 ;; "source" is missing the support files as per doc/latex/base/manifest.txt.
+                 ;; FIXME: We are probably not packaging this right.
+                 (for-each (lambda (file)
+                             (install-file
+                              (string-append support-files "/" file)
+                              target))
+                           '("ltxguide.cls" "ltnews.cls" "minimal.cls" "idx.tex"
+                             "lablst.tex" "testpage.tex" "ltxcheck.tex"))
+                 ;; Install configurations
+                 (copy-recursively
+                  (assoc-ref inputs "texlive-latex-latexconfig")
+                  (string-append out "/share/texmf-dist/tex/latex/latexconfig"))
+                 (copy-recursively
+                  (assoc-ref inputs "texlive-generic-config")
+                  (string-append out "/share/texmf-dist/tex/generic/config"))
+                 (copy-recursively
+                  (assoc-ref inputs "texlive-generic-hyphen")
+                  (string-append out "/share/texmf-dist/tex/generic/hyphen"))
+                 (copy-recursively
+                  (assoc-ref inputs "texlive-generic-ruhyphen")
+                  (string-append out "/share/texmf-dist/tex/generic/ruhyphen"))
+                 (copy-recursively
+                  (assoc-ref inputs "texlive-generic-ukrhyph")
+                  (string-append out "/share/texmf-dist/tex/generic/ukrhyph"))
                  #t))))))
       (native-inputs
        `(("texlive-bin" ,texlive-bin)
@@ -1526,6 +2658,9 @@ tables.")
                 "1d3rmjgzh0025a1dza55zb6nzzlgd1y9snwx45wq1c1vf42m79h2"))))
     (build-system texlive-build-system)
     (arguments '(#:tex-directory "latex/hyperref"))
+    (propagated-inputs
+     `(("texlive-latex-oberdiek" ,texlive-latex-oberdiek) ; for ltxcmds.sty
+       ("texlive-latex-url" ,texlive-latex-url)))
     (home-page "https://www.ctan.org/pkg/hyperref")
     (synopsis "Extensive support for hypertext in LaTeX")
     (description
@@ -1562,6 +2697,8 @@ pdf and HTML backends.  The package is distributed with the @code{backref} and
              (substitute* "oberdiek.ins"
                (("ifpdf.ins") "ifpdf.dtx"))
              #t)))))
+    (propagated-inputs
+     `(("texlive-generic-ifxetex" ,texlive-generic-ifxetex)))
     (home-page "https://www.ctan.org/pkg/oberdiek")
     (synopsis "Bundle of packages submitted by Heiko Oberdiek")
     (description
@@ -2143,16 +3280,18 @@ standard LaTeX packages."
            #:builder
            (begin
              (use-modules (ice-9 match)
+                          (ice-9 popen)
                           (srfi srfi-26)
                           (guix build union)
                           (guix build utils)
                           (guix build texlive-build-system))
              (let* ((out       (assoc-ref %outputs "out"))
                     (texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf")))
-               ;; Build a modifiable union of all inputs (but exclude bash)
+               ;; Build a modifiable union of all inputs (but exclude bash and
+               ;; the updmap.cfg file)
                (match (filter (match-lambda
                                 ((name . _)
-                                 (not (string=? "bash" name))))
+                                 (not (member name '("bash" "updmap.cfg")))))
                               %build-inputs)
                  (((names . directories) ...)
                   (union-build (assoc-ref %outputs "out")
@@ -2169,19 +3308,47 @@ standard LaTeX packages."
                   (string-append "TEXMFROOT = " out "/share\n"))
                  (("^TEXMF = .*")
                   "TEXMF = $TEXMFROOT/share/texmf-dist\n"))
-               (setenv "PATH" (string-append (assoc-ref %build-inputs "bash")
-                                             "/bin"))
+               (setenv "PATH" (string-append
+                               (assoc-ref %build-inputs "bash") "/bin:"
+                               (assoc-ref %build-inputs "coreutils") "/bin:"
+                               (string-append out "/bin")))
                (for-each
                 (cut wrap-program <>
                      `("TEXMFCNF" ":" suffix (,(dirname texmf.cnf)))
                      `("TEXMF"    ":" suffix (,(string-append out "/share/texmf-dist"))))
                 (find-files (string-append out "/bin") ".*"))
+
+               ;; Remove invalid maps from config file.
+               (let ((port (open-pipe* OPEN_WRITE "updmap-sys"
+                                       "--syncwithtrees"
+                                       "--nohash"
+                                       (assoc-ref %build-inputs "updmap.cfg"))))
+                 (display "Y\n" port)
+                 (when (not (zero? (status:exit-val (close-pipe port))))
+                   (error "failed to filter updmap.cfg")))
+               ;; Generate maps.
+               (invoke "updmap-sys" "--force"
+                       (string-append out "/share/texmf-config/web2c/updmap.cfg"))
                #t))))
         (inputs
          `(("bash" ,bash)
            ,@(map (lambda (package)
                     (list (package-name package) package))
                   (append default-packages packages))))
+        (native-inputs
+         `(("coreutils" ,coreutils)
+           ("sed" ,sed)
+           ("updmap.cfg"
+            ,(origin
+               (method url-fetch)
+               (uri (string-append "https://tug.org/svn/texlive/tags/"
+                                   %texlive-tag "/Master/texmf-dist/web2c/updmap.cfg"
+                                   "?revision=" (number->string %texlive-revision)))
+               (file-name (string-append "updmap.cfg-"
+                                         (number->string %texlive-revision)))
+               (sha256
+                (base32
+                 "06mwpy5i218g5k3sf4gba0fmxgas82hkzx9fhwn67z5ik37d8apq"))))))
         (home-page (package-home-page texlive-bin))
         (synopsis "Union of TeX Live packages")
         (description "This package provides a subset of the TeX Live
@@ -2629,8 +3796,17 @@ re-processing.")
               (sha256
                (base32
                 "0y4i651b75y6006n03x8n86bsqvjsailvvz9bhzy51dzsznqidq0"))))
-    (build-system texlive-build-system)
-    (arguments '(#:tex-directory "latex/seminar"))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((target (string-append (assoc-ref %outputs "out")
+                                      "/share/texmf-dist/tex/latex/seminar")))
+           (mkdir-p target)
+           (copy-recursively (assoc-ref %build-inputs "source") target)
+           #t))))
     (home-page "https://www.ctan.org/pkg/seminar")
     (synopsis "Make overhead slides")
     ;; TODO: This package may need fancybox and xcomment at runtime.
@@ -2946,6 +4122,8 @@ BibLaTeX, and is considered experimental.")
                 "0yw6bjfgsli3s1dldsgb7mkr7lnk329cgdjbgs8z2xn59pmmdsn4"))))
     (build-system texlive-build-system)
     (arguments '(#:tex-directory "latex/geometry"))
+    (propagated-inputs
+     `(("texlive-latex-oberdiek" ,texlive-latex-oberdiek))) ;for ifpdf
     (home-page "https://www.ctan.org/pkg/geometry")
     (synopsis "Flexible and complete interface to document dimensions")
     (description
@@ -3163,8 +4341,8 @@ command.")
     (description
      "Identify areas of text to be marked with changebars with the
 @code{\\cbstart} and @code{\\cbend} commands; the bars may be coloured.  The
-package uses 'drivers' to place the bars; the available drivers can work with
-@code{dvitoln03}, @code{dvitops}, @code{dvips}, the emTeX and TeXtures DVI
+package uses @code{drivers} to place the bars; the available drivers can work
+with @code{dvitoln03}, @code{dvitops}, @code{dvips}, the emTeX and TeXtures DVI
 drivers, and VTeX and pdfTeX.")
     (license license:lppl)))
 
@@ -3331,159 +4509,620 @@ with @code{\\floatplacement{figure}{H}}.")
     (home-page "https://www.ctan.org/pkg/footmisc")
     (synopsis "Range of footnote options")
     (description
-     "This is a collection of ways to change the typesetting of footnotes.
-The package provides means of changing the layout of the footnotes themselves,
-a way to number footnotes per page, to make footnotes disappear in a
-\"moving\" argument, and to deal with multiple references to footnotes from
-the same place.  The package also has a range of techniques for labelling
-footnotes with symbols rather than numbers.")
-    (license license:lppl1.3+)))
+     "This is a collection of ways to change the typesetting of footnotes.
+The package provides means of changing the layout of the footnotes themselves,
+a way to number footnotes per page, to make footnotes disappear in a
+\"moving\" argument, and to deal with multiple references to footnotes from
+the same place.  The package also has a range of techniques for labelling
+footnotes with symbols rather than numbers.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-latex-listings
+  (package
+    (name "texlive-latex-listings")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (texlive-ref "latex" "listings"))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "1nsn9wp3wl12b36c0sqrim33lf33cr5wky0h4ncnw8lvqgm7h8wf"))))
+    (build-system texlive-build-system)
+    (arguments
+     '(#:tex-directory "latex/listings"
+       #:build-targets '("listings.ins")))
+    (home-page "https://www.ctan.org/pkg/listings")
+    (synopsis "Typeset source code listings using LaTeX")
+    (description
+     "The package enables the user to typeset programs (programming code)
+within LaTeX; the source code is read directly by TeX---no front-end processor
+is needed.  Keywords, comments and strings can be typeset using different
+styles.  Support for @code{hyperref} is provided.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-latex-jknapltx
+  (package
+    (name "texlive-latex-jknapltx")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/tex/latex/jknapltx"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0m034x72f2g07icr50gacyxfb9g1lz2rmqh4kqr1qjb421x2kds9"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((target (string-append (assoc-ref %outputs "out")
+                                      "/share/texmf-dist/tex/latex/jknapltx")))
+           (mkdir-p target)
+           (copy-recursively (assoc-ref %build-inputs "source") target)
+           #t))))
+    (home-page "https://www.ctan.org/pkg/jknappen")
+    (synopsis "Miscellaneous packages by Joerg Knappen")
+    (description
+     "This package provides miscellaneous macros by Joerg Knappen, including:
+represent counters in greek; Maxwell's non-commutative division;
+@code{latin1jk}, @code{latin2jk} and @code{latin3jk}, which are
+@code{inputenc} definition files that allow verbatim input in the respective
+ISO Latin codes; blackboard bold fonts in maths; use of RSFS fonts in maths;
+extra alignments for @code{\\parboxes}; swap Roman and Sans fonts;
+transliterate semitic languages; patches to make (La)TeX formulae embeddable
+in SGML; use maths minus in text as appropriate; simple Young tableaux.")
+    (license license:gpl2)))
+
+(define-public texlive-fonts-ec
+  (package
+    (name "texlive-fonts-ec")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/fonts/source/jknappen/ec/"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "12av65fbz9xiashm09c9m1fj1mijxls5xspd7652ry1n5s0nixy4"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+       #:tests? #f                      ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((mf (assoc-ref inputs "texlive-metafont-base")))
+               ;; Tell mf where to find mf.base
+               (setenv "MFBASES" (string-append mf "/share/texmf-dist/web2c"))
+               ;; Tell mf where to look for source files
+               (setenv "MFINPUTS"
+                       (string-append (getcwd) ":"
+                                      mf "/share/texmf-dist/metafont/base:"
+                                      (assoc-ref inputs "texlive-fonts-cm")
+                                      "/share/texmf-dist/fonts/source/public/cm")))
+             (mkdir "build")
+             (for-each (lambda (font)
+                         (format #t "building font ~a\n" font)
+                         (invoke "mf" "-progname=mf"
+                                 "-output-directory=build"
+                                 (string-append "\\"
+                                                "mode:=ljfour; "
+                                                "mag:=1; "
+                                                "batchmode; "
+                                                "input " (basename font ".mf"))))
+                       (find-files "." "[0-9]+\\.mf$"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (tfm (string-append
+                          out "/share/texmf-dist/fonts/tfm/jknappen/ec"))
+                    (mf  (string-append
+                          out "/share/texmf-dist/fonts/source/jknappen/ec")))
+               (for-each (cut install-file <> tfm)
+                         (find-files "build" "\\.*"))
+               (for-each (cut install-file <> mf)
+                         (find-files "." "\\.mf"))
+               #t))))))
+    (native-inputs
+     `(("texlive-bin" ,texlive-bin)
+       ("texlive-metafont-base" ,texlive-metafont-base)
+       ("texlive-fonts-cm" ,texlive-fonts-cm)))
+    (home-page "https://www.ctan.org/pkg/ec")
+    (synopsis "Computer modern fonts in T1 and TS1 encodings")
+    (description
+     "The EC fonts are European Computer Modern Fonts, supporting the complete
+LaTeX T1 encoding defined at the 1990 TUG conference hold at Cork/Ireland.
+These fonts are intended to be stable with no changes being made to the tfm
+files.  The set also contains a Text Companion Symbol font, called @code{tc},
+featuring many useful characters needed in text typesetting, for example
+oldstyle digits, currency symbols (including the newly created Euro symbol),
+the permille sign, copyright, trade mark and servicemark as well as a copyleft
+sign, and many others.  Recent releases of LaTeX2e support the EC fonts.  The
+EC fonts supersede the preliminary version released as the DC fonts.  The
+fonts are available in (traced) Adobe Type 1 format, as part of the
+@code{cm-super} bundle.  The other Computer Modern-style T1-encoded Type 1
+set, Latin Modern, is not actually a direct development of the EC set, and
+differs from the EC in a number of particulars.")
+    (license (license:fsf-free "https://www.tug.org/svn/texlive/tags/\
+texlive-2017.1/Master/texmf-dist/doc/fonts/ec/copyrite.txt"))))
 
-(define-public texlive-latex-listings
+(define-public texlive-fonts-adobe-times
   (package
-    (name "texlive-latex-listings")
+    (name "texlive-fonts-adobe-times")
     (version (number->string %texlive-revision))
     (source (origin
               (method svn-fetch)
-              (uri (texlive-ref "latex" "listings"))
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/fonts/type1/urw/times/"))
+                    (revision %texlive-revision)))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "1nsn9wp3wl12b36c0sqrim33lf33cr5wky0h4ncnw8lvqgm7h8wf"))))
-    (build-system texlive-build-system)
+                "15vzyr7favkv1mj00qxr03s89kw78nd066fh69by93272g8p5sgd"))))
+    (build-system trivial-build-system)
     (arguments
-     '(#:tex-directory "latex/listings"
-       #:build-targets '("listings.ins")))
-    (home-page "https://www.ctan.org/pkg/listings")
-    (synopsis "Typeset source code listings using LaTeX")
+     `(#:modules ((guix build utils)
+                  (ice-9 match))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match))
+         (let ((root (string-append (assoc-ref %outputs "out")
+                                    "/share/texmf-dist/"))
+               (pkgs '(("source"        . "fonts/type1/urw/times")
+
+                       ("times-afm"     . "fonts/afm/adobe/times")
+                       ("times-tfm"     . "fonts/tfm/adobe/times")
+                       ("times-vf"      . "fonts/vf/adobe/times")
+
+                       ("urw-afm"       . "fonts/afm/urw/times")
+                       ("urw35vf-tfm"   . "fonts/tfm/urw35vf/times")
+                       ("urw35vf-vf"    . "fonts/vf/urw35vf/times")
+
+                       ("times-tex"     . "tex/latex/times")
+                       ("dvips"         . "dvips/times")
+                       ("fonts-map"     . "fonts/map/dvips/times"))))
+           (for-each (match-lambda
+                       ((pkg . dir)
+                        (let ((target (string-append root dir)))
+                          (mkdir-p target)
+                          (copy-recursively (assoc-ref %build-inputs pkg)
+                                            target))))
+                     pkgs)
+           #t))))
+    (native-inputs
+     `(("times-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/adobe/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "1k7h6vihfc6ri2lq9ggnq2g4zq3qcgq1vd0hr486g9cqrdpys6cy"))))
+       ("times-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/adobe/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "1hbgkjnf5xyganbznwpwszvr3iyk4bzb0ys4hd8ybawp60paadrr"))))
+       ("times-vf"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/vf/adobe/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-vf-" version "-checkout"))
+           (sha256
+            (base32
+             "18rfspnwdw9r81dy18lb4w96d09b6c4g7y80azwylalkhwdf2lfp"))))
+       ("urw-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/urw/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0g0xpsyn6634g0b4rpd420v7i4gkz3zr12vcy2b8csbcscjvwri5"))))
+       ("urw35vf-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/urw35vf/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw35vf-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "0a4idlvpaqd0ypqgy1xw0rpx8q23bvssg8xq757zzn3zikj0w7pr"))))
+       ("urw35vf-vf"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/vf/urw35vf/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw35vf-vf-" version "-checkout"))
+           (sha256
+            (base32
+             "05mppwxd4c5x0yw50gca726f0ylc1rk8jf0jjkrriixq6rnw03di"))))
+       ("times-tex"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/tex/latex/times"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tex-" version "-checkout"))
+           (sha256
+            (base32
+             "1gmd0x7c3vkvfzgmrsp4866rcdbyimfk3bjr91zaadc41r1i8xrp"))))
+       ("dvips"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/dvips/times/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-dvips-" version "-checkout"))
+           (sha256
+            (base32
+             "1fvqpgqi7bp2q76nf5kmlhsdijxw65arqfy3ax3djwih3yg12mp0"))))
+       ("fonts-map"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/map/dvips/times/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-fonts-map-" version "-checkout"))
+           (sha256
+            (base32
+             "12f00gzs2zgllkm59qdhw2xxj7lvg3p256232f1l275z3pldfqqi"))))))
+    (home-page "https://ctan.org/pkg/urw-base35")
+    (synopsis "URW Base 35 font pack for LaTeX")
     (description
-     "The package enables the user to typeset programs (programming code)
-within LaTeX; the source code is read directly by TeX---no front-end processor
-is needed.  Keywords, comments and strings can be typeset using different
-styles.  Support for @code{hyperref} is provided.")
-    (license license:lppl1.3+)))
+     "This package provides a drop-in replacements for the Times font from
+Adobe's basic set.")
+    ;; No license version specified.
+    (license license:gpl3+)))
 
-(define-public texlive-latex-jknapltx
+(define-public texlive-fonts-adobe-palatino
   (package
-    (name "texlive-latex-jknapltx")
+    (name "texlive-fonts-adobe-palatino")
     (version (number->string %texlive-revision))
     (source (origin
               (method svn-fetch)
               (uri (svn-reference
                     (url (string-append "svn://www.tug.org/texlive/tags/"
                                         %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/latex/jknapltx"))
+                                        "/fonts/type1/urw/palatino/"))
                     (revision %texlive-revision)))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "0m034x72f2g07icr50gacyxfb9g1lz2rmqh4kqr1qjb421x2kds9"))))
+                "18dw5260c6fy7acxaqwrg3hw04kg63ijq4lkn56q5pa2g6nyylrp"))))
     (build-system trivial-build-system)
     (arguments
-     `(#:modules ((guix build utils))
+     `(#:modules ((guix build utils)
+                  (ice-9 match))
        #:builder
        (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/latex/jknapltx")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
+         (use-modules (guix build utils)
+                      (ice-9 match))
+         (let ((root (string-append (assoc-ref %outputs "out")
+                                    "/share/texmf-dist/"))
+               (pkgs '(("source"        . "fonts/type1/urw/palatino")
+
+                       ("palatino-afm"  . "fonts/afm/adobe/palatino")
+                       ("palatino-tfm"  . "fonts/tfm/adobe/palatino")
+                       ("palatino-vf"   . "fonts/vf/adobe/palatino")
+
+                       ("urw-afm"       . "fonts/afm/urw/palatino")
+                       ("urw35vf-tfm"   . "fonts/tfm/urw35vf/palatino")
+                       ("urw35vf-vf"    . "fonts/vf/urw35vf/palatino")
+
+                       ("palatino-tex"  . "tex/latex/palatino")
+                       ("dvips"         . "dvips/palatino")
+                       ("fonts-map"     . "fonts/map/dvips/palatino"))))
+           (for-each (match-lambda
+                       ((pkg . dir)
+                        (let ((target (string-append root dir)))
+                          (mkdir-p target)
+                          (copy-recursively (assoc-ref %build-inputs pkg)
+                                            target))))
+                     pkgs)
            #t))))
-    (home-page "https://www.ctan.org/pkg/jknappen")
-    (synopsis "Miscellaneous packages by Joerg Knappen")
+    (native-inputs
+     `(("palatino-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/adobe/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0pxizay730cx7rb9y5bqq9dn1zxx3arc33rmdsn7l29pc51flmmi"))))
+       ("palatino-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/adobe/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "1w1vm0sk9kpsy14yhyf1v1q3c6b97cgbba74g578bcwjlh810mg0"))))
+       ("palatino-vf"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/vf/adobe/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-vf-" version "-checkout"))
+           (sha256
+            (base32
+             "1maqfis8hpybcn9lmm8r2b1g56620lfpsncg0742c3kkjd6dh97h"))))
+       ("urw-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/urw/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0gk0xwy1fs2si5kb1j3dzgm52c8sagv32gd9dmw88m7sgh5qkd87"))))
+       ("urw35vf-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/urw35vf/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw35vf-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "19aq3xwfg7vkf1qzjdxgcvcdqwpvpavq3l25y64xni72qx0kmppz"))))
+       ("urw35vf-vf"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/vf/urw35vf/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw35vf-vf-" version "-checkout"))
+           (sha256
+            (base32
+             "1lkn4p6zimrs0ah6mxsang4bicp8j7xzl016529a3f168an7mdmj"))))
+       ("palatino-tex"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/tex/latex/palatino"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tex-" version "-checkout"))
+           (sha256
+            (base32
+             "0ng9w7i0p1nb51amla32jj86vx6p84m6qc7asam3g4x8w5jf7s27"))))
+       ("dvips"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/dvips/palatino/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-dvips-" version "-checkout"))
+           (sha256
+            (base32
+             "1pdbkfmhx4kk3brh5lg6fyl9ad2kbjmkrhgcx84klnlhq01mfdhb"))))
+       ("fonts-map"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/map/dvips/palatino/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-fonts-map-" version "-checkout"))
+           (sha256
+            (base32
+             "0rg13hyp652hp3gnrj5pbyb84zkqmyi1qnm8c6spcyaq8pm06l0d"))))))
+    (home-page "https://ctan.org/pkg/urw-base35")
+    (synopsis "URW Base 35 font pack for LaTeX")
     (description
-     "This package provides miscellaneous macros by Joerg Knappen, including:
-represent counters in greek; Maxwell's non-commutative division;
-@code{latin1jk}, @code{latin2jk} and @code{latin3jk}, which are
-@code{inputenc} definition files that allow verbatim input in the respective
-ISO Latin codes; blackboard bold fonts in maths; use of RSFS fonts in maths;
-extra alignments for @code{\\parboxes}; swap Roman and Sans fonts;
-transliterate semitic languages; patches to make (La)TeX formulae embeddable
-in SGML; use maths minus in text as appropriate; simple Young tableaux.")
-    (license license:gpl2)))
+     "This package provides a drop-in replacements for the Palatino font from
+Adobe's basic set.")
+    ;; No license version specified.
+    (license license:gpl3+)))
 
-(define-public texlive-fonts-ec
+(define-public texlive-fonts-adobe-zapfding
   (package
-    (name "texlive-fonts-ec")
+    (name "texlive-fonts-adobe-zapfding")
     (version (number->string %texlive-revision))
     (source (origin
               (method svn-fetch)
               (uri (svn-reference
                     (url (string-append "svn://www.tug.org/texlive/tags/"
                                         %texlive-tag "/Master/texmf-dist/"
-                                        "/fonts/source/jknappen/ec/"))
+                                        "/fonts/type1/urw/zapfding/"))
                     (revision %texlive-revision)))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "12av65fbz9xiashm09c9m1fj1mijxls5xspd7652ry1n5s0nixy4"))))
-    (build-system gnu-build-system)
+                "1sp3jblg3khp0yj121blvhph6ib09919kyrsk5x2lg258yypqyis"))))
+    (build-system trivial-build-system)
     (arguments
-     `(#:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1)
-                  (srfi srfi-26))
-       #:tests? #f                      ; no tests
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (replace 'build
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((mf (assoc-ref inputs "texlive-metafont-base")))
-               ;; Tell mf where to find mf.base
-               (setenv "MFBASES" (string-append mf "/share/texmf-dist/web2c"))
-               ;; Tell mf where to look for source files
-               (setenv "MFINPUTS"
-                       (string-append (getcwd) ":"
-                                      mf "/share/texmf-dist/metafont/base:"
-                                      (assoc-ref inputs "texlive-fonts-cm")
-                                      "/share/texmf-dist/fonts/source/public/cm")))
-             (mkdir "build")
-             (for-each (lambda (font)
-                         (format #t "building font ~a\n" font)
-                         (invoke "mf" "-progname=mf"
-                                 "-output-directory=build"
-                                 (string-append "\\"
-                                                "mode:=ljfour; "
-                                                "mag:=1; "
-                                                "batchmode; "
-                                                "input " (basename font ".mf"))))
-                       (find-files "." "[0-9]+\\.mf$"))
-             #t))
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (tfm (string-append
-                          out "/share/texmf-dist/fonts/tfm/jknappen/ec"))
-                    (mf  (string-append
-                          out "/share/texmf-dist/fonts/source/jknappen/ec")))
-               (for-each (cut install-file <> tfm)
-                         (find-files "build" "\\.*"))
-               (for-each (cut install-file <> mf)
-                         (find-files "." "\\.mf"))
-               #t))))))
+     `(#:modules ((guix build utils)
+                  (ice-9 match))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match))
+         (let ((root (string-append (assoc-ref %outputs "out")
+                                    "/share/texmf-dist/"))
+               (pkgs '(("source"      . "fonts/type1/urw/zapfding")
+                       ("zapf-afm"    . "fonts/afm/adobe/zapfding")
+                       ("zapf-tfm"    . "fonts/tfm/adobe/zapfding")
+                       ("urw-afm"     . "fonts/afm/urw/zapfding")
+                       ("urw35vf-tfm" . "fonts/tfm/urw35vf/zapfding")
+
+                       ("zapf-tex"    . "tex/latex/zapfding")
+                       ("dvips"       . "dvips/zapfding")
+                       ("fonts-map"   . "fonts/map/dvips/zapfding"))))
+           (for-each (match-lambda
+                       ((pkg . dir)
+                        (let ((target (string-append root dir)))
+                          (mkdir-p target)
+                          (copy-recursively (assoc-ref %build-inputs pkg)
+                                            target))))
+                     pkgs)
+           #t))))
     (native-inputs
-     `(("texlive-bin" ,texlive-bin)
-       ("texlive-metafont-base" ,texlive-metafont-base)
-       ("texlive-fonts-cm" ,texlive-fonts-cm)))
-    (home-page "https://www.ctan.org/pkg/ec")
-    (synopsis "Computer modern fonts in T1 and TS1 encodings")
+     `(("zapf-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/adobe/zapfding"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0qvl4w1bfcpiakkd8rvkism46qnvzj9w7x4r8z9m0y7mspbkblyr"))))
+       ("zapf-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/adobe/zapfding"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "1i8mh9xsl8l4cgsg3nl4ha9q6m55j122riclaxsvkc5ka83432qm"))))
+       ("urw-afm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/afm/urw/zapfding"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw-afm-" version "-checkout"))
+           (sha256
+            (base32
+             "0m4qndqh7ji723ff82c5c1q8ziqvblbaip7vx05vnl15fqbsnfx1"))))
+       ("urw35vf-tfm"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/tfm/urw35vf/zapfding"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-urw35vf-tfm-" version "-checkout"))
+           (sha256
+            (base32
+             "167g2x6mpjfqh0w1fhjbw14qcx6ridrj2zm1bd8bi0l2d7phj28m"))))
+       ("zapf-tex"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/tex/latex/zapfding"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-tex-" version "-checkout"))
+           (sha256
+            (base32
+             "0hp7i8f6nbrg7irrwc8fd7n1hrzjysa84d6iyivwlc65v9p7lmd0"))))
+       ("dvips"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/dvips/zapfding/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-dvips-" version "-checkout"))
+           (sha256
+            (base32
+             "1f18sc4qwxykd786zhn6szcrycqvpvfhlcim71aamxmwghakd7fa"))))
+       ("fonts-map"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/map/dvips/zapfding/"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-fonts-map-" version "-checkout"))
+           (sha256
+            (base32
+             "17kwxmdrgz2fb072hx57a3pidcrhbgayphx11zyld2hv9149pkyl"))))))
+    (home-page "https://ctan.org/pkg/urw-base35")
+    (synopsis "URW Base 35 font pack for LaTeX")
     (description
-     "The EC fonts are European Computer Modern Fonts, supporting the complete
-LaTeX T1 encoding defined at the 1990 TUG conference hold at Cork/Ireland.
-These fonts are intended to be stable with no changes being made to the tfm
-files.  The set also contains a Text Companion Symbol font, called @code{tc},
-featuring many useful characters needed in text typesetting, for example
-oldstyle digits, currency symbols (including the newly created Euro symbol),
-the permille sign, copyright, trade mark and servicemark as well as a copyleft
-sign, and many others.  Recent releases of LaTeX2e support the EC fonts.  The
-EC fonts supersede the preliminary version released as the DC fonts.  The
-fonts are available in (traced) Adobe Type 1 format, as part of the
-@code{cm-super} bundle.  The other Computer Modern-style T1-encoded Type 1
-set, Latin Modern, is not actually a direct development of the EC set, and
-differs from the EC in a number of particulars.")
-    (license (license:fsf-free "https://www.tug.org/svn/texlive/tags/\
-texlive-2017.1/Master/texmf-dist/doc/fonts/ec/copyrite.txt"))))
+     "This package provides a drop-in replacements for the Zapfding font from
+Adobe's basic set.")
+    ;; No license version specified.
+    (license license:gpl3+)))
 
 (define-public texlive-fonts-rsfs
   (package
@@ -4192,13 +5831,13 @@ than the bitmaps Metafont creates.")
 (define-public texlive-latex-acmart
   (package
     (name "texlive-latex-acmart")
-    (version "1.45")
+    (version "1.60")
     (source (origin
               (method svn-fetch)
               (uri (texlive-ref "latex" "acmart"))
               (sha256
                (base32
-                "10zs8ga88ksypv1v4p6mynmfa7749q2hgxlr4shnwfjd9wrb421q"))
+                "0n62cs8dhcbn29y9ij1nnyigzr76yhk36kyahhqkkmvbafbys9s7"))
               (file-name (string-append name "-" version "-checkout"))))
     (build-system texlive-build-system)
     (arguments '(#:tex-directory "latex/acmart"))
@@ -4743,14 +6382,14 @@ PDF documents.")
 (define-public texmaker
   (package
     (name "texmaker")
-    (version "5.0.2")
+    (version "5.0.3")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "0y81mjm89b99pr9svcwpaf4iz2q9pc9hjas5kiwd1pbgl5vqskm9"))))
+                "0vrj9w5lk3vf6138n5bz8phmy3xp5kv4dq1rgirghcf4hbxdyx30"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -4779,13 +6418,12 @@ PDF documents.")
 develop documents with LaTeX, in a single application.")
     (license license:gpl2+)))
 
-
 (define-public teximpatient
   (package
     (name "teximpatient")
     (version "2.4")
     (source (origin
-              (method url-fetch)
+              (method url-fetch/tarbomb)
               (uri (string-append "mirror://gnu/" name "/" name "-"
                                   version ".tar.gz"))
               (sha256
@@ -4793,25 +6431,28 @@ develop documents with LaTeX, in a single application.")
                 "0h56w22d99dh4fgld4ssik8ggnmhmrrbnrn1lnxi1zr0miphn1sd"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:phases
+     `(#:tests? #f ; there are none
+       #:phases
        (modify-phases %standard-phases
-         (delete 'check)
-         ;; Unfortunately some mistakes have been made in packaging.
-         ;; Work around them here ...
-         (replace 'unpack
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((srcdir "teximpatient-2.4"))
-               (system* "tar" "-xzf" (assoc-ref inputs "source")
-                        (string-append "--one-top-level=" srcdir))
-               (delete-file (string-append srcdir "/book.pdf"))
-               (install-file (car
-                              (find-files
-                               (assoc-ref inputs "automake")
-                               "^install-sh$"))
-                             srcdir)
-               (chdir srcdir)))))))
+         (add-after 'unpack 'fix-packaging-error
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; This file should have been part of the tarball.
+             (install-file (car
+                            (find-files
+                             (assoc-ref inputs "automake")
+                             "^install-sh$"))
+                           ".")
+             ;; Remove generated file.
+             (delete-file "book.pdf")
+             #t)))))
     (native-inputs
-     `(("texlive" ,texlive)
+     `(("texlive" ,(texlive-union (list texlive-latex-amsfonts
+                                        texlive-fonts-amsfonts
+                                        texlive-fonts-adobe-palatino
+                                        texlive-fonts-adobe-zapfding
+                                        texlive-fonts-knuth-lib
+                                        texlive-fonts-mflogo-font
+                                        texlive-generic-pdftex)))
        ("automake" ,automake)))
     (home-page "https://www.gnu.org/software/teximpatient/")
     (synopsis "Book on TeX, plain TeX and Eplain")
@@ -4823,20 +6464,20 @@ and Karl Berry.")
 (define-public lyx
   (package
     (name "lyx")
-    (version "2.2.3")
+    (version "2.3.2-2")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "http://ftp.lyx.org/pub/lyx/stable/2.2.x/"
-                                 name "-" version ".tar.gz"))
-             (sha256
-              (base32
-               "0xvaz0i371nn2ndinc0d3ywj76ivb62649a4sdgwbivisiahd2fj"))
-             (patches (search-patches "lyx-2.2.3-fix-test.patch"))
-             (modules '((guix build utils)))
-             (snippet
-              '(begin
-                (delete-file-recursively "3rdparty")
-                #t))))
+              (method url-fetch)
+              (uri (string-append "http://ftp.lyx.org/pub/lyx/stable/"
+                                  (version-major+minor version) ".x/"
+                                  name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0vr0qwis6rhind6azfa270hqxci7rj8qb1kk5x6lm80mc34nvrqi"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "3rdparty")
+                  #t))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags `("-DLYX_USE_QT=QT5"
@@ -4846,56 +6487,68 @@ and Karl Berry.")
                            ,(string-append "-DLYX_INSTALL_PREFIX="
                                            (assoc-ref %outputs "out")
                                            ;; Exact name and level is necessary.
-                                           "/lyx2.2"))
+                                           "/lyx" ,(version-major+minor version)))
        #:phases
        (modify-phases %standard-phases
+         ;; See ;; https://www.lyx.org/trac/changeset/3a123b90af838b08680471d87170c38e56787df9/lyxgit
+         (add-after 'unpack 'fix-compilation-with-boost-1.69
+           (lambda _
+             (substitute* "src/support/FileName.cpp"
+               (("^template struct boost::detail::crc_table_t.*") ""))
+             #t))
          (add-after 'unpack 'patch-python
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* '("src/support/os.cpp")
-              (("\"python ")
-               (string-append "\""
-                              (assoc-ref inputs "python-2")
-                              "/bin/python ")))
-             #t))
-         (add-after 'patch-python 'patch-installer
-           (lambda* (#:key outputs #:allow-other-keys)
-             (substitute* "CMakeLists.txt"
-              (("/usr/local/man/man1")
-               (string-append (assoc-ref outputs "out")
-                              "/share/man/man1")))
+               (("\"python ")
+                (string-append "\""
+                               (assoc-ref inputs "python")
+                               "/bin/python ")))
              #t))
          (add-after 'patch-python 'patch-desktop-file
            (lambda* (#:key outputs #:allow-other-keys)
              (substitute* "lib/lyx.desktop.in"
-              (("Exec=")
-               (string-append "Exec="
-                              (assoc-ref outputs "out")
-                              "/")))
+               (("Exec=")
+                (string-append "Exec="
+                               (assoc-ref outputs "out")
+                               "/")))
              #t))
          (add-before 'check 'setenv-check
            (lambda _
-             (setenv "LYX_DIR_22x" (string-append (getcwd) "/../lyx-"
-                                                  ,version "/lib"))
+             ;; Create missing file that would cause tests to fail.
+             (with-output-to-file (string-append "../lyx-"
+                                                 ,version
+                                                 "/src/tests/check_layout.cmake")
+               (const #t))
+             (setenv (string-append "LYX_DIR_"
+                                    (string-join
+                                      (string-split
+                                        ,(version-major+minor version) #\-)) "x")
+                     (string-append (getcwd) "/../lyx-" ,version "/lib"))
              #t))
          (add-after 'install 'install-symlinks
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                (mkdir-p (string-append out "/bin"))
-               (symlink "../lyx2.2/bin/lyx2.2"
-                (string-append out "/bin/lyx2.2"))
+               (symlink (string-append "../lyx" ,(version-major+minor version)
+                                       "/bin/lyx" ,(version-major+minor version))
+                        (string-append out "/bin/lyx" ,(version-major+minor version)))
                #t))))))
     (inputs
      `(("boost" ,boost)
-       ("hunspell" ,hunspell) ; Note: Could also use aspell instead.
+       ("hunspell" ,hunspell)           ; Note: Could also use aspell instead.
        ("libx11" ,libx11)
-       ("python-2" ,python-2)
+       ("mythes" ,mythes)
+       ("python" ,python-2)
        ("qtbase" ,qtbase)
        ("qtsvg" ,qtsvg)
        ("zlib" ,zlib)))
     (propagated-inputs
-     `(("texlive" ,texlive))) ; article.cls is in texmf-dist.
+     `(("texlive" ,(texlive-union (list texlive-fonts-ec)))))
+    ;; FIXME: Python 3.7.0 cannot be used because the test infrastructure
+    ;; "requires a bytes-like object, not 'str'".  This may be fixed with
+    ;; upgrades to Python.
     (native-inputs
-     `(("python-2" ,python-2)
+     `(("python" ,python-2)
        ("pkg-config" ,pkg-config)
        ("bc" ,bc)))
     (home-page "https://www.lyx.org/")
@@ -5176,6 +6829,8 @@ striking out (line through words) and crossing out (/// over words).")
            (sha256
             (base32
              "0xkxw26sjzr5npjpzpr28yygwdbhzpdd0hsk80gjpidhcxmz393i"))))))
+    (propagated-inputs
+     `(("texlive-latex-xcolor" ,texlive-latex-xcolor)))
     (arguments
      `(#:modules ((guix build utils))
        #:builder
@@ -5290,7 +6945,7 @@ typearea (which are the main parts of the bundle).")
            (copy-recursively (assoc-ref %build-inputs "source") target)
            #t))))
     (home-page "https://www.ctan.org/pkg/listofitems")
-    (synopsis "Grab items in lists using user-specified seperation character")
+    (synopsis "Grab items in lists using user-specified separation character")
     (description
      "This package allows one to capture all the items of a list, for which
 the parsing character has been selected by the user, and to access any of
@@ -5665,3 +7320,142 @@ for use with LaTeX is available in @code{freenfss}, part of
 supports advanced interactive documents.  See the ConTeXt garden for a wealth
 of support information.")
     (license license:gpl2+)))
+
+(define-public texlive-latex-beamer
+  (package
+    (name "texlive-latex-beamer")
+    (version (number->string %texlive-revision))
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url (string-append "svn://www.tug.org/texlive/tags/"
+                                        %texlive-tag "/Master/texmf-dist/"
+                                        "/tex/latex/beamer"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "09y3qwbj0nckshvg9afgwcv9v3zdif1d7bnpzrggsa1fbr80mgk2"))))
+    (build-system trivial-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((target (string-append (assoc-ref %outputs "out")
+                                      "/share/texmf-dist/tex/latex/beamer"))
+               (docs   (string-append (assoc-ref %outputs "doc")
+                                      "/share/texmf-dist/doc/latex/beamer/")))
+           (mkdir-p target)
+           (copy-recursively (assoc-ref %build-inputs "source") target)
+
+           (mkdir-p docs)
+           (copy-recursively (assoc-ref %build-inputs "docs") docs)
+           #t))))
+    (propagated-inputs
+     `(("texlive-latex-hyperref" ,texlive-latex-hyperref)
+       ("texlive-latex-oberdiek" ,texlive-latex-oberdiek)
+       ("texlive-latex-etoolbox" ,texlive-latex-etoolbox)
+       ("texlive-latex-pgf" ,texlive-latex-pgf)))
+    (native-inputs
+     `(("docs"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/doc/latex/beamer"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-" version "-checkout"))
+           (sha256
+            (base32
+             "102b18b9nw9dicqqgjwx0srh1mav8vh9wdvwayn741niza9hac23"))))))
+    (home-page "https://www.ctan.org/pkg/beamer")
+    (synopsis "LaTeX class for producing presentations and slides")
+    (description "The beamer LaTeX class can be used for producing slides.
+The class works in both PostScript and direct PDF output modes, using the
+@code{pgf} graphics system for visual effects.  Content is created in the
+@code{frame} environment, and each frame can be made up of a number of slides
+using a simple notation for specifying material to appear on each slide within
+a frame.  Short versions of title, authors, institute can also be specified as
+optional parameters.  Whole frame graphics are supported by plain frames.  The
+class supports @code{figure} and @code{table} environments, transparency
+effects, varying slide transitions and animations.")
+    ;; Code is dual licensed under GPLv2+ or LPPL1.3c+; documentation is
+    ;; dual-licensed under either FDLv1.3+ or LPPL1.3c+.
+    (license (list license:lppl1.3c+ license:gpl2+ license:fdl1.3+))))
+
+(define-public texlive-latex-xmpincl
+  (package
+    (name "texlive-latex-xmpincl")
+    (version (number->string %texlive-revision))
+    (source
+     (origin
+       (method svn-fetch)
+       (uri (texlive-ref "latex" "xmpincl"))
+       (sha256
+        (base32
+         "0lq3dfb4fsw955gjwllnk7cg00ciq5mva64mlpbva6g2jz117734"))))
+    (build-system texlive-build-system)
+    (arguments '(#:tex-directory "latex/xmpincl"))
+    (home-page "http://www.ctan.org/pkg/xmpincl")
+    (synopsis "Include eXtensible Metadata Platform data in pdfLaTeX")
+    (description
+     "The XMP (eXtensible Metadata platform) is a framework to add metadata to
+digital material to enhance the workflow in publication.  The essence is that
+the metadata is stored in an XML file, and this XML stream is then embedded in
+the file to which it applies.")
+    (license license:gpl3+)))
+
+(define-public texlive-latex-pdfx
+  (package
+    (name "texlive-latex-pdfx")
+    (version (number->string %texlive-revision))
+    (source
+     (origin
+       (method svn-fetch)
+       (uri (texlive-ref "latex" "pdfx"))
+       (sha256
+        (base32
+         "0ikxg8yzq78hy5b9x13d4nah46d0yvmwlqmdri06pygbx116dcac"))))
+    (build-system texlive-build-system)
+    (arguments
+     '(#:tex-directory "latex/pdfx"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-encoding
+           (lambda _
+             (substitute* "pdfx.dtx"
+               (("    .+umaczy") "umaczy"))
+             #t))
+         (add-before 'install 'install-tex-files
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((target (string-append (assoc-ref outputs "out")
+                                          "/share/texmf-dist/tex/latex/pdfx")))
+               (mkdir-p target)
+               (copy-recursively (assoc-ref inputs "texlive-tex-pdfx") target)
+               ;; Install the generated version in the "install" phase.
+               (delete-file (string-append target "/pdfx.sty"))
+               #t))))))
+    (propagated-inputs
+     `(("texlive-generic-pdftex" ,texlive-generic-pdftex)))
+    (native-inputs
+     `(("texlive-tex-pdfx"
+        ,(origin
+           (method svn-fetch)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/tex/latex/pdfx"))
+                 (revision %texlive-revision)))
+           (file-name (string-append "texlive-tex-latex-pdfx-" version "-checkout"))
+           (sha256
+            (base32
+             "14j1zsvqc59ims3sk34v6km8db6cimks28y5fcxcr5mi2ykvj4vf"))))))
+    (home-page "https://www.ctan.org/pkg/pdfx")
+    (synopsis "PDF/X and PDF/A support for pdfTeX, LuaTeX and XeTeX")
+    (description
+     "This package helps LaTeX users to create PDF/X, PFD/A and other
+standards-compliant PDF documents with pdfTeX, LuaTeX and XeTeX.")
+    (license license:lppl1.2+)))