11

I normally use pdflatex to compile latex documents, but on NixOS I do not see that pdflatex is available to install via $ nix-env -i pdflatex.

$ nix-env -qa pdflatex
error: selector ‘pdflatex’ matches no derivations

Results for pdflatex do not appear under search at nixos.org/nixos/packages.html either. However, I did notice there the package rubber, which apparently wraps other latex programs including pdflatex. After installing rubber and attempting to compile my latex document with it I get the following "pdflatex is not found" error.

$ rubber --pdf doc.tex
compiling doc.tex...
pdflatex not found
Running pdflatex failed.

How can I install pdflatex to compile latex documents on NixOS?

Why is rubber available for installation via nix-env whereas pdflatex, a dependency of rubber, is not?

As a side-note, the 'Tex/Latex' section of the manual does not explain this.

kballou
  • 132
  • 1
  • 1
  • 8
mherzl
  • 1,409
  • 2
  • 18
  • 31

1 Answers1

7

You're linking some ancient version of manual. It's explained in recent versions: http://nixos.org/nixpkgs/manual/#sec-language-texlive

nix-env -iA nixos.texlive.combined.scheme-basic

It is also explained the NixOS wiki: https://nixos.wiki/wiki/TexLive

Sridhar Ratnakumar
  • 883
  • 1
  • 7
  • 17
Vladimír Čunát
  • 1,258
  • 7
  • 11
  • 1
    Or, on non-NixOS: `nix-env -iA nixpkgs.texlive.combined.scheme-basic` (will throw `LaTeX Error: File 'lmodern.sty' not found.` though, and couldn't figure out how to link it after installing `nix-env -i lmodern`, based on [this answer](https://stackoverflow.com/questions/29201207/unable-to-compile-pdf-in-r-studio-latex-error-file-lmodern-sty-not-found).) – toraritte Jul 31 '18 at 17:07
  • You need to use the `.combine` function instead of installing TeX Live packages separately. – Vladimír Čunát Aug 05 '18 at 19:47
  • I see the same error pointed out by @toraritte even on NixOS 19.09. – Ashesh Jan 05 '20 at 16:14
  • @Ashesh: the answer is still the same. As TeX Live upstream designed it, `scheme-basic` is very small and does *not* include Latin Modern. It's in that manual how you can mix your own combination. If you want a simple "solution", just install a larger scheme instead, e.g. `scheme-small` does contain this font if I look correctly. – Vladimír Čunát Jan 07 '20 at 20:12
  • 1
    @VladimírČunát yeah, that's what I did in the end; it works with `scheme-medium` and not small. – Ashesh Jan 08 '20 at 15:53