Converting LaTeX to Word – part 3 (Pandoc revisited)

In part 1 of Converting LaTeX to Word, I explained how I used Pandoc to convert from LaTeX to Word (doc, docx, RTF), but there were problems getting figure reference numbers to show up, because by default Pandoc cannot handle automatic numbering and referencing of figures like Latex can.  The [pandoc-reference-filter] package was written to solve this problem.


[Note: Unfortunately I couldn’t get Pandoc to recognize the filters package – probably due to my inability to install Python packages in Windows correctly (doh!) – so I stopped trying because Latex2RTF works well for me, for now.]

How to get figure and table references to show up with the Pandoc LaTex to Word conversion scripts

  1. You need Python and of course Pandoc
  2. Install [pandoc-reference-filter] and [pandocfilters version 1.2.3]
  3. And then finally get your main ingredients together: see the previous post here
  4. Follow the markup and usage examples in [pandoc-reference-filter], compile with Pandoc, and your figures should be numbered and referenced correctly

Pros and Cons of using Pandoc to convert from Latex to Word

+ Pros

  • You can use the 7000+ (as of this date) style files already available in the Zotero and CSL repositories. And BTW, csl style files are much easier to edit than bst files! This, IMO, is a huge benefit to using Pandoc for your conversions.
  • You can convert to many other formats besides doc/rtf (e.g. HTML)
  • Can easily define (hardcode) the name of the output file in the conversion script. This is handy because you might want to call the first draft “filename_v1.doc”, and after a revision, call it “filename_v2.doc”. For each revision, you just have to change the output filename in the script and every time you run the script, it will give it the name you predefined.

– Cons

  • You need Python (hopefully this isn’t a dealbreaker for most people, though I couldn’t get it to work myself)
  • Page breaks still don’t work, but there might a solution to that, somewhere, in some corner of the interwebs…
  • Some special Latex commands may not work (check the FAQ and the mailing lists for further help)
  • To solve this last issue, it’s been suggested to write directly in Markdown rather than Latex – though this defeats the purpose of writing in Latex.

Other posts in the LaTeX to RTF conversion series

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s