Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Instructions on converting a multimarkdown manuscript with mmd bibtex cite-keys and graphics into a Microsoft Word document with BibDesk cite-keys and graphics.

Convert multimarkdown manuscript to Microsoft Word document

Here are directions for converting a markdown/multimarkdown formatted text manuscript into a Microsoft Word document (unfortunately still a preferred format for submission to many journals). These directions will focus on turning bibtex citekeys (if you are using BibDesk or similar for references and bibliography management) from the [#citekey] format in multimarkdown to the \cite{citekey} format for use with BibDesk.app and BibDeskToWord.app to

This will use the Multimarkdown command line tool (mmd2odf) to create a flat open office document .fodt text file. Multimarkdown must be installed on your system. Alternatively pandoc can be used for this, but pandoc doesn't handle the nice multimarkdown table format as well and graphics can be messed up in resulting open office document .odt file.

Note on use of fodt files in OpenOffice:

LibreOffice can open these Flat OpenDocument files by default, but OpenOffice requires that you install the OpenDocument-Text-Flat-XML.jar file available from the downloads page. To install it, create a new document in LibreOffice (or open an existing one), then go to the Tools->XML Filter Settings menu option. Use the “Open Package…” button to import the downloaded .jar file.

The .fodt file will be input into Word for handling bibliography and final formatting of your manuscript.

  • Turn mmd citation-keys into bibdeskToWord default bibdesk citep citation-keys using a grep find/replacement regular expressions (e.g. BBEdit works great for this).

search:

\[#([A-Za-z]+:[a-z0-9+]+)\]

replace:

\\cite{\1}

search:

}\\cite{

replace:

,

Note: If any references have funny characters in the citation key (like hyphenated names), the search pattern might have to be adjusted accordingly or replacement done later manually in Word. Then run either:

`mmd2odf file.txt`

or

`multimarkdown --process-html -b -t odf file.txt`

This will make a flat open office document file with extension .fodt if Multimarkdown is installed. The version will process html (like commented out text and such) embedded in your markdown document.

  • Open the .fodt file in Libreoffice. If graphics are embedded you should remove the automatic fields for figure legend caption numbering so that the graphics will display properly in Microsoft Word.
  • Save the file as a Microsoft Word .docx file
  • Open in Microsoft Word, and use your bibtex .bib database opened in Bibdesk together with the BibDeskToWord.app to format citations and add bibliography.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.