emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org + MS DOC
@ 2016-02-04 18:26 Ken Mankoff
  2016-02-04 21:28 ` Julian M. Burgos
  2016-02-05  9:01 ` Eric S Fraga
  0 siblings, 2 replies; 4+ messages in thread
From: Ken Mankoff @ 2016-02-04 18:26 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org + MS DOC
  2016-02-04 18:26 Org + MS DOC Ken Mankoff
@ 2016-02-04 21:28 ` Julian M. Burgos
  2016-02-04 21:44   ` Ken Mankoff
  2016-02-05  9:01 ` Eric S Fraga
  1 sibling, 1 reply; 4+ messages in thread
From: Julian M. Burgos @ 2016-02-04 21:28 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: org-mode

The advantage of exporting via Pandoc is the possibility of including
bibliographic citations.  Do you know if it is possible to do this via
ODT?

Julian

Ken Mankoff writes:

> 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


-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian@hafro.is

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org + MS DOC
  2016-02-04 21:28 ` Julian M. Burgos
@ 2016-02-04 21:44   ` Ken Mankoff
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Mankoff @ 2016-02-04 21:44 UTC (permalink / raw)
  To: Julian M. Burgos; +Cc: org-mode


On 2016-02-04 at 16:28, Julian M. Burgos <julian@hafro.is> wrote:
> The advantage of exporting via Pandoc is the possibility of including
> bibliographic citations. Do you know if it is possible to do this via
> ODT?

I think ODT can do it w/ extra work (JabRef?) but my method does not. Yes pandoc does support that. The final product appears improved enough via this new method that I think I'll cut-and-paste the reference list from PDF.

  -k.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org + MS DOC
  2016-02-04 18:26 Org + MS DOC Ken Mankoff
  2016-02-04 21:28 ` Julian M. Burgos
@ 2016-02-05  9:01 ` Eric S Fraga
  1 sibling, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2016-02-05  9:01 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: org-mode

Ken,

lately, for the few luckily infrequent times that I need to share a
document with a Word user, I have found that exporting to ODT is
sufficient.  ODT documents can be loaded in (recent?) versions of MS
Office although the latter complains that the document is corrupt but is
able to "fix" it...  Equations, in particular, come through as well as I
could expect.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3.3-531-g8003ef

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-05  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-04 18:26 Org + MS DOC Ken Mankoff
2016-02-04 21:28 ` Julian M. Burgos
2016-02-04 21:44   ` Ken Mankoff
2016-02-05  9:01 ` Eric S Fraga

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).