|
Explorations |
Find and Replace |
|||
|
|
Finding and Replacing How do you convert a text document to a word document? The key is to understand the difference between a line and a paragraph. Many text documents that are intended to mimic a printed page, such as from Project Gutenberg, often have every line end with an end-of-paragraph marker, shown by a pilcrow (¶) in Microsoft Word. In effect, every line is its own paragraph. In order to separate paragraphs, most text documents have two end-of-paragraph markers between paragraphs. We will use the fact that ends of lines and ends of paragraphs look different in a text document. In the Project Gutenberg documents, even the beginning of chapters have a different number of end-of-paragraph markers. Fortunately, we can find and replace special characters. For example, we can find all of the end-of-paragraph markers by searching for ^p and then replace it with whatever we want. See the help file in Word to find out more about finding and replacing special characters such as end-of-paragraph, tab, line breaks, page breaks, etc. Although the procedure may look confusing, keep in mind the logic: if we are trying to get rid of end-of-paragraph markers at the end of lines, but we still need them at the end of paragraphs, we can't just get rid of all end-of-paragraph markers because it will also get rid of the two end-of-paragraph markers at the real end of paragraphs. The text will end up as one paragraph. Jane Eyre, for example, has about 186,000 words; as one paragraph it's mind-numbing! Instead, first we have to identify how many of these markers are used between paragraphs (usually two) and between chapters (usually three or more) and then replace them with special characters so they won't disappear when we get rid of the markers at the end of the paragraph. First, open your text document in Microsoft Word. Click the pilcrow symbol to show all characters.
In this case, we search for four end-of-paragraph markers (although we could have done five) and, because we want each chapter on a new page, we replace those with an end-of-paragraph marker and a manual page break. If you don't have the end-of-paragraph maker before your page break for your chapter, you will have trouble applying the heading styles and getting your table of contents to work. Then, we want to replace the two end-of-paragraph markers between paragraphs with something that will not be in the text, but that we can replace later with end-of-paragraph markers again. Three vertical bars (|||) often works well. (On many US-style keyboards, it is the shifted backslash key, above the enter key.) Now, it's time to replace the last of the end-of-paragraph markers with a space, so we search for single end-of-paragraph markers and replace those with one space. (You can't see the space in the replace field.)We are almost done with the basics. Replace the three vertical bars with an end-of-paragraph marker to mark paragraphs again. Now, save the document as a Word document. Don't make the common mistake of saving it as a text file; you'll lose all of your changes. Of course, it warns you first, like either of the ones below, but you have to read the warnings! Now you can get on with applying styles.
last maintained 10/22/2004 |
|||
|
This site best viewed with 2001 or later versions of Netscape, Internet Explorer, Mozilla, or Opera. Original Content ©2001-2004 by Derrel Fincher. Other rights reserved by individual authors |