emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: edgar@openmail.cc
To: emacs-orgmode@gnu.org
Subject: Re: advice please: best way to export to DOC(X) with maths
Date: Tue, 19 Dec 2017 05:09:50 +0000	[thread overview]
Message-ID: <dcfe7480ec57e5446e075023a7f486d0@openmail.cc> (raw)
In-Reply-To: <87efnw41ls.fsf@gmail.com>

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

  reply	other threads:[~2017-12-19  5:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=dcfe7480ec57e5446e075023a7f486d0@openmail.cc \
    --to=edgar@openmail.cc \
    --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).