[Navigation]

Nroff Printer Language


Nroff commands can be inserted into the document and resemble the existing dot (.) commands currently used. Nroff does not work on a line by line basis, rather it collects all the text together, formats it and then prints it. Blocks of text are separated by the command .P.

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.

Fonts - Enlarged/Condensed

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

.S Pitch
e.g. .S 5 is smallish and could be referred to as condensed. (Feel free to alter the pitch to suit your requirements.)

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:


 .S 15
 Here is a block of text etc.
 etc.
 etc.
 .S D

Bold/Italic

There are three main 'Styles' of text

.R Roman
.B Roman Bold
.I Roman Italic
So to enter text in bold you can do:

 .B
 Here is a block of text etc.
 etc.
 etc.
 .R
However if you want ot bold just one word/line you can use the in-line version being \fBtext\fP.

Box Drawing

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

Line Drawing

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.

Centering

.ce n (Where n is the number of lines) at the start
.ce 0 To switch off centering.

Page

.P Start a new paragraph
.SP n Print n lines
.br Start a new line

Tables

Table support is very useful, for example,


   .TS
   center tab(^);
   l l lb.
   &client^Operation date^&odate
   &address1^
   &address2^Species^&species
   &address3^Breed^&breed
   &address4^Age^&age
   Tel &ffield^Colour^&colour
   .TE

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:


.TS                Specify the start of a table
Table Options;     The options to use
Table Format.      MUST be entered by hand

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.

Table Options

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.

Table Format

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.

Additional format features

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


.TS
box tab(^);
c c c
l l l.
Temperature^Pulse^Notes

36^100^A bit high 37^90^A bit low .TE

Example 2


.TS
allbox tab(^);
c s s
c c c
l l n.
Temperature Chart
Date^Time^Recording
12/02^12:30^37.6
12/02^12:45^37.7

.TE

Example 3


.TS
box tab(^);
c s s
c | c | c
l | l | n.
This is a title
=
Col 1^Col 2^Col 3
-
One^Two^Three
Four^Five^Six
-
Seven^Eight^Nine
^Ten
-
.TE

Lists

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:


.BL       (Start a bullet list)
.LI       (List Item)
text
text
.LI
more text
more text
.LE        (End a list)

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.


.AL A
.LI
This is an alphabetical list.
.AL
.LI
Now this is a numeric list.
See where the indent starts.
.DL
.LI
Now a dash list, the indents keep moving in
.LE
.LI
This is numbered two, the above .LE is
used to end the dash list.
.LE
.LI
Now this is B, You can see what is happening
and can pick which ever option you like best.
.LE

Page Headings

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.

Logos and Images

You can include logo amd images in your documents however there are a couple of provisos:

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)
For example to include your logo 2" by 2" your would use:


.PSPIC logo.ps 2i 2i

Misc Options

(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