Monday, January 22, 2007

Formatting documents

Windows:
Adding line numbers to a word document: (This is not bullets and numbers. This is just in the view. In the printed document they are not shown.)

1. Go to File -- Page Setup and click the Layout tab.

2. Under Preview, click in the “Apply To” box and select “Whole Document”.

3. Click the “Line Numbers” button.

4. Click the “Add Line Numbering" check box.

5. Click “Restart Each Page” and click OK.

Each line of text will be numbered (except those in tables, footnotes, endnotes, text boxes, frames, and headers and footers), starting with number 1 on each page. If you want the numbering to be continuous and not start at 1 on each page, then in step 5, click the “continuous” box.

In some cases, you may not want certain paragraphs numbered—for example, highlighted notes for the reader that are not intended for the final document. To prevent Word from numbering those lines, follow these steps before turning on Line Numbering in Page Setup.

1. Select the paragraphs that you do not want numbered.

2. Go to Format -- Paragraph and click on the “Line And Page Breaks” tab.

3. Click the “Suppress Line Numbers” check box and click “OK”.

(This will also work when formatting an email in outlook)





Linux:


Use the “pr” utility to format text files so they are more suitable for printing to a printer or viewing. It takes a file and breaks it up into pages, adding a header to each page.

For example, “pr” would convert a file that contains 150 lines into a file that contains three pages of text that you could then send to the printer.

By default, each page contains 66 lines of text. You can change this by using the -l switch.

The default header at the top of each page is the filename. You can customize this using the –h switch.

For example:

pr -h "Tip-o-the-day" filename.txt

Rather than using "filename.txt" as the header, this will format the filename.txt file and use "Tip-o-the-day" as the centered heading on each page.

pr” prints to standard output so it can be piped into another tool such as “more”, “less” or to redirect it to the “lpr” tool to print the file. If you want to keep the resulting output in a file, you need to redirect it.

For example:

pr filename.txt >newfilename.txt

Use the man pages or “pr -–help” to find all the available parameters such as formatting into columns, changing page width etc….

Bonus Tip:

To add the line numbering (like in the above windows tip) when using “vi” :

When in vi, press “Esc” and then ": set nu"

No comments: