Something's Awry…

  • Archive
  • RSS
  • Ask me anything

LaTeX to RTF

So for a while, I’ve been using LaTeX to write up my work but every now and then someone wants a copy of my work in Word so they can edit it or mark it up and they cant use a PDF editor. This means converting my PDF into a Word document or my LaTeX file into a RTF document.

The PDF route was probably the easiest as everything was nicely laid out already and set out as it should be and various services on the web manage to convert PDF’s relatively well to Word documents such as Zamzar Offsite Link

However, the LaTeX to RTF option is also a possibility using the linux2rtf program Offsite Link however, that seems to be awkward at the best of times and annoyingly problematic at times. And it won’t run on OS X Lion because of the lack of Rosetta support (unless you build it in Macports but that requires a full LaTeX install via Macports as well!)

it shouldn’t have come as a surprise that the answer was staring me in the face all this time. I’d blogged about Pandoc before here and it’s ability to turn Markdown into LaTeX code. Well, it does that and more. Turns out it can output to RTF as well (that’ll teach me to RTFM!) so a simple command of:

pandoc -s LaTeX.tex -o Output.rtf

gives me a very well formatted RTF document that matches the LaTeX document style pretty well.

For example, in the document in question, I was making use of the url package and the verbatim package quite regularly – Pandoc understands these and formatted them as described in the RTF! Excellent! I don’t know how well it would come with Tables, References and floats but that’s to try another day but considering it handled verbatim and url fine, I have high hopes. latex2rtf is dead, long live LaTeX to RTF!

So once again, top marks to Pandoc for it’s fantastic ability to read and convert documents!

    • #latex
    • #rtf
    • #documents
    • #writing
    • #academic
    • #pandoc
  • 4 months ago
  • 14
  • Permalink
  • Share
    Tweet

Markdown, Pandoc, Mou and LaTeX

For those that haven’t guessed already, Markdown is my new thing. It’s a fantastic little language that allows you to quickly write HTML and XHTML without knowing HTML!

Writing with it is quite natural (for those fans of Reddit, it’s the code method used to write replys) as it’s fairly simple.

# Item

gives a headline.

**item**

gives bold text etc etc.

After using it for a bit in Reddit, I found Mou Offsite Link, a Markdown editor for Mac that lets you type on one side of the window whilst in realtime, updating the HTML preview on the right. Simple, easy and elegant. I started using this for writing in Evernote Offsite Link. Write a note in Mou, which is simple, easy and quick (without worrying to much about the formatting) then copy and paste the right side into Evernote for an awesome looking note (at least it is until it syncs to the server – workaround is to export the HTML to a normal HTML, open in a browser and copy into Evernote from there – not so pretty and a bit long winded – have asked Evernote why it’s a problem)

In terms of quickly formatting a block of text, Markdown is pretty damn good. So much so, it got me thinking. Could it be used for academic writing? Turns out with another program, it can! Using pandoc Offsite Link, you can easily convert Markdown into LaTeX. The output is actually pretty impressive! Better than I have expected from cnversion software anyhow!

For example, we can take the help file from Mou as an example. It’s Markdown for a section is this Offsite Link. This corresponds to this in an HTML (what you see in a browser) which is this Offsite Link. Not to shabby. Load up pandoc and use the command

pandoc -s file.html -o file.tex

to convert the HTML file into a LaTeX file and you get the following LaTeX code Offsite Link. The -s flag means standalone and thus it adds the required preamble to the LaTeX document. This is then converted into PDF in the LaTeX editor (and with a few flaws, thanks to the .ico file type used by Mou in the help file which is unrecognised by LaTeX) you get this Offsite Link as the output.

As you can see, it’s a pretty good representation in LaTeX to the HTML file.

Conclusion

I use LaTeX to write my reports in – most, if not all get formatted and written in LaTeX using the new, but excellent, Texpad Offsite Link. This app is fantastic but remembering LaTeX commands can be a pain and it’s also slow at times when all you need to do is write down a draft. Once you start adding references etc, LaTeX starts to shine.

However, for the drafting process, using Markdown and Pandoc can speed up the crucial part of putting words on sheets and pandoc means that converting from Markdown to LaTeX will require as little possible time for the end user. Which can only be a good thing at the end of the day!

    • #markdown
    • #latex
    • #pandoc
    • #writing
    • #academic
    • #Mou
  • 8 months ago
  • 29
  • Permalink
  • Share
    Tweet

About

Geek, Cyclist, Apple Fan, Redditor

Pages

  • Publications

Me, Elsewhere

  • @_drezha on Twitter
  • Facebook Profile
  • drezha on Youtube
  • drezha_ on Last.fm
  • drezha on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr