groff

Basic Documents

Great a file called name.ms, with the following content:

1.TL
2Groff-Time
3.AU
4Ghost
5.NH
6How to Format Groff Documents.
7.PP
8Groff needs two new lines to show a new paragraph.

Then make a pdf from the document with:

groff -ems name.ms -Tpdf > name.pdf

The commands must be placed at the start of a line.

The available commands are:

Result Command
Section Header .NH 1
Subsection .NH 2
Subsubsection .NH 3
Paragraph .PP
Bold text .B "text"
Italic text .I "text"
Bold Italic text .BI "text"
Author .AU
Title .TL
Start abstract .AB
Start an equation .EQ
End an equation .EN

Equations

To format 2+2=5, we can do:

1.EQ
22+2=5
3.EN

The equation shorthands are predictable:

Symbol Macro
Greater than or equal to >=
Not equal !=
Superscript sup {thing}

Examples

The fraction 2/5ths:

1.EQ
2\[25]
3.EN

E=MC^2:

1.EQ
2E = MC sup 2
3.EN

Praedicate logic:

1.EQ
2\[fa] x Rx \[te] y Syx
3.EN