emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* advice please: best way to export to DOC(X) with maths
@ 2017-12-14 12:18 Eric S Fraga
  2017-12-15 12:58 ` Fabrice Popineau
  0 siblings, 1 reply; 14+ messages in thread
From: Eric S Fraga @ 2017-12-14 12:18 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Hello,

almost all the writing I do that is intended to be exported will be
exported to LaTeX.  However, every now and again I need to export to
DOC/DOCX.

My query is: what is the best way (i.e. the state of the art) currently
in org to export to DOC/DOCX for text that has equations?  I have both
inline maths, e.g. \(i \in [0,n]\) and displayed equations.  Is there a
route that will convert these to something Word et al. can process
directly, other than images?  Maybe via pandoc?

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-168-g7455f4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
@ 2017-12-15  3:20 edgar
  2017-12-15 12:28 ` Eric S Fraga
  0 siblings, 1 reply; 14+ messages in thread
From: edgar @ 2017-12-15  3:20 UTC (permalink / raw)
  To: emacs-orgmode

> Date: Thu, 14 Dec 2017 12:18:24 +0000
> From: Eric S Fraga <esflists@gmail.com>
> To: emacs-orgmode@gnu.org
> Subject: [O] advice please: best way to export to DOC(X) with maths
> Message-ID: <87ind9pkof.fsf@gmail.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hello,
> 
> almost all the writing I do that is intended to be exported will be
> exported to LaTeX.  However, every now and again I need to export to
> DOC/DOCX.
> 
> My query is: what is the best way (i.e. the state of the art) currently
> in org to export to DOC/DOCX for text that has equations?  I have both
> inline maths, e.g. \(i \in [0,n]\) and displayed equations.  Is there a
> route that will convert these to something Word et al. can process
> directly, other than images?  Maybe via pandoc?
> 
> Thanks,
> eric
> 
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-168-g7455f4

I only know how to do a rough approximation by means of pandoc:

#+BEGIN_SRC bash
   pandoc -f org+smart my-original.org -t docx+smart -o my-output.docx
#+END_SRC

for slightly older versions of pandoc, this may work (there is an 
equivalent for the references, I think):
#+BEGIN_SRC bash
   pandoc -f org+smart --bibliography=../../References.bib 
my-original.org -o my-output.doc
#+END_SRC

I used to have a better solution, but at some point it stopped working. 
I didn't ask here, because 1/2 of my questions go under the radar, and I 
don't like to bug people with my issues:

To get a working file, first export to odt with Org-mode
(~C-c C-e o o~), and then run this (you can do ~C-c C-c~
on it; make sure that LibreOffice is not running)
#+BEGIN_SRC shell :results none
  libreoffice --headless --convert-to doc ./my-.odt
#+END_SRC

For the latter, I used to have
#+OPTIONS: tex:dvipng

A better solution would be most appreciated.

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15  3:20 advice please: best way to export to DOC(X) with maths edgar
@ 2017-12-15 12:28 ` Eric S Fraga
  2017-12-19  5:09   ` edgar
  0 siblings, 1 reply; 14+ messages in thread
From: Eric S Fraga @ 2017-12-15 12:28 UTC (permalink / raw)
  To: edgar; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

On Friday, 15 Dec 2017 at 03:20, edgar@openmail.cc wrote:

[...]

> I only know how to do a rough approximation by means of pandoc:
>
> #+BEGIN_SRC bash
>    pandoc -f org+smart my-original.org -t docx+smart -o my-output.docx
> #+END_SRC

What version of pandoc are you using?  My Debian (testing) has pandoc
1.19.2.4 and it does not seem to recognise the +smart bits...

But, in any case, pandoc (without the smart bits) does seem to do a
reasonable job and creates proper maths entities.  This is good enough
for me!  My once a year pain is relieved.  :-)

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-14 12:18 Eric S Fraga
@ 2017-12-15 12:58 ` Fabrice Popineau
  2017-12-15 13:30   ` Eric S Fraga
  0 siblings, 1 reply; 14+ messages in thread
From: Fabrice Popineau @ 2017-12-15 12:58 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

The best way  is probably to generate a PDF with LaTeX
and to open it with MS-Word. Yes, it can do that, and the math import
is quite good (for what I have seen, at least as good as any other
alternative option).

Fabrice

2017-12-14 13:18 GMT+01:00 Eric S Fraga <esflists@gmail.com>:

> Hello,
>
> almost all the writing I do that is intended to be exported will be
> exported to LaTeX.  However, every now and again I need to export to
> DOC/DOCX.
>
> My query is: what is the best way (i.e. the state of the art) currently
> in org to export to DOC/DOCX for text that has equations?  I have both
> inline maths, e.g. \(i \in [0,n]\) and displayed equations.  Is there a
> route that will convert these to something Word et al. can process
> directly, other than images?  Maybe via pandoc?
>
> Thanks,
> eric
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-168-g7455f4
>



-- 
Fabrice Popineau
-----------------------------
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------

[-- Attachment #2: Type: text/html, Size: 1753 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 12:58 ` Fabrice Popineau
@ 2017-12-15 13:30   ` Eric S Fraga
  2017-12-15 14:54     ` Tim O'Callaghan
  0 siblings, 1 reply; 14+ messages in thread
From: Eric S Fraga @ 2017-12-15 13:30 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

On Friday, 15 Dec 2017 at 13:58, Fabrice Popineau wrote:
> The best way  is probably to generate a PDF with LaTeX
> and to open it with MS-Word. Yes, it can do that, and the math import
> is quite good (for what I have seen, at least as good as any other
> alternative option).

Interesting.  I don't use MS Word (I'm on Linux on all of my systems)
but may ask somebody to check this out for me.  LibreOffice almost works
importing the PDF generated via LaTeX but not quite.  OneDrive (web
interface) doesn't quite work either.

But pandoc is handling most of what I need.

thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 13:30   ` Eric S Fraga
@ 2017-12-15 14:54     ` Tim O'Callaghan
  2017-12-15 18:15       ` Adonay Felipe Nogueira
  2017-12-15 18:43       ` Grant Rettke
  0 siblings, 2 replies; 14+ messages in thread
From: Tim O'Callaghan @ 2017-12-15 14:54 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

Does anyone know of a good round trip/review workflow for word documents?
I'm interested in generating documents and processing feedback/comments,
especially with word document tracking.

On 15 December 2017 at 14:30, Eric S Fraga <esflists@gmail.com> wrote:

> On Friday, 15 Dec 2017 at 13:58, Fabrice Popineau wrote:
> > The best way  is probably to generate a PDF with LaTeX
> > and to open it with MS-Word. Yes, it can do that, and the math import
> > is quite good (for what I have seen, at least as good as any other
> > alternative option).
>
> Interesting.  I don't use MS Word (I'm on Linux on all of my systems)
> but may ask somebody to check this out for me.  LibreOffice almost works
> importing the PDF generated via LaTeX but not quite.  OneDrive (web
> interface) doesn't quite work either.
>
> But pandoc is handling most of what I need.
>
> thanks,
> eric
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b
>

[-- Attachment #2: Type: text/html, Size: 1415 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 14:54     ` Tim O'Callaghan
@ 2017-12-15 18:15       ` Adonay Felipe Nogueira
  2017-12-15 18:43       ` Grant Rettke
  1 sibling, 0 replies; 14+ messages in thread
From: Adonay Felipe Nogueira @ 2017-12-15 18:15 UTC (permalink / raw)
  To: emacs-orgmode

A few weeks ago I made a suggestion similar to what you want, see [1].

[1] <https://listas.trisquel.info/pipermail/trisquel-users/2017-December/083507.html>.

2017-12-15T15:54:06+0100 Tim O'Callaghan wrote:
> Does anyone know of a good round trip/review workflow for word documents? 
> I'm interested in generating documents and processing feedback/comments,
> especially with word document tracking.

-- 
- https://libreplanet.org/wiki/User:Adfeno
- Palestrante e consultor sobre /software/ livre (não confundir com
  gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
  instantaneamente comigo no endereço abaixo.
- Contato: https://libreplanet.org/wiki/User:Adfeno#vCard
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
  Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
  GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
  (apenas sem DRM), PNG, TXT, WEBM.

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 14:54     ` Tim O'Callaghan
  2017-12-15 18:15       ` Adonay Felipe Nogueira
@ 2017-12-15 18:43       ` Grant Rettke
  2017-12-17 16:55         ` Scott Randby
  1 sibling, 1 reply; 14+ messages in thread
From: Grant Rettke @ 2017-12-15 18:43 UTC (permalink / raw)
  To: Tim O'Callaghan; +Cc: emacs-orgmode@gnu.org

Write it in Org. Export to Pandoc file pandoc-A.

Export Pandoc file pandoc-A to Word file word-A. Send that to your
peers for review.

Export Word file word-A to Pandoc file pandoc-B.

Get the Word from your peers, the file with changes from their review,
word-C. Export it to pandoc-C

Do a diff between pandoc-B and pandoc-C. Integrate the results into
your original Org file.
Sincerely,

Grant Rettke

(accidentally replied off list)
Sincerely,

Grant Rettke


On Fri, Dec 15, 2017 at 8:54 AM, Tim O'Callaghan <timo@linux.com> wrote:
> Does anyone know of a good round trip/review workflow for word documents?
> I'm interested in generating documents and processing feedback/comments,
> especially with word document tracking.
>
> On 15 December 2017 at 14:30, Eric S Fraga <esflists@gmail.com> wrote:
>>
>> On Friday, 15 Dec 2017 at 13:58, Fabrice Popineau wrote:
>> > The best way  is probably to generate a PDF with LaTeX
>> > and to open it with MS-Word. Yes, it can do that, and the math import
>> > is quite good (for what I have seen, at least as good as any other
>> > alternative option).
>>
>> Interesting.  I don't use MS Word (I'm on Linux on all of my systems)
>> but may ask somebody to check this out for me.  LibreOffice almost works
>> importing the PDF generated via LaTeX but not quite.  OneDrive (web
>> interface) doesn't quite work either.
>>
>> But pandoc is handling most of what I need.
>>
>> thanks,
>> eric
>>
>> --
>> Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b
>
>

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 18:43       ` Grant Rettke
@ 2017-12-17 16:55         ` Scott Randby
  2017-12-18  3:14           ` Grant Rettke
  0 siblings, 1 reply; 14+ messages in thread
From: Scott Randby @ 2017-12-17 16:55 UTC (permalink / raw)
  To: Grant Rettke; +Cc: emacs-orgmode@gnu.org

On 12/15/2017 01:43 PM, Grant Rettke wrote:
> Write it in Org. Export to Pandoc file pandoc-A.
> 
> Export Pandoc file pandoc-A to Word file word-A. Send that to your
> peers for review.
> 
> Export Word file word-A to Pandoc file pandoc-B.
> 
> Get the Word from your peers, the file with changes from their review,
> word-C. Export it to pandoc-C
> 
> Do a diff between pandoc-B and pandoc-C. Integrate the results into
> your original Org file.

I'm confused. My understanding is that Pandoc converts between file formats, so I don't understand what you mean by a Pandoc file. What is the file format of pandoc-A?

Is this what you mean?

Pandoc: Org -> word-A
Pandoc: word-A -> pandoc-B.org
Pandoc: word-C -> pandoc-C.org

Scott Randby

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-17 16:55         ` Scott Randby
@ 2017-12-18  3:14           ` Grant Rettke
  2017-12-18 23:45             ` Scott Randby
  0 siblings, 1 reply; 14+ messages in thread
From: Grant Rettke @ 2017-12-18  3:14 UTC (permalink / raw)
  To: Scott Randby; +Cc: emacs-orgmode@gnu.org

On Sun, Dec 17, 2017 at 10:55 AM, Scott Randby <srandby@gmail.com> wrote:
>
> On 12/15/2017 01:43 PM, Grant Rettke wrote:
> > Write it in Org. Export to Pandoc file pandoc-A.
> >
> > Export Pandoc file pandoc-A to Word file word-A. Send that to your
> > peers for review.
> >
> > Export Word file word-A to Pandoc file pandoc-B.
> >
> > Get the Word from your peers, the file with changes from their review,
> > word-C. Export it to pandoc-C
> >
> > Do a diff between pandoc-B and pandoc-C. Integrate the results into
> > your original Org file.
>
> I'm confused. My understanding is that Pandoc converts between file formats, so I don't understand what you mean by a Pandoc file. What is the file format of pandoc-A?
>
> Is this what you mean?
>
> Pandoc: Org -> word-A
> Pandoc: word-A -> pandoc-B.org
> Pandoc: word-C -> pandoc-C.org

Pandoc has their own markup language "Pandoc Markdown". That is what I
meant by "Pandoc". And that was totally wrong in regards to your
question. Sorry my mistake.

You said it right, yes. It makes it easy to diff the "reverse
engineered" Org fils to see what changed from the reviewers.

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-18  3:14           ` Grant Rettke
@ 2017-12-18 23:45             ` Scott Randby
  0 siblings, 0 replies; 14+ messages in thread
From: Scott Randby @ 2017-12-18 23:45 UTC (permalink / raw)
  To: Grant Rettke, emacs-orgmode@gnu.org



On 12/17/2017 10:14 PM, Grant Rettke wrote:
> On Sun, Dec 17, 2017 at 10:55 AM, Scott Randby <srandby@gmail.com> wrote:
>>
>> On 12/15/2017 01:43 PM, Grant Rettke wrote:
>>> Write it in Org. Export to Pandoc file pandoc-A.
>>>
>>> Export Pandoc file pandoc-A to Word file word-A. Send that to your
>>> peers for review.
>>>
>>> Export Word file word-A to Pandoc file pandoc-B.
>>>
>>> Get the Word from your peers, the file with changes from their review,
>>> word-C. Export it to pandoc-C
>>>
>>> Do a diff between pandoc-B and pandoc-C. Integrate the results into
>>> your original Org file.
>>
>> I'm confused. My understanding is that Pandoc converts between file formats, so I don't understand what you mean by a Pandoc file. What is the file format of pandoc-A?
>>
>> Is this what you mean?
>>
>> Pandoc: Org -> word-A
>> Pandoc: word-A -> pandoc-B.org
>> Pandoc: word-C -> pandoc-C.org
> 
> Pandoc has their own markup language "Pandoc Markdown". That is what I
> meant by "Pandoc". And that was totally wrong in regards to your
> question. Sorry my mistake.
> 
> You said it right, yes. It makes it easy to diff the "reverse
> engineered" Org fils to see what changed from the reviewers.

I appreciate the clarification. Your method is very useful to me since I frequently have to work with people who know nothing but Word and since LibreOffice doesn't deal well with some of the poorly formatted DOCX files I receive. I've been experimenting with some sample files, and your method works great.

I know this is a lost cause, but I dream of the future in which document collaboration is done using only text files.

Scott
> 

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-15 12:28 ` Eric S Fraga
@ 2017-12-19  5:09   ` edgar
  2017-12-21  8:58     ` Tim O'Callaghan
  0 siblings, 1 reply; 14+ messages in thread
From: edgar @ 2017-12-19  5:09 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

On 2017-12-15 12:28, Eric S Fraga wrote:
> On Friday, 15 Dec 2017 at 03:20, edgar@openmail.cc wrote:
> 
> [...]
> 
>> I only know how to do a rough approximation by means of pandoc:
>> 
>> #+BEGIN_SRC bash
>>    pandoc -f org+smart my-original.org -t docx+smart -o my-output.docx
>> #+END_SRC
> 
> What version of pandoc are you using?  My Debian (testing) has pandoc
> 1.19.2.4 and it does not seem to recognise the +smart bits...
> 
> But, in any case, pandoc (without the smart bits) does seem to do a
> reasonable job and creates proper maths entities.  This is good enough
> for me!  My once a year pain is relieved.  :-)
> 
> Thanks,
> eric

I'm sorry for the very late response (deadlines). I will check for the 
pandoc version and let you know. One of the distros that I use is a 
rolling linux. The other one is the same as yours. I would also like to 
note that I got the pandoc snippet from Dr. Kitchin's website: 
http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org-mode-to-docx-with-citations-via-pandoc/

I checked, and I am very satisfied with ~C-c C-e o o~. I set #+OPTIONS: 
dvipng. You can't edit the formulas, but I don't care about that. All my 
equations look fine and the pictures too. I also have to copy my 
references by hand, but that is the least of my issues, and I only do it 
when the final version is ready. I also get my source blocks right.

I think that the only thing which is really missing from Org as related 
to exporting is handling pictures inside tables (a way to create 
subfigures). There is a partial solution with ox-latex-subfigure 
[[https://github.com/linktohack/ox-latex-subfigure]], but is limited in 
the :width parameter. One of these days I will learn LISP and implement 
it myself (unless another brave soul goes for it first). Even Beamer 
columns can be used to this end, but this would only work for 
presentations. I don't know any other way.

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

[-- Attachment #2: doc-convert.odt --]
[-- Type: application/octet-stream, Size: 188440 bytes --]

[-- Attachment #3: doc-convert.org --]
[-- Type: text/plain, Size: 4811 bytes --]

#+OPTIONS: author:nil
#+TITLE: My fancy title

* Finite element conditions
- Note taken on [2017-02-16 Thu 23:35] \\
  3% strain via a load curve (relaxed for viscoelastic case)
  fiber direction (\lambda) as a function of time for each element
** One-element test
- Elongated from 0 to 100% from $t=0$ s to $t=1$ s
- The elongation was held constant and the stress relaxed until $t=3$ s

** Stress relaxation
- 125 elements (5\times5\times5)
- Same conditions as [[tab:coeff]]
  #+NAME: tab:coeff
  #+CAPTION: Coefficients
  | G_{e} | G_{0} | N_{d} | I_{0} |
  | (MPa) | (MPa) | ?     | ?     |
  |-------+-------+-------+-------|
  | 0.429 | 1.0   | 6     |     0 |
- Displacement boundary conditions
- Stretched from 0 to 3% in 5 s, followed by 1.5% ~ 3.0% cyclic strain
  @ 0.1 Hz
- Timestepping adjusted to ensure solution at each peak and valley
** Model
*** Bodies
- Rigid bodies
- 6 DOF
- Position by load curves (functions of time)

  #+BEGIN_QUOTE
  This requires storage for a symmetric 2nd order tensor at each
  integration point for each element, at each previous timestep.
  #+END_QUOTE

    $$ \int_{a}^{b}{f(x)\,g(x)\d{x}}\big. = f(\xi{})\,\int_{a}^{b}{g(x)\d{x}}\big. \qquad a < \xi{} < b$$

Referencing my code [[blk-test]]

#+NAME: blk-test
#+CAPTION: My block
#+BEGIN_SRC python
  import numpy as np

  a = np.zeros([3,3])
#+END_SRC

#+CAPTION: clamping
[[file:../Figures/KrentzGeom/clampingInitial.png]]
# https://www.reddit.com/r/emacs/comments/418rzk/how_to_use_orgmode_to_write_documentation_for/
# https://www.wisdomandwonder.com/link/9922/how-to-reintegrate-changes-for-word-back-into-org-mode
# http://kitchingroup.cheme.cmu.edu/blog/2014/07/17/Pandoc-does-org-mode-now/
# http://pandoc.org/demos.html

* Configuration                                    :noexport:
#+OPTIONS: tex:dvipng

** First alternative
To get a working file, first set the ~#+OPTIONS: dvipng~ somewhere, then export to odt with Org-mode
(~C-c C-e o o~), and run this (you can do ~C-c C-c~
on it; make sure that LibreOffice is not running)
#+BEGIN_SRC shell :results none
 libreoffice --headless --convert-to doc ./doc-convert.odt
#+END_SRC

** Other alternatives:

#+BEGIN_SRC bash
  pandoc -s -S --bibliography=../../References.bib wcb2018-abstract.org -o wcb2018-abstract.doc
  pandoc -f org+smart --bibliography=../../References.bib wcb2018-abstract.org -o wcb2018-abstract.doc
  pandoc -f org+smart wcb2018-abstract.org -t docx+smart -o wcb2018-abstract.docx
#+END_SRC

#+BEGIN_SRC emacs-lisp :exports none :eval no-export
  ;; http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org-mode-to-docx-with-citations-via-pandoc/
  (defun helm-bibtex-format-pandoc-citation (keys)
    (concat "[" (mapconcat (lambda (key) (concat "@" key)) keys "; ") "]"))

  ;; inform helm-bibtex how to format the citation in org-mode
  (setf (cdr (assoc 'org-mode helm-bibtex-format-citation-functions))
        'helm-bibtex-format-pandoc-citation)

  (defun ox-export-to-docx-and-open ()
    "Export the current org file as a docx via markdown."
    (interactive)
    (let* ((bibfile (expand-file-name (car (org-ref-find-bibliography))))
           ;; this is probably a full path
           (current-file (buffer-file-name))
           (basename (file-name-sans-extension current-file))
           (docx-file (concat basename ".docx")))
      (save-buffer)
      (when (file-exists-p docx-file) (delete-file docx-file))
      (shell-command (format
                      "pandoc -s -S --bibliography=%s %s -o %s"
                      bibfile current-file docx-file))
      (org-open-file docx-file '(16))))

#+END_SRC

** General options
   - Import symbols
     #+LaTeX_HEADER: \input{../Reports/symbols.tex}
   - Show all headings on startup
     #+STARTUP: content
   - No table of contents
     #+OPTIONS: toc:nil
   - Use python3, do not evaluate when exporting and create
     a session (all blocks are connected)
     #+PROPERTY: header-args:python :python python3 :eval no-export :session
   - Substitute "Listings" for "Blocks" when exporting code to LaTeX
     # http://stackoverflow.com/questions/2814714/
     #+LATEX_HEADER: \renewcommand\lstlistingname{Block}
     #+LATEX_HEADER: \renewcommand\lstlistlistingname{Code blocks}
     #+LATEX_HEADER: \def\lstlistingautorefname{Blk.}

** Change the resolution of the exported equations (and previews)
  - Use dvipng to export
  #+OPTIONS: tex:dvipng

* Local variables                                          :ARCHIVE:noexport:
  # https://stackoverflow.com/a/20033865
  # Local Variables:
  # coding: utf-8
  # org-format-latex-options: (plist-put org-format-latex-options :scale 1.5)
  # End:

*** COMMENT If you want more control, use this
   # #+OPTIONS: tex:imagemagick
   # # org-format-latex-options: (plist-put org-format-latex-options :scale 10)

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-19  5:09   ` edgar
@ 2017-12-21  8:58     ` Tim O'Callaghan
  2017-12-26  4:09       ` Adrian Bradd
  0 siblings, 1 reply; 14+ messages in thread
From: Tim O'Callaghan @ 2017-12-21  8:58 UTC (permalink / raw)
  To: org-mode

[-- Attachment #1: Type: text/plain, Size: 2525 bytes --]

Thanks!
I will experiment with this work-flow, but i have one other issue, any
advice on working with existing (word) document templates?
I have to work within templates, so it would be great if i could manage to
conform.

On 19 December 2017 at 06:09, <edgar@openmail.cc> wrote:

> On 2017-12-15 12:28, Eric S Fraga wrote:
>
>> On Friday, 15 Dec 2017 at 03:20, edgar@openmail.cc wrote:
>>
>> [...]
>>
>> I only know how to do a rough approximation by means of pandoc:
>>>
>>> #+BEGIN_SRC bash
>>>    pandoc -f org+smart my-original.org -t docx+smart -o my-output.docx
>>> #+END_SRC
>>>
>>
>> What version of pandoc are you using?  My Debian (testing) has pandoc
>> 1.19.2.4 and it does not seem to recognise the +smart bits...
>>
>> But, in any case, pandoc (without the smart bits) does seem to do a
>> reasonable job and creates proper maths entities.  This is good enough
>> for me!  My once a year pain is relieved.  :-)
>>
>> Thanks,
>> eric
>>
>
> I'm sorry for the very late response (deadlines). I will check for the
> pandoc version and let you know. One of the distros that I use is a rolling
> linux. The other one is the same as yours. I would also like to note that I
> got the pandoc snippet from Dr. Kitchin's website:
> http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org
> -mode-to-docx-with-citations-via-pandoc/
>
> I checked, and I am very satisfied with ~C-c C-e o o~. I set #+OPTIONS:
> dvipng. You can't edit the formulas, but I don't care about that. All my
> equations look fine and the pictures too. I also have to copy my references
> by hand, but that is the least of my issues, and I only do it when the
> final version is ready. I also get my source blocks right.
>
> I think that the only thing which is really missing from Org as related to
> exporting is handling pictures inside tables (a way to create subfigures).
> There is a partial solution with ox-latex-subfigure [[
> https://github.com/linktohack/ox-latex-subfigure]], but is limited in the
> :width parameter. One of these days I will learn LISP and implement it
> myself (unless another brave soul goes for it first). Even Beamer columns
> can be used to this end, but this would only work for presentations. I
> don't know any other way.
>
>
> -------------------------------------------------
>
> ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of
> the NSA's hands!
> $24.95 ONETIME Lifetime accounts with Privacy Features!  15GB disk! No
> bandwidth quotas!
> Commercial and Bulk Mail Options!
>

[-- Attachment #2: Type: text/html, Size: 3568 bytes --]

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

* Re: advice please: best way to export to DOC(X) with maths
  2017-12-21  8:58     ` Tim O'Callaghan
@ 2017-12-26  4:09       ` Adrian Bradd
  0 siblings, 0 replies; 14+ messages in thread
From: Adrian Bradd @ 2017-12-26  4:09 UTC (permalink / raw)
  To: Tim O'Callaghan; +Cc: org-mode


According to Karl's post [1], pandoc now supports conversion with some
template support. I haven't tried it myself though.

Cheers,

Adrian

[1] http://www.karl-voit.at/2017/12/17/pandoc-docx-reference/

Tim O'Callaghan <timo@linux.com> writes:

> Thanks!
> I will experiment with this work-flow, but i have one other issue, any
> advice on working with existing (word) document templates?
> I have to work within templates, so it would be great if i could manage to
> conform.
>
> On 19 December 2017 at 06:09, <edgar@openmail.cc> wrote:
>
>> On 2017-12-15 12:28, Eric S Fraga wrote:
>>
>>> On Friday, 15 Dec 2017 at 03:20, edgar@openmail.cc wrote:
>>>
>>> [...]
>>>
>>> I only know how to do a rough approximation by means of pandoc:
>>>>
>>>> #+BEGIN_SRC bash
>>>>    pandoc -f org+smart my-original.org -t docx+smart -o my-output.docx
>>>> #+END_SRC
>>>>
>>>
>>> What version of pandoc are you using?  My Debian (testing) has pandoc
>>> 1.19.2.4 and it does not seem to recognise the +smart bits...
>>>
>>> But, in any case, pandoc (without the smart bits) does seem to do a
>>> reasonable job and creates proper maths entities.  This is good enough
>>> for me!  My once a year pain is relieved.  :-)
>>>
>>> Thanks,
>>> eric
>>>
>>
>> I'm sorry for the very late response (deadlines). I will check for the
>> pandoc version and let you know. One of the distros that I use is a rolling
>> linux. The other one is the same as yours. I would also like to note that I
>> got the pandoc snippet from Dr. Kitchin's website:
>> http://kitchingroup.cheme.cmu.edu/blog/2015/01/29/Export-org
>> -mode-to-docx-with-citations-via-pandoc/
>>
>> I checked, and I am very satisfied with ~C-c C-e o o~. I set #+OPTIONS:
>> dvipng. You can't edit the formulas, but I don't care about that. All my
>> equations look fine and the pictures too. I also have to copy my references
>> by hand, but that is the least of my issues, and I only do it when the
>> final version is ready. I also get my source blocks right.
>>
>> I think that the only thing which is really missing from Org as related to
>> exporting is handling pictures inside tables (a way to create subfigures).
>> There is a partial solution with ox-latex-subfigure [[
>> https://github.com/linktohack/ox-latex-subfigure]], but is limited in the
>> :width parameter. One of these days I will learn LISP and implement it
>> myself (unless another brave soul goes for it first). Even Beamer columns
>> can be used to this end, but this would only work for presentations. I
>> don't know any other way.
>>
>>
>> -------------------------------------------------
>>
>> ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of
>> the NSA's hands!
>> $24.95 ONETIME Lifetime accounts with Privacy Features!  15GB disk! No
>> bandwidth quotas!
>> Commercial and Bulk Mail Options!
>>


-- 
Adrian

Bioelectronic Systems Lab,
Columbia University

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

end of thread, other threads:[~2017-12-26  4:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15  3:20 advice please: best way to export to DOC(X) with maths edgar
2017-12-15 12:28 ` Eric S Fraga
2017-12-19  5:09   ` edgar
2017-12-21  8:58     ` Tim O'Callaghan
2017-12-26  4:09       ` Adrian Bradd
  -- strict thread matches above, loose matches on Subject: below --
2017-12-14 12:18 Eric S Fraga
2017-12-15 12:58 ` Fabrice Popineau
2017-12-15 13:30   ` Eric S Fraga
2017-12-15 14:54     ` Tim O'Callaghan
2017-12-15 18:15       ` Adonay Felipe Nogueira
2017-12-15 18:43       ` Grant Rettke
2017-12-17 16:55         ` Scott Randby
2017-12-18  3:14           ` Grant Rettke
2017-12-18 23:45             ` Scott Randby

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