12 May 2021
Neatroff is a typesetting tool for creating documents. It is a modern rewrite of GNU's groff (which has it's roots in `troff` from 1973). So this software has a very rich history, yet there's not much resources on the internet (in comparison to latex). So why should you care? Because it is extremaly fast. And does not weight 2GB like latex.
If you're using unix (macos is unix) or linux you probably have already groff or troff installed. You can use them mostly the same as neatroff.
The easiest method of installing neatroff is by using the neatroff_make repository. Just clone it with git then run make and it will download all needed resources (fonts, tmacs). Then go to the `/demo` directory and you can now test things out.neatroff_make
If you're using NixOS you can easily download neatroff from my nur:
$ nix-shell -p nur.repos.pn.neatroff
In that package you will find these binaries: eqn pdf pic post refer roff soin tbl
Here's a basic demo.ms file:
.TL This is document title .AU Patryk Niedźwiedziński .NH Intro .PP This is an introductory paragraph describing what the document will be about. As this document is created for demonstratory purposes it will be short and trivial.
Then run: `roff -ms demo.ms | pdf > demo.pdf`
(For groff: groff -ms demo.ms -Tpdf > demo.pdf)
Basically there are 3 types of tools in neatroff: preprocessors, text processor (a.k.a. roff) and postprocessors.
All of them easily customizable pipeline:
cat $file | eqn | tbl | roff -ms | pdf
Those are programs that run on source document. They prepare neatroff document for rendering i.e. render equations (eqn) or tables (tbl)
Thanks to simplicity of neatroff design you can simply write your own preprocessor. For example this is a preprocessor for fixing em-dashes: `cat source.ms | sed 's/---/\(em/g' | roff`
roff - it's the main tool in neatroff pipeline. It executes macros and produces postscript document.
Those are programs that run on output of roff, on postscript document. The most basic is pdf postprocessor for converting postscript to pdf.