From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Org + MS DOC Date: Thu, 04 Feb 2016 13:26:34 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROc8-0006dO-PQ for emacs-orgmode@gnu.org; Thu, 04 Feb 2016 13:26:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aROc3-0005S9-PY for emacs-orgmode@gnu.org; Thu, 04 Feb 2016 13:26:44 -0500 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:34839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROc3-0005RD-KY for emacs-orgmode@gnu.org; Thu, 04 Feb 2016 13:26:39 -0500 Received: by mail-qg0-x22e.google.com with SMTP id o11so48580960qge.2 for ; Thu, 04 Feb 2016 10:26:38 -0800 (PST) Received: from client-130-203-90-149.mobility.psu.edu (client-104-39-126-97.mobility.psu.edu. [104.39.126.97]) by smtp.gmail.com with ESMTPSA id z106sm5767054qge.18.2016.02.04.10.26.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2016 10:26:36 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Hi, There is occasional discussion on the list (or SE or Reddit) about how to best work with Word documents. In the past I've suggested Org -> Pandoc -> DOCX because that worked best for me when producing documents with equations, figures and tables. It didn't work great, but it worked best. I've recently found a new workflow that seems much better, and wanted to let others know about it. It removes the need for Pandoc and only uses Org and LibreOffice. 1) Export to DOC (not DOCX) via ODT. Inline \(math\) in DOCX still looks pretty bad, but is fine in DOC. (require 'ox-odt) (setq org-odt-preferred-output-format "doc") (setq org-odt-convert-processes '(("LibreOffice" "/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to %f%x %i")))) 2) Run the following LibreOffice Macro to clean things up. I've assigned this to a toolbar button to make it easy to access. Add strings you want to disappear to "mTeXStringsNO" and pairs of strings you want converted to the "mTeXStringsCNV" arrays. 3) Email to Word Users. I always email the PDF copy to so they can see the (psuedo)canonical version of the document. I hope this is helpful to some of you, -k. Sub ReplaceTeXStrings Dim mTeXStringsNO(99) As String Dim mTeXStringsCNVfrom(99) As String Dim mTexStringsCNVto(99) As String Dim n As Long Dim oDocument As Object Dim oReplace As Object mTeXStringsNO() = Array("\(", "\)", "\ref", "\mathrm", _ "\begin{equation}", "\end{equation}", "\left", "\right", _ "\singlespacing", "\doublespacing") mTeXStringsCNV() = Array("\sigma","σ", "\rho","ρ", "\sum","∑", _ "\phi","ɸ", "\partial","∂", "^{th}","th", "^{{th}}","th", _ "^{-1}","-1", "^{-2}","-2") oDocument = ThisComponent oReplace = oDocument.createReplaceDescriptor For n = lbound(mTeXStringsNO()) To ubound(mTeXStringsNO()) oReplace.SearchString = mTexStringsNO(n) oReplace.ReplaceString = "" oDocument.replaceAll(oReplace) Next n For n = lbound(mTeXStringsCNV()) To ubound(mTeXStringsCNV()) Step 2 oReplace.SearchString = mTexStringsCNV(n) oReplace.ReplaceString = mTexStringsCNV(n+1) oDocument.replaceAll(oReplace) Next n End Sub