nixpkgs-suyu/doc/languages-frameworks/texlive.xml

153 lines
4.3 KiB
XML
Raw Normal View History

<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="sec-language-texlive">
2018-05-02 01:54:21 +02:00
<title>TeX Live</title>
2018-05-02 01:54:21 +02:00
<para>
2019-09-18 22:12:54 +02:00
Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute <varname>texlive</varname>.
2018-05-02 01:54:21 +02:00
</para>
2018-09-01 21:06:38 +02:00
<section xml:id="sec-language-texlive-users-guide">
2018-05-02 01:54:21 +02:00
<title>User's guide</title>
<itemizedlist>
2018-05-02 01:54:21 +02:00
<listitem>
<para>
2019-09-18 22:12:54 +02:00
For basic usage just pull <varname>texlive.combined.scheme-basic</varname> for an environment with basic LaTeX support.
2018-05-02 01:54:21 +02:00
</para>
</listitem>
<listitem>
<para>
2019-09-18 22:12:54 +02:00
It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this:
2018-05-02 01:54:21 +02:00
<programlisting>
texlive.combine {
inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
}
2019-06-17 12:17:16 +02:00
</programlisting>
2019-09-18 22:12:54 +02:00
There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences).
2018-05-02 01:54:21 +02:00
</para>
</listitem>
<listitem>
<para>
2019-09-18 22:12:54 +02:00
By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add <varname>pkgFilter</varname> function to <varname>combine</varname>.
2018-05-02 01:54:21 +02:00
<programlisting>
texlive.combine {
# inherit (texlive) whatever-you-want;
pkgFilter = pkg:
pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super";
# elem tlType [ "run" "bin" "doc" "source" ]
# there are also other attributes: version, name
}
2019-06-17 12:17:16 +02:00
</programlisting>
2018-05-02 01:54:21 +02:00
</para>
</listitem>
<listitem>
<para>
You can list packages e.g. by <command>nix repl</command>.
<programlisting>
<prompt>$ </prompt>nix repl
<prompt>nix-repl> </prompt>:l &lt;nixpkgs>
<prompt>nix-repl> </prompt>texlive.collection-<keycap function="tab" />
</programlisting>
2018-05-02 01:54:21 +02:00
</para>
</listitem>
<listitem>
<para>
2019-09-18 22:12:54 +02:00
Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example <varname>scheme-basic</varname>, into the combination.
2018-05-02 01:54:21 +02:00
</para>
</listitem>
</itemizedlist>
2018-05-02 01:54:21 +02:00
</section>
<section xml:id="sec-language-texlive-custom-packages">
<title>Custom packages</title>
<para>
You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the <varname>tlType</varname> attribute. Here is a (very verbose) example:
<programlisting><![CDATA[
with import <nixpkgs> {};
let
foiltex_run = stdenvNoCC.mkDerivation {
pname = "latex-foiltex";
version = "2.1.4b";
passthru.tlType = "run";
srcs = [
(fetchurl {
url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx";
sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz";
})
(fetchurl {
url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins";
sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99";
})
];
unpackPhase = ''
runHook preUnpack
for _src in $srcs; do
cp "$_src" $(stripHash "$_src")
done
runHook postUnpack
'';
nativeBuildInputs = [ texlive.combined.scheme-small ];
dontConfigure = true;
buildPhase = ''
runHook preBuild
# Generate the style files
latex foiltex.ins
runHook postBuild
'';
installPhase = ''
runHook preInstall
path="$out/tex/latex/foiltex"
mkdir -p "$path"
cp *.{cls,def,clo} "$path/"
runHook postInstall
'';
meta = with lib; {
description = "A LaTeX2e class for overhead transparencies";
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ veprbl ];
platforms = platforms.all;
};
};
foiltex = { pkgs = [ foiltex_run ]; };
latex_with_foiltex = texlive.combine {
inherit (texlive) scheme-small;
inherit foiltex;
};
in
runCommand "test.pdf" {
nativeBuildInputs = [ latex_with_foiltex ];
} ''
cat >test.tex <<EOF
\documentclass{foils}
\title{Presentation title}
\date{}
\begin{document}
\maketitle
\end{document}
EOF
pdflatex test.tex
cp test.pdf $out
''
]]></programlisting>
</para>
</section>
</section>