Mihail Radu Solcan

  Write for Word without using Word

2009-01-11

Word is similar to a huge factory. Do you really however need a factory in order to write for Word? In the note concerning RTF I explained how you can bypass the factory and use a small workshop. 

Here I want to discuss some practical examples, following the order in Sean M. Burke's book on RTF. I will call it in what follows the “RTF Book”. For the tools and the explanation of their use see the note mentioned above

Hello, World!

The simplest test for any programming workshop is to write some text and display it on the screen. The test is explained in the RTF Book (pp.4-6). 

I generated all the RTF code in this note using the recipe described in the note on RTF. The “Hello, World!” figure shows the result as it is displayed in the Word Viewer. 

www-hello
Hello, World! 

The whole code for this test, as generated by the ltx4rtf script, has just 751 bytes. 

www-hello-rtf
The RTF code for Hello, World! 

It would not be easy to write even such a simple RTF by hand, but it is easy to modify it. However, if you do this, be careful! Work with copies! Work in a newly created folder! Take full responsibility for what you do! There is no warranty, either explicit or implicit, in this note. The whole content of the note is under GPL

The simplest change, as explained in the RTF Book (p.5), is to modify the size of the font. For example, a 60-point font, in the language of RTF, is denoted with

fs120

Let's say that we put it in the line above the “Hello, World!” text, replacing fs24. Then you can see the result with the viewer. 

www-hello-big
Hello with a 60-point font

RTF for philosophical texts

In this section I take a look at a simple RTF. In the RTF Book (pp.6-9), Sean M. Burke uses the example of the Latin version of “Hello, World!”. I will use a quotation from a famous philosophical essay by Bertrand Russell. 

First, I wrote the quotation using LATEX constructions. You can see the source of the quotation in the image. 

www-Russell-src
Bertrand Russell, “On Denoting”, Mind, Oct. 1905, p.488. 

Now, somebody might still wonder why we do not write just plain text. In plain text, there is no way to emphasize Waverley, as Russell does. We could use something like _Waverley_, but then we cannot get anything from that text without a script. This is what ltx4rtf does for the standard LATEX constructions. 

Philosophers use frequently quotes. In the source for the quotation from Russell, we see how smart quotes are noted in LATEX : press grave key twice (for opening double quotes) and the apostrophe key twice (for closing double quotes). 

Philosophers also like to use Greek letters. Russell uses the mathematical version of Greek phi. In the RTF code ltx4rtf translates the Greek letter into a Unicode number (see the image). RTF can work with Unicode. 

www-Russell-rtf
The RTF code generated with ltx4rtf

It was very difficult to find a viewer with adequate fonts for the version of Greek phi used by Russell. Word Viewer 2003 did not render it at all. It can render only the other version of Greek phi. In OpenOffice 2.3 some fonts simply used the usual text version instead of the one favored by Russell. Only the DejaVu Serif font rendered correctly the text (as you can see in the image). 

www-Russell
The quotation from Russell rendered with DejaVu Serif in OpenOffice

The text of the quotation also illustrates the notion of a paragraph in RTF. This concept is discussed in the RTF Book (pp.14-20). 

The script ltx4rtf generates a fairly simple RTF. Should you try to make it better with an Word-like editor? I do not think so. Just have a look at the RTF code generated by OpenOffice for the quotation from Russell. 

www-Russell-oooRTF
RTF code generated by OpenOffice 2.3

OpenOffice made the RTF much more difficult to read. It is almost impossible to change such an RTF by hand. As far as I know, Word creates also a bad-looking RTF, far too cryptic to make any sense to try to edit it with a text editor like Vim. 

Footnotes

Footnotes are extremely important in academic essays. The the syntax of footnotes in RTF see the RTF Book (pp.55-57). 

I will take an example from Herbert Schnädelbach, Introducere în teoria cunoaşterii (Piteşti: Paralela 45, 2007), a book that I have translated from German. The author used only short bibliographical notes embedded in the text. The notes that I added, as a translator, were all footnotes. The example in the image is from page 33. 

www-eth-src
The quotation from Schnädelbach - the tex source

You should pay attention to the fact that, in the LATEX source, the footnote has a logical form: it is a parenthesis in the text. This parenthesis is highlighted in the figure. On the printed sheet of paper, the form is visual. The visual form facilitates reading. The logical form makes easier the building of a well-organized text. 

www-eth
The quotation from Schnädelbach - the RTF in the viewer

The shape of the Romanian letters in the viewer is deficient, but the footnote looks good. 

Titles

For the LATEX text of the translation from Schnädelbach I needed a surprisingly small set of constructions: paragraphs, emphasized text, German letters (and Romanian, of course), some other special symbols, footnotes and titles. 

I will take here, as an example, the very beginning of the book. 

www-titles-src

In the figure, we see that we use LATEX constructions for the titles of chapters and sections. The keywords are obviously chapter and section

www-titles

Titles aren't just portions of text with bigger letters, surrounded by white space. The script ltx4rtf generates RTF code for titles that can be used for outlines and navigation. 

www-outline
An outline

The Word Viewer has the capacity to show the text in outline mode. 

4rtf versus 4ltx

There is an archive with the tex files and the version of the script ltx4rtf used in this note. You must get a command-line in the current folder. Run the script (when it is in the same folder with the tex files) with the command:

./ltx4rtf name-of-the-file.tex

There is a difference between the Russell-4rtf.tex and the Russell-4ltx.tex files in the archive. The 4ltx.tex file is adapted to LATEX . The difference is minimal: the file uses a command in mathematical mode for the Greek phi letter. 

If you run the 4rtf (the file for RTF generation) through the latex compiler, you get an error message:

Package ucs Warning: Unknown character 981

This means that the Unicode character for that version of Greek phi is unknown. However, in mathematical mode, you get both versions of Greek phi (in a very nice form). 

If you really want to have only one source, you must modify the ltx4rtf script. The modified version from the archive generates an RTF that is rendered by the Word Viewer.