Mk, a simple macro package for troff

Last updated on Sun Jul 4 21:10:46 CEST 2021.

Mk is a simple, modern and highly flexible macro package that provides useful macros for advanced documents, while abstracting as little as possible from troff itself.

Unlike other macro packages, mk has no special registers or strings. It uses standard troff requests to control settings like font family, point size and vertical spacing, which are saved in environments instead of registers. As such, mk is a great macro package for learning troff. Beginners will only need to learn one way to do each thing, and it will be the standard troff way.

Mk is tested with GNU troff and Heirloom troff. It should also support Neatroff. In its current implementation, it requires a troff implementation with support for long identifiers and more than three environments.

To get started with mk, download the latest version, edit the Makefile and run make install.

User guide
http://git.ankarstrom.se/mk/plain/mk/README.pdf
Developer guide
http://git.ankarstrom.se/mk/plain/mk/HACKING.pdf
Git repository
http://git.ankarstrom.se/mk/
Download latest version
http://git.ankarstrom.se/mk/snapshot/mk-0.2.tar.gz

The mk distribution also includes the toc and list utilities, which are used to generate tables of contents and automatically escape code listings.

If you have any questions about mk, feel free to contact me via e-mail on john at ankarstrom.se.

Example

Here is an outline of a basic mk document:

.t
Document title
.d
Author
.d e \" current date
.
.h
First heading
.p
This is a paragraph.
.s
Subheading
.q
Indented quotation.
.
.h
Second heading, with
.x "bold italic"
text.
.p
This is a paragraph with a footnote\c
.(
This is a footnote.
.) .

A screenshot of the results is included near the top of this page.