Jump to content

TexLive: Difference between revisions

From NixOS Wiki
Granddave (talk | contribs)
m Capitalize NixOS according to MoS
Crdr (talk | contribs)
Use withPackages to follow the new changes in 23.11, as well as the new names for schemes
 
Line 7: Line 7:
organization of TeX Live into 'schemes' and 'collections'
organization of TeX Live into 'schemes' and 'collections'


The following Tex Live schemes are available:
The following Tex Live schemes are available, inspect <code>texlive.schemes</code> for full list:


{| class="wikitable"
{| class="wikitable"
Line 16: Line 16:
  |-
  |-
  |width=20% valign=top| Scheme-full
  |width=20% valign=top| Scheme-full
  |width=50% valign=top| <code>nixpkgs.texlive.combined.scheme-full</code>
  |width=50% valign=top| <code>nixpkgs.texliveFull</code>
  |width=30% valign=top| Contains every TeX Live package
  |width=30% valign=top| Contains every TeX Live package
  |-
  |-
  | Scheme-medium
  | Scheme-medium
  | <code>nixpkgs.texlive.combined.scheme-medium</code>
  | <code>nixpkgs.texliveMedium</code>
  | contains everything in the small scheme + more packages and languages
  | contains everything in the small scheme + more packages and languages
  |-
  |-
  | Scheme-small
  | Scheme-small
  | <code>nixpkgs.texlive.combined.scheme-small</code>
  | <code>nixpkgs.texliveSmall</code>
  | contains everything in the basic scheme + xetex, metapost, a few languages.
  | contains everything in the basic scheme + xetex, metapost, a few languages.
  |-
  |-
  | Scheme-basic
  | Scheme-basic
  | <code>nixpkgs.texlive.combined.scheme-basic</code>
  | <code>nixpkgs.texliveBasic</code>
  | contains everything in the plain scheme but includes latex.
  | contains everything in the plain scheme but includes latex.
  |-
  |-
  | Scheme-minimal
  | Scheme-minimal
  | <code>nixpkgs.texlive.combined.scheme-minimal</code>
  | <code>nixpkgs.texliveMinimal</code>
  | contains plain only.
  | contains plain only.
  |-
  |-
  | Scheme-teTeX
  | Scheme-teTeX
  | <code>nixpkgs.texlive.combined.scheme-tetex</code>
  | <code>nixpkgs.texliveTeTex</code>
  | contains more than the medium scheme, but nowhere near the full scheme.
  | contains more than the medium scheme, but nowhere near the full scheme.
  |-
  |-
  | Scheme-ConTeXt
  | Scheme-ConTeXt
  | <code>nixpkgs.texlive.combined.scheme-context</code>
  | <code>nixpkgs.texliveConTeXt</code>
  | contains ConTeXt
  | contains ConTeXt
  |-
  |-
  | Scheme-GUST
  | Scheme-GUST
  | <code>nixpkgs.texlive.combined.scheme-gust</code>
  | <code>nixpkgs.texliveGUST</code>
  | contains gust
  | contains gust
  |}
  |}
Line 51: Line 51:
You can install a set with extra packages by using something like
You can install a set with extra packages by using something like


<code>(texlive.combine {
<code>(texliveMedium.withPackages (ps: with ps;[xifthen ifmtarg framed paralist titlesec]))
inherit (texlive) scheme-medium xifthen ifmtarg framed paralist titlesec;
})
</code>
</code>


Line 60: Line 58:
{ config, pkgs, ... }:
{ config, pkgs, ... }:
let
let
   tex = (pkgs.texlive.combine {
   tex = (pkgs.texliveBasic.withPackages (
     inherit (pkgs.texlive) scheme-basic
     ps: with ps; [
       dvisvgm dvipng # for preview and export as html
       dvisvgm dvipng # for preview and export as html
       wrapfig amsmath ulem hyperref capt-of;
       wrapfig amsmath ulem hyperref capt-of
       #(setq org-latex-compiler "lualatex")
       #(setq org-latex-compiler "lualatex")
       #(setq org-preview-latex-default-process 'dvisvgm)
       #(setq org-preview-latex-default-process 'dvisvgm)
   });
   ]));
in
in
{ # home-manager
{ # home-manager
Line 96: Line 94:
             ├── corporate-identity.sty
             ├── corporate-identity.sty
You can now add the package to the combined set as you would with any other texlive package:
You can now add the package to the combined set as you would with any other texlive package:
  tex = pkgs.texlive.combine {
  tex =(pkgs.texlive.withPackages (
  inherit (pkgs.texlive) scheme-full;
    ps: with ps; [
  inherit texlive-corporate-identity;
      texlive-corporate-identity
};
  ]));


== Troubleshooting ==
== Troubleshooting ==

Latest revision as of 04:25, 4 November 2025

According to Wikipedia:

TeX Live is a free software distribution for the TeX typesetting system that includes major TeX-related programs, macro packages, and fonts.

Installation

Since TeX Live consist of thousands of packages, to make managing it easier, NixOS replicates the organization of TeX Live into 'schemes' and 'collections'

The following Tex Live schemes are available, inspect texlive.schemes for full list:

Name of TeX Live package Name of NixOS-derivation Comment
Scheme-full nixpkgs.texliveFull Contains every TeX Live package
Scheme-medium nixpkgs.texliveMedium contains everything in the small scheme + more packages and languages
Scheme-small nixpkgs.texliveSmall contains everything in the basic scheme + xetex, metapost, a few languages.
Scheme-basic nixpkgs.texliveBasic contains everything in the plain scheme but includes latex.
Scheme-minimal nixpkgs.texliveMinimal contains plain only.
Scheme-teTeX nixpkgs.texliveTeTex contains more than the medium scheme, but nowhere near the full scheme.
Scheme-ConTeXt nixpkgs.texliveConTeXt contains ConTeXt
Scheme-GUST nixpkgs.texliveGUST contains gust

Combine Sets

You can install a set with extra packages by using something like

(texliveMedium.withPackages (ps: with ps;[xifthen ifmtarg framed paralist titlesec]))

For a minimal set of packages needed for Emacs Orgmode, as described in org-latex-default-packages-alist variable, install these packages:

{ config, pkgs, ... }:
let
  tex = (pkgs.texliveBasic.withPackages (
    ps: with ps; [
      dvisvgm dvipng # for preview and export as html
      wrapfig amsmath ulem hyperref capt-of
      #(setq org-latex-compiler "lualatex")
      #(setq org-preview-latex-default-process 'dvisvgm)
  ]));
in
{ # home-manager
  home.packages = with pkgs; [
    tex
  ];
}

Adding a Custom Package

If you have a custom LaTeX package or style file that is not part of the TeXLive distribution, you can add it to the package set like this:

First, create a derivation for your package. The contents of $out/tex will later be placed in texmf/tex

latex-corporate-identity = pkgs.stdenvNoCC.mkDerivation {
  name = "latex-corporate-identity";
  src = ./path/to/package/tree;
  installPhase = "cp -r $src $out";
  passthru.tlType = "run";
};


texlive-corporate-identity = {
  pkgs = [ latex-corporate-identity ];
};

The directory tree under the path specified as src looks like this:

└── tex
    └── latex
        └── corporate-identity
            ├── corporate-identity.sty

You can now add the package to the combined set as you would with any other texlive package:

tex =(pkgs.texlive.withPackages (
   ps: with ps; [
     texlive-corporate-identity
 ]));

Troubleshooting

Missing lmodern.sty

If LaTex (perhaps through Pandoc) complains about missing lmodern.sty, make sure you have at least texlive.combined.scheme-medium installed (-full should work as well; while -small worked for some, but not for all).

Invalid fontname ‘Latin Modern Roman/ICU’

If you get an error message saying “Invalid fontname ‘Latin Modern Roman/ICU’. . . ”, then you need to add the entry lmodern into your configuration in the section fonts.fonts and rebuild.


Further reading