I’m using Latex with a shell.nix, which I pieced together from some examples. I tried to add the mathdesign package following the “instruction” in Nixos Search Packages. The shell builds without error, but when I try to usepackage{mathdesign} I get the error that mathdesign.sty was not found. Does anyone have an example of a shell.nix or flake.nix that allows me to add additional packages properly? Thanks. (I’m just trying to get garamond font, and that is apparently where it lives.)
FWIW, I’m using:
with import <nixpkgs> {};
let
basePackages = with texlive; [
combined.scheme-medium
];
myvscode = pkgs.vscode-with-extensions.override {
vscodeExtensions = with pkgs.vscode-extensions; [
equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
james-yu.latex-workshop
vscodevim.vim
vscode-extensions.valentjn.vscode-ltex
];
};
mytex = texlive.withPackages (ps: [ ps.mathdesign ]);
in mkShell {
buildInputs = basePackages ++ [myvscode mytex];
I think your combined.scheme-medium
is actually overwritting mytex
. They are two separate texlive “instances”. Simply having them both in buildInputs
will not compose them together.
As per the nixpkgs manual, you can either use:
-
texlive.combine { inherit (texlive) scheme-medium mathdesign; }
; or
texliveMedium.withPackages (ps: [ps.mathdesign])
I like the second one better, so here’s how you can tweak your existing .nix to use it:
let
pkgs = import <nixpkgs> { config.allowUnfree = true; };
myvscode = pkgs.vscode-with-extensions.override {
vscodeExtensions = (with pkgs.vscode-extensions; [
equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
james-yu.latex-workshop
vscodevim.vim
valentjn.vscode-ltex
]);
};
mytex = pkgs.texliveMedium.withPackages (ps: [ ps.mathdesign ]);
in
pkgs.mkShell {
buildInputs = [ myvscode mytex ];
}
Also, try to avoid with
as it makes things more complicated by mixing scopes. I removed the top level with
and enclosed the vscode-extensions one to make things clearer.
Thanks a lot. That’s the guidance I need.
I still get the error mathdesign.sty not found
when I \usepackage[urw-garamond]{mathdesign}
. I tried both approaches without a build error, it just can’t find the sty module.
Hmmm, can you try texliveFull
? If it doesn’t work, then the problem lies elsewhere.
Just tried it and I’m afraid it doesn’t work with full either.