From: Ken Mankoff <mankoff@gmail.com>
To: org-mode <emacs-orgmode@gnu.org>
Subject: Org + MS DOC
Date: Thu, 04 Feb 2016 13:26:34 -0500 [thread overview]
Message-ID: <m28u30nxgl.fsf@client-130-203-90-149.mobility.psu.edu> (raw)
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
next reply other threads:[~2016-02-04 18:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 18:26 Ken Mankoff [this message]
2016-02-04 21:28 ` Org + MS DOC Julian M. Burgos
2016-02-04 21:44 ` Ken Mankoff
2016-02-05 9:01 ` Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m28u30nxgl.fsf@client-130-203-90-149.mobility.psu.edu \
--to=mankoff@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).