While some the following may be a little confusing, it is worthwhile to continue. In addition we have many of the standard definition files aready converted to use nroff. We can send you these samples as it is a lot easier to edit an existing one than it is to start from scratch.
The following section will list the common commands, if you want the full details (warning they are a bit terse) look at the extract from Unix Unleashed on-line in the Public Domain section of the manual.
Groff supports scalable fonts from 2 to 36 pitch, the default is 10 pitch, 2 pitch is very small while 36 is very large. You specify them with
If you use D as the Pitch the system will revert back to the default pitch size of 10.
So to print a block of text in 15 pitch you would enter:
There are three main 'Styles' of text
| .R | Roman |
|---|---|
| .B | Roman Bold |
| .I | Roman Italic |
However if you want ot bold just one word/line you can use the in-line version being.B Here is a block of text etc. etc. etc. .R
\fBtext\fP.
If you want to have a box drawn around some text if you use the two dot commants .B1 and .B2 either side of the text.
| .B1 | Start box |
|---|---|
| .B2 | End box |
To separate difference sections of your document you may find it handy to draw a line.
| \l'n' | when n is the number of characters e.g. \l'15' will draw a line of 15 characters. |
|---|
| .ce n | (Where n is the number of lines) at the start |
|---|---|
| .ce 0 | To switch off centering. |
| .P | Start a new paragraph |
|---|---|
| .SP n | Print n lines |
| .br | Start a new line |
Table support is very useful, for example,
This will format in a table all the client details along with operation details within a box in the center of the page.
Adding in a table does need a little bit of though and initially it will take a couple of attemts.
The Layout of a table is as follows:
Data ^ Data ^ Data ^
Data ^ Data ^ Data ^ The data to go into the table.
Data ^ Data ^ Data ^
.TE Specify the end of the table
Lets look in a bit more detail at the above:
The .TS and .TE are fairly self-explanatory.
These specify what sort of table you want and must end with a semi-colon.
These can be:
| center | Centers the table (default is left-adjust)
|
|---|---|
| expand | Expand the table as wide as the current line length
|
| box | Enclose the table in a box
|
| allbox | Enclose each item in a table in a box
|
| doublebox | Enclose the table in two boxes
|
| tab(x) | Use x to separate the fields - NOTE you should specify
this one, as the default is TAB which can be a bit
difficult to enter. We recommend tab(^) so all data
is separated with a ^. All examples here and in the
definition files will use a ^.
|
| So | |
| .TS allbox tab(^) center; | Will draw a box around all fields, split the data with a ^ and center it in the page. |
This specifies the number of fields and the format you want them printed in and MUST end in a full stop (.).
The line contains a keyletter for each column in the table e.g.
l l l
Indicates a three column table each field being left justified.
The formats are:
| l | Indicates a left-adjusted column entry |
|---|---|
| r | Indicates a right-adjusted column entry |
| c | Indicates a centered column entry |
| n | Indicates numerical entries lined up by units |
| a | Indicates all corresponding entries aligned on the left, and positioned so that the widest is centered within the column. |
| s | Indicates an entry from a previous column continues across |
Multiple format lines can be used, e.g.
c c c
l l l.
This will center the first line and then every other line will be left justified.
| Horizontal Lines | The keyword may be replaced by an under-score (_) to
indicate a horizontal line in place of the corresponding
column or by an equals sign (=) to indicate a double
horizontal line.
|
| Vertical Lines | A vertical bar (|) may be placed between column
keyletters. This will cause a vertical line between
the corresponding columns of the table.
|
| Space between | A number following the keyletter. This indicates
the amount of separation between this column
and the next one.
|
| Font change | The keyletter may be followed by a B or an I to
indicate the data should be in Bold or Italics.
|
Here are some examples for you to try:
Example 1
36^100^A bit high
37^90^A bit low
.TE
Example 2
.TE
Example 3
Lists are simple ways of grouping text together and indenting it. The easiest way to see what it is like is try it.
Lists are in three parts:
You can have 4 different list formats,
| .BL | Start a bullet list |
|---|---|
| .AL A | Start an Alphabetical list e.g. A, B, C etc. |
| .AL | Start a numeric list e.g. 1, 2, 3, 4 etc. |
| .DL | Start a dash list e.g. - |
| .ML xx | Start a mark list, whatever xx is. |
Lists can be nested up to six levels and you can mix the list types.
By default nroff does want to a 'page numbers' to every document. If you don't want them or want to specify your own headers then add one or more of the following to the top of your document.
| .PGNH | Switched off page headers BUT you do need to add a few blank lines with .P to adjust for it. |
|---|---|
| .PH "'Left'Middle'Right'" |
Will print text to the left, right or middle, in this example
it will print the word 'Left' to the left, 'Right' to the right and
'Middle' in the middle. You can leave any or all blank e.g..PG "''''" will be blank,.PG "'&date/&time'''"
will print the date and time at the top left.
|
| .nr N 4 | Switch off header styles for multiple pages. |
The format you use is:
| .PSPIC filename width height | ||
|---|---|---|
| filename | Name of the file to print | |
| width | Width of image (if different to original) | |
| height | Height of image (if different to original) | |
.PSPIC logo.ps 2i 2i
(If n is used this is an option)
| .bp | Eject a page |
|---|---|
| .po n | Page offset |
| .br | Line break |
| .ll n | Line length, default is 5.6 inches |
| .in n | Indent by n characters. (Use .in 0 to switch off) |
| .nf | Do not fill or adjust lines |
| .ad | Adjust lines |
| .hy 1 | Switch on hyphenation |
| .hy 0 | Switch off hyphenation |
| \(Po | Print a pound sign |
| \(sq | Tick box |
| \(bu | Bullet point |
| Top | Classic | New-Style | Chapters | Sections | Index | Search |