Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)

Table of contents:

Groff Cheatsheet

Written by Angad Sharma - original link

The helpful GNU troff cheatsheet along with examples.


General

CommandFunctionality
.RP [no]Prints cover page on its own. Can be avoided with .RP no
.TLTitle of the document
.AUAuthor Name
.AIAuthor Institution
.AB [no] and .AE blockAbstract beginning and end blocks. .AB no ensures the abstract keyword is silenced
.DA [XXX]Current date on title page and footers
.ND [XXX]Current date only on the title page
.1C1 columned layout
.2C2 columned layout
.MC [WIDTH[GUTTER]]Multiple column layout (by default 2 with no args)
.XS page_num and .XETable of contents block
.XA page_numEntry in the table of contents block
.PXPrint a manually-generated table of contents without resetting the page number.


Text Formatting

CommandFunctionality
.BBold
.IItalics
.BIBold and Italics
.P1Prints the header on page 1. The default is to suppress the header.
.BXBox
.ULUnderline
.LGPrints all text following in larger type (2 points larger than the current point size)
.SMPrints all text following in smaller type (2 points smaller than the current point size)
.NLPrints all text following in the normal point size
.RSets its first argument in roman (or regular) type. It operates similarly to the B macro otherwise.
.CWSets its first argument in italic type. It operates similarly to the B macro otherwise.


Paragraph Formatting

CommandFunctionality
.PPStandard paragraph
.QPQuoted paragraph
.XPThe XP macro produces an exdented paragraph. The first line of the paragraph begins at the left margin, and subsequent lines are indented (the opposite of PP).
.RS and .REStart and end a section of indented text, respectively. The PI register controls the amount of indent.
.IPList points. Use .IP \(bu [width] for bullet points with given width. Use .IP [number] for numbered points.
.TATabbing


Headings

CommandFunctionality
.NH xxxNumbered heading where numbers specify levels of depth
.SH xxxSection heading (un-numbered)
.LHLeft header
.CHCenter header
.RHRight header
.LFLeft footer
.CFCenter footer
.RFRight footer
.OHHeaders for odd pages. eg: .OH 'left'center'right'
.EHHeaders for even pages.


Pre Processing

CommandFunctionality
.TS [H] and .TEDenotes a table, to be processed by the tbl preprocessor. The optional H argument instructs groff to create a running header with the information up to the TH macro.
.PS and .PEDenotes a graphic, to be processed by the pic preprocessor. You can create a pic file by hand, using the AT&T pic manual available on the Web as a reference, or by using a graphics program such as xfig.
.EQ [align] and .ENDenotes an equation, to be processed by the eqn preprocessor. The optional align argument can be C, L, or I to center (the default), left-justify, or indent the equation.
.[ and .]References and citations block, to be processed by the refer preprocessor.


Custom Macros

CommandFunctionality
.de and ..You can define macros between this block. They can then be sourced by the same file as well as other files
.so filenameSource macros from filename

Graphics

CommandFunctionality
.PSPIC -[L/R/C/I n] [width[Height]] filename.epsInsert a post script image into groff.
.PDFPIC -[L/R/C/I n] [width[Height]] filename.epsInsert a PDF image into groff.

Configuring Paper Size

You can configure your virtual paper size using groff postprocessor that is built in. -P is used to pass in arguments to the posst processor:

groff -Tpdf -P-pa4 -P-l -ms file.ms > file.pdf

The command above takes an A4 sized virtual paper in landscape mode. Other valid formats are A, B, D sized papers along with letters, statements, ledgers and tabloids. Full reference is available in the DESC section of the groff_font man page.