123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- (define-module (staging tex)
- #:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix packages)
- #:use-module (guix git-download)
- #:use-module (guix svn-download)
- #:use-module (guix utils)
- #:use-module (guix build-system texlive)
- #:use-module (guix build-system trivial)
- #:use-module (gnu packages tex))
- (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-public texlive-amsfonts-patched
- (let ((template (simple-texlive-package
- "texlive-amsfonts"
- (list "/source/latex/amsfonts/"
- "/fonts/source/public/amsfonts/"
- "/fonts/type1/public/amsfonts/"
- "/fonts/afm/public/amsfonts/"
- "/fonts/map/dvips/amsfonts/"
- "/tex/plain/amsfonts/"
- "/doc/fonts/amsfonts/")
- (base32
- "15q70nkjf8wqzbd5ivcdx3i2sdgqxjb38q0qn9a2qw9i0qcnx6zw"))))
- (package
- (inherit template)
- (arguments
- (substitute-keyword-arguments (package-arguments template)
- ((#:build-targets _ #t)
- '(list "amsfonts.ins"))
- ((#:tex-directory _ #t)
- "latex/amsfonts")
- ((#:modules modules '())
- `((guix build texlive-build-system)
- (guix build utils)
- (ice-9 match)
- (srfi srfi-1)
- (srfi srfi-26)))
- ((#:phases phases)
- `(modify-phases ,phases
- (add-before 'build 'build-fonts
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((mf (assoc-ref inputs "texlive-union"))
- (src (string-append (getcwd) "/fonts/source/public/amsfonts/")))
- ;; Make METAFONT reproducible
- (setenv "SOURCE_DATE_EPOCH" "1")
- ;; 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 src ":"
- src "/cmextra:"
- src "/cyrillic:"
- src "/dummy:"
- src "/symbols:"
- mf "/share/texmf-dist/metafont/base:"
- (assoc-ref inputs "texlive-cm")
- "/share/texmf-dist/fonts/source/public/cm")))
- (let ((build (string-append (getcwd) "/build-fonts")))
- (mkdir-p build)
- (with-directory-excursion "fonts/source/public/amsfonts"
- (for-each (lambda (font)
- (format #t "building font ~a\n" (basename font ".mf"))
- (with-directory-excursion (dirname font)
- (invoke "mf" "-progname=mf"
- (string-append "-output-directory=" build)
- (string-append "\\"
- "mode:=ljfour; "
- "mag:=1; "
- "nonstopmode; "
- "input "
- (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.
- (let ((build (string-append (getcwd) "/build-fonts/euler")))
- (mkdir build)
- (with-directory-excursion "fonts/afm/public/amsfonts/euler/"
- (for-each (lambda (font)
- (format #t "converting afm font ~a\n" (basename font ".afm"))
- (invoke "afm2tfm" font
- (string-append build "/"
- (basename font ".tfm"))))
- (find-files "." "\\.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.
- (setenv "TEXINPUTS"
- (string-append build "//:"
- (getcwd) "/fonts/afm/public/amsfonts//:"
- (getcwd) "/source/latex/amsfonts//:"
- (assoc-ref inputs "texlive-union") "//"))
- (with-directory-excursion build
- (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))
- (add-after 'install 'install-generated-fonts
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (copy-recursively "build-fonts"
- (string-append
- (assoc-ref outputs "out")
- "/share/texmf-dist/fonts/tfm/public/amsfonts"))
- #t))))))
- (native-inputs
- `(("texlive-union" ,(texlive-union (list texlive-tex-fontinst-base
- texlive-cm
- texlive-metafont-base)))))
- (home-page "https://www.ctan.org/pkg/amsfonts")
- (synopsis "TeX fonts from the American Mathematical Society")
- (description
- "This package provides an extended set of fonts for use in mathematics,
- including: extra mathematical symbols; blackboard bold letters (uppercase
- only); fraktur letters; subscript sizes of bold math italic and bold Greek
- letters; subscript sizes of large symbols such as sum and product; added sizes
- of the Computer Modern small caps font; cyrillic fonts (from the University of
- Washington); Euler mathematical fonts. All fonts are provided as Adobe Type 1
- files, and all except the Euler fonts are provided as Metafont source. The
- distribution also includes the canonical Type 1 versions of the Computer
- Modern family of fonts. The Euler fonts are supported by separate packages;
- details can be found in the documentation.")
- (license license:silofl1.1))))
- (define-public texlive-logreq
- (package
- (name "texlive-logreq")
- (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/logreq"))
- (revision %texlive-revision)))
- (file-name (string-append name "-" version "-checkout"))
- (sha256
- (base32
- "016l3p0f315cwq2ylpd2a7dwlxb42xxcd2al5j1wpg8g8scwbfq5"))))
- (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/logreq")))
- (mkdir-p target)
- (copy-recursively (assoc-ref %build-inputs "source") target)
- #t))))
- (home-page "https://www.ctan.org/pkg/logreq")
- (synopsis "Support for automation of the LaTeX workflow")
- (description
- "The package helps to automate a typical LaTeX workflow that
- involves running LaTeX several times, running tools such as BibTeX or
- makeindex, and so on. It will log requests like \"please rerun LaTeX\"
- or \"please run BibTeX on file X\" to an external XML file which lists
- all open tasks in a machine-readable format. Compiler scripts and
- integrated LaTeX editing environments may parse this file to determine
- the next steps in the workflow in a way that is more efficient than
- parsing the main log file. In sum, the package will do two things:
- enable package authors to use LaTeX commands to issue requests,
- collect all requests from all packages and write them to an external
- XML file at the end of the document.")
- (license license:lppl1.3)))
- (define-public texlive-biblatex
- (package
- (name "texlive-biblatex")
- (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/biblatex"))
- (revision %texlive-revision)))
- (file-name (string-append name "-" version "-checkout"))
- (sha256
- (base32
- "116wczqpk3lyc7a18a918bd35pqm4cpngv67xs35g864hp24s7m2"))))
- (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/biblatex")))
- (mkdir-p target)
- (copy-recursively (assoc-ref %build-inputs "source") target)
- #t))))
- (propagated-inputs
- `(("texlive-latex-etoolbox" ,texlive-latex-etoolbox)
- ("texlive-url" ,texlive-url)
- ("texlive-etex" ,texlive-etex)
- ("texlive-logreq" ,texlive-logreq)))
- (home-page "https://www.ctan.org/pkg/biblatex")
- (synopsis "Process bibliographies for LaTeX")
- (description
- "BibLaTeX is a complete reimplementation of the bibliographic
- facilities provided by LaTeX. Formatting of the bibliography is
- entirely controlled by LaTeX macros, and a working knowledge of LaTeX
- should be sufficient to design new bibliography and citation
- styles. BibLaTeX uses its own data backend program called \"biber\" to
- read and process the bibliographic data. With biber, BibLaTeX has many
- features rivalling or surpassing other bibliography systems. To
- mention a few: Full Unicode support Highly customisable sorting using
- the Unicode Collation Algorithm + CLDR tailoring Highly customisable
- bibliography labels Complex macro-based on-the-fly data modification
- without changing your data sources A tool mode for transforming
- bibliographic data sources Multiple bibliographies and lists of
- bibliographic information in the same document with different sorting
- Highly customisable data source inheritance rules Polyglossia and
- babel suppport for automatic language switching for bibliographic
- entries and citations Automatic bibliography data recoding (UTF-8 ->
- latin1, LaTeX macros -> UTF-8 etc) Remote data sources Highly
- sophisticated automatic name and name list disambiguation system
- Highly customisable data model so users can define their own
- bibliographic data types Validation of bibliographic data against a
- data model Subdivided and/or filtered bibligraphies, bibliographies
- per chapter, section etc. Apart from the features unique to BibLaTeX,
- the package also incorporates core features of the following packages:
- babelbib, bibtopic, bibunits, chapterbib, cite, inlinebib, mcite and
- mciteplus, mlbib, multibib, splitbib. The package strictly requires
- e-TeX BibTeX, bibtex8, or Biber etoolbox 2.1 or later logreq 1.0 or
- later keyval ifthen url Biber, babel / polyglossia, and csquotes 4.4
- or later are strongly recommended.")
- (license license:lppl1.3)))
- texlive-biblatex
|