RTF to Latex converter

The idea is to make the conversion of rtf files to latex very fast. The rtf2latex2e (http://rtf2latex2e.sourceforge.net ) script should be installed and configured first.

Some of the steps in here are to remove the preamble and unncessary part of the document that rtf2latex2e inserts.

RTF to Latex.kmmacros (28.6 KB)

I want to see if someone can improve it. I specially would be glad if the "write to file" part of the process can be eliminated..to make the process faster.

I have been using this macro much more often than any other macro. It has been very important part of my workflow to swiftly move from Tinderbox to my Latex editor, Texstudio.

I hope someone find it useful.

1 Like

Here's my shot at making it faster:

RTF to Latex 2.0.kmmacros (28 KB)

Due to the nature of rtf2latex2e there doesn't seem to be any way to build this macro without writing to files, but even so, my tests with rtf2latex2e's sample files using this version worked much faster, without any "Pause for arbitrary length of time" actions. It also cleans up the files it uses once it's done, so it's almost like they never existed :slightly_smiling_face:
The only issue I ran into with this version is that the "Search and Replace Variable" action meant to eliminate the boilerplate doesn't seem to want to work even though the regex works fine in BBEdit and regex101.com (I would have left your substring action in, but that didn't work in my tests either). Anyway, give this version a shot and see what you think; hopefully it'll save you some time.

Escape the curly braces: \{ and \}

Aha! Should have known it was something simple like that. Thanks, Tom! Here's a fixed version of the macro:
RTF to Latex 2.0.1.kmmacros (28.8 KB)

2 Likes

Amazing. The result just pops up in an instant. Wow.

Thank you so much @gglick: I am so glad I posted it here

1 Like