Tex: Difference between revisions

imported>StefanSchroeder
Add more getting started material
Fix link to texlive package spec
 
(6 intermediate revisions by 4 users not shown)
Line 26: Line 26:
A good starting point is to install the TeX-Live basic setup:
A good starting point is to install the TeX-Live basic setup:


<code>nix-env -iA nixos.texlive.combined.scheme-basic</code>
<code>nix-env -iA nixpkgs.texlive.combined.scheme-basic</code>


After installation, the command <code>pdflatex</code> should be available. Save the minimal example above in a file called minimal.tex and compile it with <code>pdflatex minimal.tex</code>
After installation, the command <code>pdflatex</code> should be available. Save the minimal example above in a file called minimal.tex and compile it with <code>pdflatex minimal.tex</code>
Line 32: Line 32:
The (pretty verbose) output will look similar to:
The (pretty verbose) output will look similar to:


<pre>
<syntaxhighlight lang=console>
$ pdflatex minimal.tex
$ pdflatex minimal.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2019/NixOS.org)
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2019/NixOS.org)
Line 47: Line 47:
Output written on minimal.pdf (1 page, 12502 bytes).
Output written on minimal.pdf (1 page, 12502 bytes).
Transcript written on minimal.log.
Transcript written on minimal.log.
</pre>
</syntaxhighlight>


Well done, you created your first PDF document on Nixos using TeX.
Well done, you created your first PDF document on Nixos using TeX.
If you need many different packages or find that you are missing packages, consider to install the
package '''nixpkgs.texlive.combined.scheme-full''', but be aware that it is pretty huge (1-2 GB).


== Next steps ==
== Next steps ==
Line 66: Line 63:
<code>pdflatex sample2e</code>
<code>pdflatex sample2e</code>


You can then use any PDF viewer to display it, e.g. <code>evince</code> in GNOME, <code>okular</code> in KDE, <code>xpdf</code> or <code>zathura</code> lightweight X11-viewer.


=== Using Texlive packages ===
=== Using Texlive packages ===


If you have installed the 'Full' scheme, all TeXLive packages should already be installed.
If you need many different packages or find that you are missing packages, consider to install the
package '''nixpkgs.texlive.combined.scheme-full''', but be aware that it is pretty huge (about 5 GB).
 
If you don't want to install the Full scheme, but still need a collection of specific packages, follow the instructions on the  [[TexLive]]  page.


=== Using CTAN packages ===
=== Using CTAN packages ===
Line 82: Line 83:


You might want to review [https://github.com/NixOS/nixpkgs/issues/17748]
You might want to review [https://github.com/NixOS/nixpkgs/issues/17748]
=== Removing packages from a collection ===
If you want to package and install a fresher version of some TeXLive package, you might experience a collision with a package from a scheme or a collection you have installed as a whole. To resolve this issue, remove the package by pname from pkgs.
Example code:
<syntaxhighlight lang=nix>
    pkgs.texlive.combine {
      scheme-medium = pkgs.texlive.scheme-medium // {
        pkgs = pkgs.lib.filter
          (x: (x.pname != "apxproof"))
          pkgs.texlive.scheme-medium.pkgs;
      };
   
      apxproof = { pkgs = [(pkgs.runCommand "apxproof" {
        src = pkgs.fetchurl {
          url = "https://raw.githubusercontent.com/PierreSenellart/apxproof/1ac14c47b8351b693ca05eec73dca1332a517ac9/apxproof.sty";
          sha256 = "sha256-XSgtXsOwhMu2Wo4hVp8ZfaPWgjEEg3EBn5/BhD3xkMA=";
        };
        passthru = {
          pname = "apxproof";
          version = "1.2.3";
          tlType = "run";
        };
      }
      "
        mkdir -p $out/tex/latex/apxproof/
        cp $src $out/tex/latex/apxproof/apxproof.sty
      ")]; };
    }
</syntaxhighlight>


== Frequently asked questions FAQ ==
== Frequently asked questions FAQ ==
Line 89: Line 123:
As noted on [[TexLive]] there are several schemas available. If you know exactly which packages you are going to need you can follow the recipe on the [[TexLive]] page. Installing the Full-schema is always an option to be sure that you have everything you need, like so:
As noted on [[TexLive]] there are several schemas available. If you know exactly which packages you are going to need you can follow the recipe on the [[TexLive]] page. Installing the Full-schema is always an option to be sure that you have everything you need, like so:


<code>nix-env -iA nixos.texlive.combined.scheme-full</code>
<code>nix-env -iA nixpkgs.texlive.combined.scheme-full</code>
 
If you are looking for a smaller package, you need to go the [https://raw.githubusercontent.com/NixOS/nixpkgs/refs/heads/master/pkgs/tools/typesetting/tex/texlive/tlpdb.nix Nixpkg's package specification] and search for the scheme-name. For each scheme the list of packages is listed there. Since the inclusion of packages is organized hierarchically, this will require some digging. (TODO: Is there a nix-command to find out?)


If you are looking for a smaller package, you need to go the [https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/tools/typesetting/tex/texlive/pkgs.nix Nixpkg's package specification] and search for the scheme-name. For each scheme the list of packages is listed there. Since the inclusion of packages is organized hierarchically, this will require some digging. (TODO: Is there a nix-command to find out?)
[[Category:Languages]]