gnu: Add texlive-latex-xmpincl.
[jackhill/guix/guix.git] / gnu / packages / tex.scm
index e616738..d2ded49 100644 (file)
@@ -3,7 +3,7 @@
 ;;; 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>
@@ -49,6 +49,7 @@
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gd)
   #:use-module (gnu packages ghostscript)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
@@ -60,6 +61,7 @@
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages shells)
       (patches
        (list
         ;; This is required for compatibility with Poppler 0.64.0 and to fix a
-        ;; segmentation fault in dvipdfm-x from XeTeX.
+        ;; segmentation fault in dvipdfm-x from XeTeX, and also contains a fix
+        ;; for CVE-2018-17407.
         (origin
           (method url-fetch)
           (uri (string-append "http://www.linuxfromscratch.org/patches/blfs/"
-                              "svn/texlive-" version "-source-upstream_fixes-1.patch"))
+                              "svn/texlive-" version "-source-upstream_fixes-2.patch"))
           (file-name "texlive-poppler-compat.patch")
           (sha256
            (base32
-            "0f8vhyj167y4xj0jx47vkybrcacfpxw0wdn1b777yq3xmhlahhlg")))))))
+            "04sxy1qv9y575mxwyg3y7rx7mh540pfjqx7yni7ncb5wjbq9pq1a")))
+        (search-patch "texlive-bin-luatex-poppler-compat.patch")
+        (search-patch "texlive-bin-pdftex-poppler-compat.patch")
+        (search-patch "texlive-bin-xetex-poppler-compat.patch")))))
    (build-system gnu-build-system)
    (inputs
     `(("texlive-extra-src" ,texlive-extra-src)
                    (unpack (assoc-ref %standard-phases 'unpack))
                    (patch-source-shebangs
                     (assoc-ref %standard-phases 'patch-source-shebangs)))
+              (substitute* (string-append share "/texmf-dist/web2c/texmf.cnf")
+                ;; Don't truncate lines.
+                (("^error_line = .*$") "error_line = 254\n")
+                (("^half_error_line = .*$") "half_error_line = 238\n")
+                (("^max_print_line = .*$") "max_print_line = 1000\n"))
               ;; Create symbolic links for the latex variants and their
               ;; man pages.
               (with-directory-excursion (string-append out "/bin/")
@@ -536,6 +547,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")
@@ -605,31 +652,37 @@ documents.")
                        (string-append (getcwd) ":"
                                       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; "
+                                                "mag:=1+0/600; "
                                                 "batchmode; "
                                                 "input "
-                                                (basename font ".mf"))))
+                                                (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$"))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (tfm (string-append
-                          out "/share/texmf-dist/fonts/tfm/public/cm"))
-                    (mf (string-append
-                         out "/share/texmf-dist/fonts/source/public/cm"))
-                    (type1 (string-append
-                            out "/share/texmf-dist/fonts/type1/public/amsfonts/cm")))
+             (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")))
                (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)
                #t))))))
@@ -767,6 +820,43 @@ originals.")
     ;; With font exception
     (license license:gpl2+)))
 
+(define-public texlive-fonts-lm
+  (package
+    (name "texlive-fonts-lm")
+    (version "2.004")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://www.gust.org.pl/projects/e-foundry/"
+                                  "latin-modern/download/lm" version "bas.zip"))
+              (sha256
+               (base32
+                "0z2s253y751m2ci5aw8nq0sf2kyg9hpimv2gyixkch9d07m2b9wp"))))
+    (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/")))
+           (mkdir-p root)
+           (with-directory-excursion root
+             (invoke (string-append (assoc-ref %build-inputs "unzip")
+                                    "/bin/unzip")
+                     (assoc-ref %build-inputs "source")))
+           #t))))
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (home-page "http://www.gust.org.pl/projects/e-foundry/latin-modern/")
+    (synopsis "Latin Modern family of fonts")
+    (description "The Latin Modern fonts are derived from the famous Computer
+Modern fonts designed by Donald E. Knuth and described in Volume E of his
+Computers & Typesetting series.")
+    ;; The GUST font license (GFL) is legally identical to the LaTeX Project
+    ;; Public License (LPPL), version 1.3c or later, but comes with an
+    ;; additional but not legally binding clause.
+    (license license:lppl1.3c+)))
+
 (define-public texlive-fonts-knuth-lib
   (package
     (name "texlive-fonts-knuth-lib")
@@ -802,13 +892,17 @@ originals.")
                        (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"))
@@ -907,6 +1001,98 @@ class), line and circle fonts (for use in the picture environment) and LaTeX
 symbol fonts.")
     (license license:lppl1.2+)))
 
+(define-public texlive-latex-mflogo
+  (package
+    (name "texlive-latex-mflogo")
+    (version (number->string %texlive-revision))
+    (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")
@@ -926,6 +1112,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
@@ -934,7 +1121,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")
@@ -964,23 +1151,136 @@ 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 outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (tfm (string-append
-                          out "/share/texmf-dist/fonts/tfm/public/amsfonts"))
-                    (mf  (string-append
-                          out "/share/texmf-dist/fonts/source/public/amsfonts")))
-               (for-each (cut install-file <> tfm)
-                         (find-files "build" "\\.*"))
-               (for-each (cut install-file <> mf)
-                         (find-files "." "\\.mf"))
-               #t))))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (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)
+           (uri (svn-reference
+                 (url (string-append "svn://www.tug.org/texlive/tags/"
+                                     %texlive-tag "/Master/texmf-dist/"
+                                     "/fonts/type1/public/amsfonts"))
+                 (revision %texlive-revision)))
+           (file-name (string-append name "-type1-" version "-checkout"))
+           (sha256
+            (base32
+             "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
@@ -1108,15 +1408,8 @@ book).")
                         (getcwd) ":"
                         (getcwd) "/build:"
                         (string-join
-                         (append-map (match-lambda
-                                       ((_ . dir)
-                                        (find-files dir
-                                                    (lambda (_ stat)
-                                                      (eq? 'directory (stat:type stat)))
-                                                    #:directories? #t
-                                                    #:stat stat)))
-                                     inputs)
-                         ":")))
+                         (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.
@@ -1346,9 +1639,7 @@ users, via its Plain TeX version.)")
     (build-system texlive-build-system)
     (arguments
      '(#:tex-directory "latex/fancyvrb"
-       ;; We exclude "fvrb-ex" to avoid a dependency on texlive-luaotfload and
-       ;; thus texlive-luatex-lualibs.
-       #:build-targets '("fancyvrb.ins")))
+       #:tex-format "latex"))
     (home-page "https://www.ctan.org/pkg/fancyvrb")
     (synopsis "Sophisticated verbatim text")
     (description
@@ -1472,6 +1763,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
@@ -1508,6 +1802,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
@@ -1752,6 +2048,98 @@ this bundle for use independent of ConTeXt.")
     ;; GPL version 2 only
     (license license:gpl2)))
 
+(define-public texlive-luatex-luaotfload
+  (package
+    (name "texlive-luatex-luaotfload")
+    (version "2.8-fix-2")
+    ;; The release tarball does not contain all source files.
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/lualatex/luaotfload.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0l5l7iq3dxcxl65qaghcpjg27yd9iw1sxa8pnd7xlvlm09dhfdnf"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags
+       (list (string-append "DESTDIR="
+                            (assoc-ref %outputs "out")
+                            "/share/texmf-dist")
+             "all")
+       #:parallel-build? #f ; not supported
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "doc/Makefile"
+               (("rst2man") "rst2man.py")
+               ;; Don't build the PDF.  This requires more of LaTeX.
+               (("\\$\\(DOCPDF\\)") ""))
+
+             (substitute* "Makefile"
+               ;; We don't build the PDF, so don't attempt to install it.
+               (("cp \\$\\(RESOURCES\\) \\$\\(DOCPDF\\)")
+                "cp $(RESOURCES)")
+               (("= \\$\\(DOCPDF\\)") "= ")
+               ;; Fix name of fontloader file
+               (("^LOADER.*= \\$\\(BUILDDIR\\)/fontloader-\\$\\(shell date \\+%F\\).lua")
+                "LOADER = $(BUILDDIR)/fontloader.lua"))
+
+             (mkdir "build")
+
+             ;; Don't download this file.
+             (copy-file (assoc-ref inputs "glyphlist")
+                        "build/glyphlist.txt")
+
+             ;; Don't use git
+             (let ((notes
+                    `((committer . "Philipp Gesang <phg@phi-gamma.net>")
+                      (description . ,version)
+                      (loader . "fontloader.lua")
+                      (revision . "ad480924393fffa2896156e1a32c22f5c61120dd")
+                      (timestamp . "2019-01-01 00:00:00 +0000"))))
+               (substitute* "scripts/mkstatus"
+                 (("local notes.*=.*")
+                  (string-append "local notes = {"
+                                 (string-join
+                                  (map (lambda (entry)
+                                         (format "[\"~a\"]=\"~a\","
+                                                 (symbol->string (car entry))
+                                                 (cdr entry)))
+                                       notes))
+                                 "}"))))
+             #t)))))
+    (native-inputs
+     `(("zip" ,zip)
+       ("unzip" ,unzip)
+       ("graphviz" ,graphviz)
+       ("lualatex" ,(texlive-union (list texlive-luatex-lualibs
+                                         texlive-context-base)))
+       ("python-docutils" ,python-docutils)
+       ("glyphlist"
+        ,(origin
+           (method url-fetch)
+           (uri (string-append "https://raw.githubusercontent.com/adobe-type-tools/"
+                               "agl-aglfn/b2a04cb906f9257cc06a2fe0ad4b3d663bc02136/"
+                               "glyphlist.txt"))
+           (sha256
+            (base32 "1s6svfw23rqzdvflv8frgd4xrwvrmsj8szwzqgcd39dp9rpjafjp"))))))
+    (propagated-inputs
+     `(("texlive-luatex-lualibs" ,texlive-luatex-lualibs)))
+    (home-page "https://github.com/lualatex/luaotfload")
+    (synopsis "OpenType font loader for LuaTeX")
+    (description
+     "Luaotfload is an adaptation of the ConTeXt font loading system for the
+Plain and LaTeX formats.  It allows OpenType fonts to be loaded with font
+features accessible using an extended font request syntax while providing
+compatibilitywith XeTeX.  By indexing metadata in a database it facilitates
+loading fonts by their proper names instead of file names.")
+    ;; GPL version 2 only
+    (license license:gpl2)))
+
 (define-public texlive-latex-amsmath
   (package
     (name "texlive-latex-amsmath")
@@ -2483,8 +2871,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.
@@ -2800,6 +3197,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
@@ -3339,64 +3738,525 @@ 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-fonts-rsfs
+(define-public texlive-fonts-adobe-times
   (package
-    (name "texlive-fonts-rsfs")
+    (name "texlive-fonts-adobe-times")
     (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/rsfs/"))
+                                        "/fonts/type1/urw/times/"))
                     (revision %texlive-revision)))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "0r12pn02r4a955prcvq0048nifh86ihlcgvw3pppqqvfngv34l5h"))))
-    (build-system gnu-build-system)
+                "15vzyr7favkv1mj00qxr03s89kw78nd066fh69by93272g8p5sgd"))))
+    (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/public/rsfs"))
-                    (mf  (string-append
-                          out "/share/texmf-dist/fonts/source/public/rsfs")))
-               (for-each (cut install-file <> tfm)
-                         (find-files "build" "\\.*"))
-               (for-each (cut install-file <> mf)
+     `(#: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
+     "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-fonts-adobe-palatino
+  (package
+    (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/"
+                                        "/fonts/type1/urw/palatino/"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "18dw5260c6fy7acxaqwrg3hw04kg63ijq4lkn56q5pa2g6nyylrp"))))
+    (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/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))))
+    (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 a drop-in replacements for the Palatino font from
+Adobe's basic set.")
+    ;; No license version specified.
+    (license license:gpl3+)))
+
+(define-public texlive-fonts-adobe-zapfding
+  (package
+    (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/type1/urw/zapfding/"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "1sp3jblg3khp0yj121blvhph6ib09919kyrsk5x2lg258yypqyis"))))
+    (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/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
+     `(("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
+     "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
+    (name "texlive-fonts-rsfs")
+    (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/rsfs/"))
+                    (revision %texlive-revision)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0r12pn02r4a955prcvq0048nifh86ihlcgvw3pppqqvfngv34l5h"))))
+    (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/public/rsfs"))
+                    (mf  (string-append
+                          out "/share/texmf-dist/fonts/source/public/rsfs")))
+               (for-each (cut install-file <> tfm)
+                         (find-files "build" "\\.*"))
+               (for-each (cut install-file <> mf)
                          (find-files "." "\\.mf"))
                #t))))))
     (native-inputs
@@ -4323,6 +5183,11 @@ directly generate PDF documents instead of DVI.")
       #:phases
         (modify-phases (map (cut assq <> %standard-phases)
                             '(set-paths unpack patch-source-shebangs))
+          (add-after 'unpack 'unset-environment-variables
+            (lambda _
+              (unsetenv "TEXMF")
+              (unsetenv "TEXMFCNF")
+              #t))
           (add-after 'patch-source-shebangs 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((share (string-append (assoc-ref outputs "out") "/share")))
@@ -4628,13 +5493,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
@@ -4642,25 +5506,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")
@@ -4672,20 +5539,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"
@@ -4695,56 +5562,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/")
@@ -5025,6 +5904,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
@@ -5514,3 +6395,90 @@ 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+)))