[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

RTF editing & XPL



I frequently use RTF as a "universal format" when I provide classnotes,
assignments and other documents for my students. This is easy and painless
when I write the document in XyWrite (or Word or WordPerfect) and save it as
RTF. But if I have to edit an RTF file, things are not always smooth. The
translation of RTF into XyWrite or NB 6.1 results in a terrible bloat of
codes that makes discovering and correcting formatting oddities less than
efficient.

In the past two days I have been updating notes for my Evidence class. The
whole set is about 500K, and in RTF. Word 2000 and WordPerfect 10 both
managed to crash at one time or another, with no warning and no chance to
save current work. NB6 seemed to give me oddly aligned lists and
indentations. XyWrite for Windows was stable and pretty good at alignment,
but the code-bloat made it difficult to change formatting when I wanted to.

Does anyone have any suggestions?

Last night I was so annoyed I made a copy of the killer file and then
stripped out all formatting except italics (for emphasis) and underlining
(for casenames). Then I started adding markup codes (LaTeX) so that
everything would just be ASCII, pure and simple. I decided to do this rather
than recode in XyWrite because I also use a shareware editor called WinEdt,
designed specifically for LaTeX (plus HTML and various programming chores).
Though not as "lean and mean" as XyWrite, it too is highly configurable, it
is extremely stable (I've never managed to crash it), handles very large
files easily, highlights (in various colours) markup codes, allows for my
Canadian mix of US and British spelling, and shows spelling errors onscreen
(which *I* find very helpful).

In going between XyWrite coding and LaTeX, XPL or just plain
search-and-replace provide the necessary tools. I have not fully automated
this, although I am sure it can be done... if I can find a good XPL model
for converting one recurring pattern:

\BeginCode1 ........ \BeginCode2 .... \EndCode ... \EndCode

a LaTeX example of this:

\footnote{This is the \emph{text} of the footnote.}

It's easy when the ending code explicitly refers to the code's substance:
\begin{comment} ... \end{comment}

It's also easy when the codes are not nested: \emph{This sentence is
emphasized.}

I'm not sure how to deal with nested codes, though. It would be extremely
helpful to me, and perhaps others, if someone could provide a general XPL
scheme for finding and replacing nested codes. *Is* there a general approach
to this that I could modify according to the codes I'm looking for? WinEdt
can highlight related beginning and ending brackets, which seems like the
same sort of thing, so it seems do-able. Have I overlooked an XPL resource?

Thanks.
Myron