| troff | R Documentation |
Below the ms macros (ms), a knitroff document is plain troff: requests on lines that begin with a dot, and escapes that begin with a backslash. This page covers what reports need, following groff(7) and groff_char(7) for groff 1.24.1.
a line beginning with . or ' is a request or a macro call, such as .PP. To begin a text line with either character, put \& (a zero-width character) before it.
a backslash begins an escape, such as \fB. Write a literal backslash as \e or \[rs].
a blank line, or a line beginning with a space, breaks the paragraph. In filled text, start each sentence on a new line: troff then puts the right space after its period.
.\" begins a comment line; \" begins a comment at the end of a line.
inline results (`r expr`) and .SR strings are escaped for you; output in listings is too.
ms resets indentation, line length and type size at each paragraph and heading, so inside an ms document prefer its own macros and registers (.RS, \n[LL], .LG) to .in, .ll and .ps.
.br | break the output line |
.sp [N] | break, and space down N (default one line) |
.bp | begin a new page |
.ne N | begin a new page unless N of space remains |
.ce [N] | centre the next N input lines (default 1); .ce 0 stops |
.nf, .fi | no filling (lines as in the source) / filling again |
.ad [l|r|c|b], .na | adjust lines left, right, centre or both margins / no adjustment |
.ft F | change to font F: R, I, B, BI, CR (constant width), or P (previous) |
.ps N | type size N points; .ps +2 larger |
.vs N | vertical spacing (baseline to baseline) |
.ll N | line length |
.in N, .ti N | indentation / indentation of the next line only |
.po N, .pl N | page offset (left margin) / page length |
.ta N ... | tab stops, such as .ta 1i 2i or .ta 2iR (right-aligned) |
.tl 'l'c'r' | a three-part title line |
.hy [N], .nh | hyphenation on / off |
.ul [N] | underline (italic in troff) the next N lines |
.ds name text | define a string, used as \*[name]; a leading " keeps leading spaces |
.nr name N | set a number register, used as \n[name] |
.de name ... .. | define a macro; its arguments are \\$1, \\$2 ... |
.so file | read in another file here |
.ig ... .. | ignore input up to ..
|
\fB, \fI, \fR, \fP | bold, italic, roman, previous font; \f(CR or \f[CR] constant width |
\s+2, \s-2, \s0 | type size up, down, back to the previous |
\*x, \*(xx, \*[name] | the string x, xx, or name; .SR defines them |
\nx, \n(xx, \n[name] | the value of a register; \n[%] is the page number |
\(xx, \[name] | a special character, such as \(em (below) |
\e | a backslash |
\- | a minus sign. knitroff writes the - of code this way, so groff does not set it as a hyphen; in the terminal draft it is the ASCII - |
\& | nothing, zero width: protects a leading . or ' |
\~, \ (backslash, space) | an unbreakable space, adjustable / of fixed width |
\0, \|, \^ | spaces the width of a digit, 1/6 em, 1/12 em |
\u, \d | up / down half an em, for simple super- and subscripts |
\v'N', \h'N' | move vertically (down if positive) / horizontally |
\l'N', \L'N' | draw a horizontal / vertical line of length N |
\w'text' | the width of text, for use in measurements |
\zc | print c without moving: zero width |
\c | join the next input line to this one |
\% | a hyphenation point; at the start of a word, do not hyphenate it |
\" | a comment, to the end of the line |
Measurements take a unit after the number, as in .sp 0.5v or .in 2n.
i, c, p, P | inch, centimetre, point (1/72 inch), pica (12 points) |
m, n | em and en: the width of M and half of it, at the current type size |
v | one line of vertical spacing (a "vee") |
u | the device's basic unit |
Without a unit, .sp and .ne count lines (v), .ps and .vs points, and most other requests ems.
UTF-8 input works (knitroff runs groff with -k), but these names are portable to any troff and to the terminal. Write \(xx for two-character names or \[name] for any.
\(em | em dash | \(en | en dash |
\(hy | hyphen | \(mi | minus |
\(bu | bullet | \(de | degree |
\(co, \(rg, \(tm | copyright, registered, trademark | \(sc | section |
\(dg, \(dd | dagger, double dagger | \(ct, \(Po, \(Eu | cent, pound, euro |
\(mu, \(di | times, divide | \(+- | plus or minus |
\(<=, \(>= | less, greater or equal | \(!=, \(==, \(~= | not equal, equivalent, approximately |
\(->, \(<- | arrows | \(if, \(pd, \(gr | infinity, partial, gradient |
\(sr, \(is | square root, integral | \(sq, \(ci | square, circle |
\(lq, \(rq | double quotes | \(oq, \(cq | single quotes |
\(aq, \(dq | ASCII ' and " | \(ga, \(ha, \(ti | ASCII `, ^, ~ |
\(rs, \(sl | backslash, slash | \(fm | prime (foot mark) |
\(*a ... \(*w | Greek alpha to omega | \(*A ... \(*W | capital Greek |
The full list is in man groff_char.
ms, eqn, tbl. In a terminal: man 7 groff, man groff_char, info groff.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.