# [OS X TeX] Scripting

Ross Moore ross at ics.mq.edu.au
Sat Jun 29 04:19:52 EDT 2002


> Ross Moore wrote:
> >
> > > Hi Folks
> > >
> > > I want to write a script which will take a Word file and convert some of
> > > the most common character formatting in that file and replace it with
> > > latex commands. So, for example if a string of characters is italisized
> > > in word the script will replace it with that string surrounded by
> > > \textit{}. And so on for some other bits of formatting that will not
> > > convert with find/replace in Word.
> > >
> > > Does anyone have any suggestions, for a scripting novice, of which
> > > scripting language would best accomplish this? Should I learn Perl,
> > > Applescript or what?
> >
> > Definitely Perl.
> >
>
> I doubt Perl is aware of Microsoft Word file formats. I am afraid using
> Perl underlies some reverse ingeneering on the word files except perhaps
> for rtf ones, and except if someone has already done the work...

Of course, saving as  rtf  is a desirable first step, if you intend
doing anything with tools other than  Word  itself.

There is already a program called  rtf2latex2e  that doubtless
does most of what you want; but it may do too much, or it may do

Get it by searching at:     ctan.tug.org/search

(Don't get it mixed up with the much older programs
rtf2latex, rtf2LaTeX  and  rtf2tex .)

Here is an extract from the README file:

rtf2LaTeX2eDoc.pdf file. They are in the documentation directory.

The file Release-notes.txt usually has more up-to-date info.

INSTALLATION AND USE:
=====================
rtf2latex2e was developed on the Macintosh using DropUNIX for maximum
portability to Unix. I have tested it on the Macintosh PowerPC, Linux
(Intel), Linux (PowerPC), Solaris 2.6, and Windows 95/NT. Basically,
rtf2latex2e should compile on any platform that supports a C compiler.

MACINTOSH:
----------
Macintosh users get a pre-compiled fat binary. Drop your RTF files on it.
If you want to build your own binary, CodeWarrior project files are provided.
You will need to get the DropUnix libraries to compile. Read the
documentation and release notes for more details. The preferences can be

The "pref" folder has to be in the same folder as the rtf2latex2e application.

If you are running MacOS < 8.5 on a PowerPC, put the files "Navigation"
and "Appearance Extension" (in the folder "-> put into Systems Folder")
"Appearance" into your Control Panels folder.

So why not try looking at its output, then do further processing
with  Perl  to clean that up to your taste.

Hope this helps,

Ross

> AppleScript could be a good alternative if MS Word gives sufficient
> control to apple scripts
>
> IMHO, it might be more practical to simply use MS Word macros. At least
> it should be...
>
> -----------------------------------------------------------------
> Threaded list archives can be found at:
> <http://www.masda.vxu.se/~pku/MacOSX_TeX/>
> -----------------------------------------------------------------
> To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
> "unsubscribe macosx-tex" (no quotes) in the body.
> For additional HELP, send email to <info at email.esm.psu.edu> with
> "help" (no quotes) in the body.
> -----------------------------------------------------------------

-----------------------------------------------------------------
Threaded list archives can be found at:
<http://www.masda.vxu.se/~pku/MacOSX_TeX/>
-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
-----------------------------------------------------------------