Tex: Difference between revisions

From NixOS Wiki
imported>StefanSchroeder
Added FAQ section.
imported>StefanSchroeder
m italicised question in FAQ section
Line 62: Line 62:
== Frequently asked questions FAQ ==
== Frequently asked questions FAQ ==


How do I figure out which Texlive-schema to install?  
''How do I figure out which Texlive-schema to install?''


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:

Revision as of 13:28, 8 October 2020

According to Wikipedia:

TeX [...]is a typesetting system which was designed and mostly written by Donald Knuth and released in 1978. TeX is a popular means of typesetting complex mathematical formulae; it has been noted as one of the most sophisticated digital typographical systems.

Nixpkgs provides a variety of different (and partially complementing) packages to allow the compilation of TeX-documents. Most prominently, the TexLive distribution (In Oct 2020 version 2019) is included that contains many of the packages that are hosted as part of the Comprehensive TeX Archive Network (CTAN).

Getting started

TeX-documents are not What-you-see-is-what-you-get, but written in plain text, containing tags, commands and functions that instruct the TeX-engine how to lay out the text (or figures or anything else) on the page.

A minimal TeX-document might look like this:

\documentclass{article}
\begin{document}
Hello, Nix.
\end{document}

The Nixpkgs-repository contains several TeX-compilers that have different advantages and disadvantages, support various output formats, encodings and have varying degrees of extensibility.

For the sake of this text we will assume that you you want to create a PDF from your TeX-source.

A good starting point is to install the TeX-Live basic setup:

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

After installation, the command pdflatex should be available. Save the minimal example above in a file called minimal.tex and compile it with pdflatex minimal.tex

The (pretty verbose) output will look similar to:

$ pdflatex minimal.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2019/NixOS.org)
entering extended mode
(minimal.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-05-14> (.../tex/latex/base\article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(.../tex/latex/base\size10.clo))
(.../tex/latex/l3backend\l3backend-pdfmode.def)
No file minimal.aux.
[1{.../pdftex/config/pdftex.map}]
(minimal.aux) )<.../fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on minimal.pdf (1 page, 12502 bytes).
Transcript written on minimal.log.

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

Use Texlive packages. TODO

Use CTAN packages TODO

Use home-made packages. TODO

Frequently asked questions FAQ

How do I figure out which Texlive-schema to install?

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:

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

If you are looking for a smaller package, you need to go the 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?)