emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Slight problems with links
@ 2019-04-29  6:33 Emmanuel Charpentier
  2019-04-29 20:57 ` John Kitchin
  0 siblings, 1 reply; 9+ messages in thread
From: Emmanuel Charpentier @ 2019-04-29  6:33 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear list,

one of my uses od org-mode is to prepare documents wrapping R (and
sometimes Sagemath) call results in interpretation text. My reference
output is .pdf documents, but I *have* to prepare a .docx version (for
use in managerial spheres, where computer literacy is *very* low.
Cross-references and citations are a sine qua non, maths are useful.

I have been annoyed by a couple of deficiencies and inconsistencies
between exporters, so I prepared a test document testing various cases.
This documents and some exports are attached (NE = Native exporter, PE
= ox-pandoc exporter).

TL;DR :

  * I tested the built-in latex/pdf exporter as well as ox-pandoc, the
latter both for .pdf and .docx export. The built-in ODT exporter
doesn't export citations ; therefore, I didn't test it further.


  * org-ref's :labels and :refs do not export to anything but the
built-in latex exporter. The native system of #+NAME:s and #+CAPTION:s,
a bit on the heavy side, seems not to fail (except that they do not
expand in a caption...).

  * Maths, tables, figures are unproblematic.

  * The requirements of org-reftex, the built-in latex exporter and ox-
pandoc being mutually incompatible, and some ingenuity is required. see
the attached org source. Org-ref's requirements do not simplify the
situation...

  * Code snippets (i. e. source blocks exporting code) have a
captioning/numbering problem :

    - With the built-in latex exporter, they are numbered and labeled
as figures.

    - The pandoc latex exporter numbers them separately (as seen by
referencing them), but do not output this number (nor the category)
before the caption.

    - The pandoc .docx exporter works as advertised.

So I have a couple of questions:

  * What can be done to reconcile org-ref's, latex-exporter's and ox-
pandoc's requirements for bibliographies ?

  * How to fix the pdf exporters' quirks with code snippets ?

HTH,

--
Emmanuel Charpentier

[-- Attachment #2: Links.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 22700 bytes --]

[-- Attachment #3: Links.org --]
[-- Type: text/plain, Size: 6560 bytes --]

# An archi-minimal test of bibliography export.
# Goals : export to LaTeX(PDF) and DOCX as transparently as possible

#+options: tex:t title:nil author:nil date:nil toc:nil
#+property: header-args:sage :session
#+PANDOC_OPTIONS: number-sections:t

#+begin_src emacs-lisp :exports none :results none
  (require 'org-ref)
  ;; This is much needed to manage changes in bibliography exports...
  (setq org-latex-pdf-process
	(list "latexmk -pdf -pdflatex='%latex -interaction=nonstopmode -shell-escape' -bibtex -f %f")
	org-latex-to-mathml-convert-command
	"latexmlmath \"%i\" --presentationmathml=%o")
#+end_src

Export by **src_emacs-lisp[:results raw]{org-export-current-backend}**.

* Test of maths <<sec:Maths>>

** Hand-typed

Everyone knows[fn::or should know...] that \(e^{i\theta}=\cos\theta+i\sin\theta\)[fn::This is de Moivre's formula]. It results that:
#+name: eq:Euler
\begin{equation}
e^{i\pi}+1=0
\end{equation}

This equation [[eq:Euler]], known as Euler's formula, is one of the best known formulas of elementary maths.

** Sage-generated

#+name: FA
#+begin_src sage :exports results :results table
  def matable():
      a,b=SR.var("a, b")
      LF=[sin, cos, tan]
      T=[f(v)==f(v).trig_expand() for f in LF for v in[a+b, a-b]]
      return [[r"\(\displaystyle {}\)".format(latex(f))] for f in T]
  matable()
#+end_src

#+name: tab:FA
#+caption:Addition formulas, générated by the  Sage snippet [[lst:FA]].
#+RESULTS: FA
| \(\displaystyle \sin\left(a + b\right) = \cos\left(b\right) \sin\left(a\right) + \cos\left(a\right) \sin\left(b\right)\)              |
| \(\displaystyle \sin\left(a - b\right) = \cos\left(b\right) \sin\left(a\right) - \cos\left(a\right) \sin\left(b\right)\)              |
| \(\displaystyle \cos\left(a + b\right) = \cos\left(a\right) \cos\left(b\right) - \sin\left(a\right) \sin\left(b\right)\)              |
| \(\displaystyle \cos\left(a - b\right) = \cos\left(a\right) \cos\left(b\right) + \sin\left(a\right) \sin\left(b\right)\)              |
| \(\displaystyle \tan\left(a + b\right) = -\frac{\tan\left(a\right) + \tan\left(b\right)}{\tan\left(a\right) \tan\left(b\right) - 1}\) |
| \(\displaystyle \tan\left(a - b\right) = \frac{\tan\left(a\right) - \tan\left(b\right)}{\tan\left(a\right) \tan\left(b\right) + 1}\)  |

The results in table [[tab:FA]]  (generated by the Sage snippet in listing [[lst:FA]]) should be known perfectly by any college candidate (yes, even in humanities...).

* Figures <<sec:Figures>>

#+name: SageFig
#+begin_src sage :results file :exports results
  plot(sin, -pi,pi, figsize=4, aspect_ratio=1)
#+end_src

#+name: fig:SageFig
#+caption: A well-known figure, generated by the Sage snippet ||lst:SageFig]].
#+RESULTS: SageFig
[[file:/home/charpent/.sage/temp/zen-book-flip/1793/tmp_ptu96N.png]]

The figure [[fig:SageFig]] (generated by the code snippet of listing [[lst:SageFig]]) whil be placed by \LaTeX at some ``convenient'' place.

* Citations <<sec:Citations>>

# This has been created with ~org-ref-help-insert-cite-link~,
# at a time where the ~[[bibliography...~ link was uncommented.
Citation attempt with a ~cite:~ link : cite:chenouardPhoneTriagePaediatric2016,bergouniouxCalpainActivationShigella2012

# This has been created with ~org-ref-tex-citation :
Another attempt, using a ~\cite{}~ \LaTeX{} macro : \cite{loganadaneCurrentRoleWhole2017}

* Conclusions

** What works

  * Maths (inline, displayed or math environments) are correctly displayed. There is some support for referencing (isolated) equations. See §[[sec:Maths]].
  * Tables are correctly displayed and referenced. (Ditto).
  * Figures are correctly displayed and referenced. See §[[sec:Figures]]
  * Citations can be correctly retrieved and bibliographies can be correctly generated, as shown in §[[sec:Citations]].

The latter requires some ingenuity: My source contains the following snippet at the place where the references are needed:
#+begin_src emacs-lisp :eval no :exports code :noweb yes
<<BiblioTrick>>
#+end_src

The resulting trick leaves enough information in the source file to be able to use ~org-reftex-citation~ function (~C-c C-x [~)  but not enough for the ~org-ref-helm-insert-cite-link~ (~C-c ]~).

One also notes that the ~:results~ type **has** to be ~raw~ ; using ~org~ prepends a comma to the intended result...

** What doesn't (in any exporter)

  * Links are not expanded in captions, and print litteraly.

    A test show that ~org-ref~ ~ref:~  links do expand in captions when exported by the native \LaTeX{} exporter. They are, however, unusable for my purpose, since they do not export (i.e. print litteraly) to anything else...

** Support depending on the exporter

*** Built-in \LaTeX{} exporter

  * Listings (code snippets) are numbered and labeled as figures.

*** All ~pandoc~ exporters

  * References appear necessarily at the end of the document.

    I understand that this a long-known deficiency of ~pandoc~; some workaround exist for ~HTML~ output, but do not seem to apply to ~.docx~ nor ~.pdf~ outputs.

*** ~Pandoc~ \LaTeX{} exporter (~ox-pandoc~)

  * Code snippets are correcly numbered, but neither their captions nor the numbers appear in the resulting PDF.

  * (A pecadillo) In text, the string =\LaTeX{}= exports literally as ~LaTeX{}~, not the expected symbol...

*** ~Pandoc~ ~.docx~ exporter

  * I have been unable to get numbered sections.

    I understand that this might be a limitatin of ~pandoc~ itself, and can be fixed by substituting another ~.docx~ template.

  * I have been unable to master the position of some elements: both table and figures appear at the left of the page.

\appendix

* Some listings

** Maths
#+name: lst:FA
#+caption: Generation of table [[tab:FA]]
#+begin_src sage :eval no :exports code :noweb yes
<<FA>>
#+end_src

** Figures

#+name: lst:SageFig
#+caption: Generation of the figure [[fig:SageFig]].
#+begin_src sage :eval no :exports code :noweb yes
<<SageFig>>
#+end_src

#+name: BiblioTrick
#+begin_src emacs-lisp :exports results :results raw
  (cond ( ;; This allows export to DOCX/ODT :
	 (eq org-export-current-backend 'pandoc)
	 "* References\n\#+bibliography: CRCInnovation2019.bib\n\#+PANDOC_OPTIONS: csl:vancouver-brackets.csl")
	;;This allows export to LaTeX/PDF with the builtin exporter :
	((eq org-export-current-backend 'latex)
	 "[[bibliographystyle:vancouver]]\n[[bibliography:CRCInnovation2019.bib]]")
	;; This leaves enough information to allow org-reftex to find its file :
	(t "\#+bibliography: CRCInnovation2019"))

#+end_src

#+RESULTS:
#+bibliography: CRCInnovation2019

[-- Attachment #4: Links-NE.pdf --]
[-- Type: application/pdf, Size: 201541 bytes --]

[-- Attachment #5: Links-PE.pdf --]
[-- Type: application/pdf, Size: 243498 bytes --]

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

* Slight problems with links
@ 2019-04-29  7:35 Emmanuel Charpentier
  0 siblings, 0 replies; 9+ messages in thread
From: Emmanuel Charpentier @ 2019-04-29  7:35 UTC (permalink / raw)
  To: emacs-orgmode

Dear list,

one of my uses od org-mode is to prepare documents wrapping R (and
sometimes Sagemath) call results in interpretation text. My reference
output is .pdf documents, but I *have* to prepare a .docx version (for
use in managerial spheres, where computer literacy is *very* low.
Cross-references and citations are a sine qua non, maths are useful.

I have been annoyed by a couple of deficiencies and inconsistencies
between exporters, so I prepared a test document testing various cases.
This documents and some exports are too big to be atached but can be
downloaded  from 
https://drive.google.com/open?id=1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i (NE
= Native exporter, PE= ox-pandoc exporter).

TL;DR :

  * I tested the built-in latex/pdf exporter as well as ox-pandoc, the
latter both for .pdf and .docx export. The built-in ODT exporter
doesn't export citations ; therefore, I didn't test it further.


  * org-ref's :labels and :refs do not export to anything but the
built-in latex exporter. The native system of #+NAME:s and #+CAPTION:s,
a bit on the heavy side, seems not to fail (except that they do not
expand in a caption...).

  * Maths, tables, figures are unproblematic.

  * The requirements of org-reftex, the built-in latex exporter and ox-
pandoc being mutually incompatible, and some ingenuity is required. see
the org source. Org-ref's requirements do not simplify the
situation...

  * Code snippets (i. e. source blocks exporting code) have a
captioning/numbering problem :

    - With the built-in latex exporter, they are numbered and labeled
as figures.

    - The pandoc latex exporter numbers them separately (as seen by
referencing them), but do not output this number (nor the category)
before the caption.

    - The pandoc .docx exporter works as advertised.

So I have a couple of questions:

  * What can be done to reconcile org-ref's, latex-exporter's and ox-
pandoc's requirements for bibliographies ?

  * How to fix the pdf exporters' quirks with code snippets ?

HTH,

--
Emmanuel Charpentier

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

* Re: Slight problems with links
  2019-04-29  6:33 Slight problems with links Emmanuel Charpentier
@ 2019-04-29 20:57 ` John Kitchin
  2019-04-29 21:18   ` Emmanuel Charpentier
  0 siblings, 1 reply; 9+ messages in thread
From: John Kitchin @ 2019-04-29 20:57 UTC (permalink / raw)
  To: Emmanuel Charpentier; +Cc: emacs-orgmode

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

For org-ref, there isn't much magic on what happens on export. LaTeX is
certainly the most well supported, and it seems like org -> latex -> pandoc
is the only way that makes sense to get to docx to me.  Using pandoc on org
files directly is probably hopeless unless you can get pandoc to include
some definitions for the org-ref links.

Some of the link types in org-ref have some exports defined for org, html,
latex, sometimes ascii. If one of these works well with pandoc we could try
to make them output something useful for them, or at least make sure that
org->org export turns them into something useful. Getting figure/table
numbers has always been tricky; I don't think this worked well with pandoc,
and handling it on the org side requires some preprocessing to add numbers.
For now, the ox-word exporter in scimax comes closest, but it isn't a
feature I use a lot, so it hasn't been improved in a while.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
emm.charpentier@free.fr> wrote:

> Dear list,
>
> one of my uses od org-mode is to prepare documents wrapping R (and
> sometimes Sagemath) call results in interpretation text. My reference
> output is .pdf documents, but I *have* to prepare a .docx version (for
> use in managerial spheres, where computer literacy is *very* low.
> Cross-references and citations are a sine qua non, maths are useful.
>
> I have been annoyed by a couple of deficiencies and inconsistencies
> between exporters, so I prepared a test document testing various cases.
> This documents and some exports are attached (NE = Native exporter, PE
> = ox-pandoc exporter).
>
> TL;DR :
>
>   * I tested the built-in latex/pdf exporter as well as ox-pandoc, the
> latter both for .pdf and .docx export. The built-in ODT exporter
> doesn't export citations ; therefore, I didn't test it further.
>
>
>   * org-ref's :labels and :refs do not export to anything but the
> built-in latex exporter. The native system of #+NAME:s and #+CAPTION:s,
> a bit on the heavy side, seems not to fail (except that they do not
> expand in a caption...).
>
>   * Maths, tables, figures are unproblematic.
>
>   * The requirements of org-reftex, the built-in latex exporter and ox-
> pandoc being mutually incompatible, and some ingenuity is required. see
> the attached org source. Org-ref's requirements do not simplify the
> situation...
>
>   * Code snippets (i. e. source blocks exporting code) have a
> captioning/numbering problem :
>
>     - With the built-in latex exporter, they are numbered and labeled
> as figures.
>
>     - The pandoc latex exporter numbers them separately (as seen by
> referencing them), but do not output this number (nor the category)
> before the caption.
>
>     - The pandoc .docx exporter works as advertised.
>
> So I have a couple of questions:
>
>   * What can be done to reconcile org-ref's, latex-exporter's and ox-
> pandoc's requirements for bibliographies ?
>
>   * How to fix the pdf exporters' quirks with code snippets ?
>
> HTH,
>
> --
> Emmanuel Charpentier
>

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

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

* Re: Slight problems with links
  2019-04-29 20:57 ` John Kitchin
@ 2019-04-29 21:18   ` Emmanuel Charpentier
  2019-04-29 21:23     ` John Kitchin
  0 siblings, 1 reply; 9+ messages in thread
From: Emmanuel Charpentier @ 2019-04-29 21:18 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

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

Dear John,
Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
> For org-ref, there isn't much magic on what happens on export. LaTeX
> is certainly the most well supported, and it seems like org -> latex
> -> pandoc is the only way that makes sense to get to docx to me. 
> Using pandoc on org files directly is probably hopeless unless you
> can get pandoc to include some definitions for the org-ref links.

This might be difficult : the development of ox-pandoc seems to not be
very active at the moment...
> Some of the link types in org-ref have some exports defined for org,
> html, latex, sometimes ascii. If one of these works well with pandoc
> we could try to make them output something useful for them, or at
> least make sure that org->org export turns them into something
> useful. 

I'm currently looking at the ox-latex exporter in order to understand
what it does for source blocks with org's names and captions (and try
to fix the fact that they are labeled and nubered as figures...). Theis
understanding might help me to go in the direction  you suggest.
> Getting figure/table numbers has always been tricky; I don't think
> this worked well with pandoc, and handling it on the org side
> requires some preprocessing to add numbers. For now, the ox-word
> exporter in scimax comes closest, but it isn't a feature I use a lot,
> so it hasn't been improved in a while.

Again, looking at what ox-latex does for org's names and captions might
be helpful. Ox-pandoc seems to do a decent job on docx output.
> John
> 
> -----------------------------------
> Professor John Kitchin 
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
> 
> 
> 
> On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
> emm.charpentier@free.fr> wrote:
> > Dear list,
> > 
> > 
> > 
> > one of my uses od org-mode is to prepare documents wrapping R (and
> > 
> > sometimes Sagemath) call results in interpretation text. My
> > reference
> > 
> > output is .pdf documents, but I *have* to prepare a .docx version
> > (for
> > 
> > use in managerial spheres, where computer literacy is *very* low.
> > 
> > Cross-references and citations are a sine qua non, maths are
> > useful.
> > 
> > 
> > 
> > I have been annoyed by a couple of deficiencies and inconsistencies
> > 
> > between exporters, so I prepared a test document testing various
> > cases.
> > 
> > This documents and some exports are attached (NE = Native exporter,
> > PE
> > 
> > = ox-pandoc exporter).
> > 
> > 
> > 
> > TL;DR :
> > 
> > 
> > 
> >   * I tested the built-in latex/pdf exporter as well as ox-pandoc,
> > the
> > 
> > latter both for .pdf and .docx export. The built-in ODT exporter
> > 
> > doesn't export citations ; therefore, I didn't test it further.
> > 
> > 
> > 
> > 
> > 
> >   * org-ref's :labels and :refs do not export to anything but the
> > 
> > built-in latex exporter. The native system of #+NAME:s and
> > #+CAPTION:s,
> > 
> > a bit on the heavy side, seems not to fail (except that they do not
> > 
> > expand in a caption...).
> > 
> > 
> > 
> >   * Maths, tables, figures are unproblematic.
> > 
> > 
> > 
> >   * The requirements of org-reftex, the built-in latex exporter and
> > ox-
> > 
> > pandoc being mutually incompatible, and some ingenuity is required.
> > see
> > 
> > the attached org source. Org-ref's requirements do not simplify the
> > 
> > situation...
> > 
> > 
> > 
> >   * Code snippets (i. e. source blocks exporting code) have a
> > 
> > captioning/numbering problem :
> > 
> > 
> > 
> >     - With the built-in latex exporter, they are numbered and
> > labeled
> > 
> > as figures.
> > 
> > 
> > 
> >     - The pandoc latex exporter numbers them separately (as seen by
> > 
> > referencing them), but do not output this number (nor the category)
> > 
> > before the caption.
> > 
> > 
> > 
> >     - The pandoc .docx exporter works as advertised.
> > 
> > 
> > 
> > So I have a couple of questions:
> > 
> > 
> > 
> >   * What can be done to reconcile org-ref's, latex-exporter's and
> > ox-
> > 
> > pandoc's requirements for bibliographies ?
> > 
> > 
> > 
> >   * How to fix the pdf exporters' quirks with code snippets ?
> > 
> > 
> > 
> > HTH,
> > 
> > 
> > 
> > --
> > 
> > Emmanuel Charpentier
> > 

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

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

* Re: Slight problems with links
  2019-04-29 21:18   ` Emmanuel Charpentier
@ 2019-04-29 21:23     ` John Kitchin
  2019-04-29 21:48       ` Emmanuel Charpentier
  0 siblings, 1 reply; 9+ messages in thread
From: John Kitchin @ 2019-04-29 21:23 UTC (permalink / raw)
  To: Emmanuel Charpentier; +Cc: emacs-orgmode

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

I think you have missed the main point. My point was first to find some
format that pandoc faithfully converts to docx with all the features you
need, and then we can figure out how to turn org-ref/org into that format.
So, if you can write a LaTeX document that is correctly converted to docx
(correct bibliography, figure labels, and cross-references, correct code,
etc), then we can probably get org to output the right latex. But if LaTeX
isn't converted to docx correctly in pandoc, it does not seem likely that
org will either with any simple exporter.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <
emm.charpentier@free.fr> wrote:

> Dear John,
>
> Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
>
> For org-ref, there isn't much magic on what happens on export. LaTeX is
> certainly the most well supported, and it seems like org -> latex -> pandoc
> is the only way that makes sense to get to docx to me.  Using pandoc on org
> files directly is probably hopeless unless you can get pandoc to include
> some definitions for the org-ref links.
>
>
> This might be difficult : the development of ox-pandoc seems to not be
> very active at the moment...
>
> Some of the link types in org-ref have some exports defined for org, html,
> latex, sometimes ascii. If one of these works well with pandoc we could try
> to make them output something useful for them, or at least make sure that
> org->org export turns them into something useful.
>
>
> I'm currently looking at the ox-latex exporter in order to understand what
> it does for source blocks with org's names and captions (and try to fix the
> fact that they are labeled and nubered as figures...). Theis understanding
> might help me to go in the direction you suggest.
>
> Getting figure/table numbers has always been tricky; I don't think this
> worked well with pandoc, and handling it on the org side requires some
> preprocessing to add numbers. For now, the ox-word exporter in scimax comes
> closest, but it isn't a feature I use a lot, so it hasn't been improved in
> a while.
>
>
> Again, looking at what ox-latex does for org's names and captions might be
> helpful. Ox-pandoc seems to do a decent job on docx output.
>
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
> emm.charpentier@free.fr> wrote:
>
> Dear list,
>
> one of my uses od org-mode is to prepare documents wrapping R (and
> sometimes Sagemath) call results in interpretation text. My reference
> output is .pdf documents, but I *have* to prepare a .docx version (for
> use in managerial spheres, where computer literacy is *very* low.
> Cross-references and citations are a sine qua non, maths are useful.
>
> I have been annoyed by a couple of deficiencies and inconsistencies
> between exporters, so I prepared a test document testing various cases.
> This documents and some exports are attached (NE = Native exporter, PE
> = ox-pandoc exporter).
>
> TL;DR :
>
>   * I tested the built-in latex/pdf exporter as well as ox-pandoc, the
> latter both for .pdf and .docx export. The built-in ODT exporter
> doesn't export citations ; therefore, I didn't test it further.
>
>
>   * org-ref's :labels and :refs do not export to anything but the
> built-in latex exporter. The native system of #+NAME:s and #+CAPTION:s,
> a bit on the heavy side, seems not to fail (except that they do not
> expand in a caption...).
>
>   * Maths, tables, figures are unproblematic.
>
>   * The requirements of org-reftex, the built-in latex exporter and ox-
> pandoc being mutually incompatible, and some ingenuity is required. see
> the attached org source. Org-ref's requirements do not simplify the
> situation...
>
>   * Code snippets (i. e. source blocks exporting code) have a
> captioning/numbering problem :
>
>     - With the built-in latex exporter, they are numbered and labeled
> as figures.
>
>     - The pandoc latex exporter numbers them separately (as seen by
> referencing them), but do not output this number (nor the category)
> before the caption.
>
>     - The pandoc .docx exporter works as advertised.
>
> So I have a couple of questions:
>
>   * What can be done to reconcile org-ref's, latex-exporter's and ox-
> pandoc's requirements for bibliographies ?
>
>   * How to fix the pdf exporters' quirks with code snippets ?
>
> HTH,
>
> --
> Emmanuel Charpentier
>
>

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

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

* Re: Slight problems with links
  2019-04-29 21:23     ` John Kitchin
@ 2019-04-29 21:48       ` Emmanuel Charpentier
  2019-04-30  6:43         ` Ken Mankoff
  0 siblings, 1 reply; 9+ messages in thread
From: Emmanuel Charpentier @ 2019-04-29 21:48 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

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

Dear John,
Indeed, I missed your point. I'll have to bet back to you after
reading, understanding the code (org-mode is a tall order...) and
*thinking*.
However, the troubling fact that ox-latex manages to export org's
labelling correctly shows that its author might be up to somethong.
Indeed I just checked that its exported docx can be converted by pandoc
into a "correct" docx (correct here meaning that my captions are
correctly labelled and numbered).
Have to think again...
--Emmanuel Charpentier
Le lundi 29 avril 2019 à 17:23 -0400, John Kitchin a écrit :
> I think you have missed the main point. My point was first to find
> some format that pandoc faithfully converts to docx with all the
> features you need, and then we can figure out how to turn org-ref/org 
> into that format. So, if you can write a LaTeX document that is
> correctly converted to docx (correct bibliography, figure labels, and
> cross-references, correct code, etc), then we can probably get org to
> output the right latex. But if LaTeX isn't converted to docx
> correctly in pandoc, it does not seem likely that org will either
> with any simple exporter.
> John
> 
> -----------------------------------
> Professor John Kitchin 
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
> 
> 
> 
> On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <
> emm.charpentier@free.fr> wrote:
> > Dear John,
> > Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
> > > For org-ref, there isn't much magic on what happens on export.
> > > LaTeX is certainly the most well supported, and it seems like org
> > > -> latex -> pandoc is the only way that makes sense to get to
> > > docx to me.  Using pandoc on org files directly is probably
> > > hopeless unless you can get pandoc to include some definitions
> > > for the org-ref links.
> > 
> > This might be difficult : the development of ox-pandoc seems to not
> > be very active at the moment...
> > > Some of the link types in org-ref have some exports defined for
> > > org, html, latex, sometimes ascii. If one of these works well
> > > with pandoc we could try to make them output something useful for
> > > them, or at least make sure that org->org export turns them into
> > > something useful. 
> > 
> > I'm currently looking at the ox-latex exporter in order to
> > understand what it does for source blocks with org's names and
> > captions (and try to fix the fact that they are labeled and nubered
> > as figures...). Theis understanding might help me to go in the
> > direction  you suggest.
> > > Getting figure/table numbers has always been tricky; I don't
> > > think this worked well with pandoc, and handling it on the org
> > > side requires some preprocessing to add numbers. For now, the ox-
> > > word exporter in scimax comes closest, but it isn't a feature I
> > > use a lot, so it hasn't been improved in a while.
> > 
> > Again, looking at what ox-latex does for org's names and captions
> > might be helpful. Ox-pandoc seems to do a decent job on docx
> > output.
> > > John
> > > 
> > > -----------------------------------
> > > Professor John Kitchin 
> > > Doherty Hall A207F
> > > Department of Chemical Engineering
> > > Carnegie Mellon University
> > > Pittsburgh, PA 15213
> > > 412-268-7803
> > > @johnkitchin
> > > http://kitchingroup.cheme.cmu.edu
> > > 
> > > 
> > > 
> > > On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
> > > emm.charpentier@free.fr> wrote:
> > > > Dear list,
> > > > 
> > > > 
> > > > 
> > > > one of my uses od org-mode is to prepare documents wrapping R
> > > > (and
> > > > 
> > > > sometimes Sagemath) call results in interpretation text. My
> > > > reference
> > > > 
> > > > output is .pdf documents, but I *have* to prepare a .docx
> > > > version (for
> > > > 
> > > > use in managerial spheres, where computer literacy is *very*
> > > > low.
> > > > 
> > > > Cross-references and citations are a sine qua non, maths are
> > > > useful.
> > > > 
> > > > 
> > > > 
> > > > I have been annoyed by a couple of deficiencies and
> > > > inconsistencies
> > > > 
> > > > between exporters, so I prepared a test document testing
> > > > various cases.
> > > > 
> > > > This documents and some exports are attached (NE = Native
> > > > exporter, PE
> > > > 
> > > > = ox-pandoc exporter).
> > > > 
> > > > 
> > > > 
> > > > TL;DR :
> > > > 
> > > > 
> > > > 
> > > >   * I tested the built-in latex/pdf exporter as well as ox-
> > > > pandoc, the
> > > > 
> > > > latter both for .pdf and .docx export. The built-in ODT
> > > > exporter
> > > > 
> > > > doesn't export citations ; therefore, I didn't test it further.
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >   * org-ref's :labels and :refs do not export to anything but
> > > > the
> > > > 
> > > > built-in latex exporter. The native system of #+NAME:s and
> > > > #+CAPTION:s,
> > > > 
> > > > a bit on the heavy side, seems not to fail (except that they do
> > > > not
> > > > 
> > > > expand in a caption...).
> > > > 
> > > > 
> > > > 
> > > >   * Maths, tables, figures are unproblematic.
> > > > 
> > > > 
> > > > 
> > > >   * The requirements of org-reftex, the built-in latex exporter
> > > > and ox-
> > > > 
> > > > pandoc being mutually incompatible, and some ingenuity is
> > > > required. see
> > > > 
> > > > the attached org source. Org-ref's requirements do not simplify
> > > > the
> > > > 
> > > > situation...
> > > > 
> > > > 
> > > > 
> > > >   * Code snippets (i. e. source blocks exporting code) have a
> > > > 
> > > > captioning/numbering problem :
> > > > 
> > > > 
> > > > 
> > > >     - With the built-in latex exporter, they are numbered and
> > > > labeled
> > > > 
> > > > as figures.
> > > > 
> > > > 
> > > > 
> > > >     - The pandoc latex exporter numbers them separately (as
> > > > seen by
> > > > 
> > > > referencing them), but do not output this number (nor the
> > > > category)
> > > > 
> > > > before the caption.
> > > > 
> > > > 
> > > > 
> > > >     - The pandoc .docx exporter works as advertised.
> > > > 
> > > > 
> > > > 
> > > > So I have a couple of questions:
> > > > 
> > > > 
> > > > 
> > > >   * What can be done to reconcile org-ref's, latex-exporter's
> > > > and ox-
> > > > 
> > > > pandoc's requirements for bibliographies ?
> > > > 
> > > > 
> > > > 
> > > >   * How to fix the pdf exporters' quirks with code snippets ?
> > > > 
> > > > 
> > > > 
> > > > HTH,
> > > > 
> > > > 
> > > > 
> > > > --
> > > > 
> > > > Emmanuel Charpentier
> > > > 

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

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

* Re: Slight problems with links
  2019-04-29 21:48       ` Emmanuel Charpentier
@ 2019-04-30  6:43         ` Ken Mankoff
  2019-04-30  7:45           ` Emmanuel Charpentier
  2019-04-30 18:11           ` John Kitchin
  0 siblings, 2 replies; 9+ messages in thread
From: Ken Mankoff @ 2019-04-30  6:43 UTC (permalink / raw)
  To: Emmanuel Charpentier; +Cc: emacs-orgmode, John Kitchin

Hi Emmanuel,

I have looked into PDF and DOCX export repeatedly over the years with different versions of Org and Pandoc and Google Docs and keep finding that the best method is Org -> LaTeX, and then LaTeX -> DOCX with Pandoc. I use this babel block to achieve this:

#+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension (buffer-name))
bibexport -o ${fn}.bib ${fn}.aux
pandoc -f latex -i ${fn}.tex -t DOCX -o ${fn}.docx --bibliography ./${fn}.bib
#+END_SRC

The first line may not be needed. That extracts the references used in this document from my single massive (3500 element) bib file. The advantage of this Org -> LaTeX -> Pandoc -> DOCX  method is that if you need to patch something for Pandoc (e.g. to fix your code captions or something) you could insert a NoWeb <<fix-tex-for-pandoc>> block before the pandoc line that generates a second, corrected, LaTeX file.

Note that I don't use org-ref, just the standard Org referencing code, but I don't see why this would change anything, if you're able to generate PDFs that meet your requirements.

  -k.
  

On 2019-04-29 at 19:48 -0200, Emmanuel Charpentier <emm.charpentier@free.fr> wrote...
> Dear John,
> Indeed, I missed your point. I'll have to bet back to you after
> reading, understanding the code (org-mode is a tall order...) and
> *thinking*.
> However, the troubling fact that ox-latex manages to export org's
> labelling correctly shows that its author might be up to somethong.
> Indeed I just checked that its exported docx can be converted by pandoc
> into a "correct" docx (correct here meaning that my captions are
> correctly labelled and numbered).
> Have to think again...
> --Emmanuel Charpentier
> Le lundi 29 avril 2019 à 17:23 -0400, John Kitchin a écrit :
>> I think you have missed the main point. My point was first to find
>> some format that pandoc faithfully converts to docx with all the
>> features you need, and then we can figure out how to turn org-ref/org 
>> into that format. So, if you can write a LaTeX document that is
>> correctly converted to docx (correct bibliography, figure labels, and
>> cross-references, correct code, etc), then we can probably get org to
>> output the right latex. But if LaTeX isn't converted to docx
>> correctly in pandoc, it does not seem likely that org will either
>> with any simple exporter.
>> John
>> 
>> -----------------------------------
>> Professor John Kitchin 
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>> 
>> 
>> 
>> On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <
>> emm.charpentier@free.fr> wrote:
>> > Dear John,
>> > Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
>> > > For org-ref, there isn't much magic on what happens on export.
>> > > LaTeX is certainly the most well supported, and it seems like org
>> > > -> latex -> pandoc is the only way that makes sense to get to
>> > > docx to me.  Using pandoc on org files directly is probably
>> > > hopeless unless you can get pandoc to include some definitions
>> > > for the org-ref links.
>> > 
>> > This might be difficult : the development of ox-pandoc seems to not
>> > be very active at the moment...
>> > > Some of the link types in org-ref have some exports defined for
>> > > org, html, latex, sometimes ascii. If one of these works well
>> > > with pandoc we could try to make them output something useful for
>> > > them, or at least make sure that org->org export turns them into
>> > > something useful. 
>> > 
>> > I'm currently looking at the ox-latex exporter in order to
>> > understand what it does for source blocks with org's names and
>> > captions (and try to fix the fact that they are labeled and nubered
>> > as figures...). Theis understanding might help me to go in the
>> > direction  you suggest.
>> > > Getting figure/table numbers has always been tricky; I don't
>> > > think this worked well with pandoc, and handling it on the org
>> > > side requires some preprocessing to add numbers. For now, the ox-
>> > > word exporter in scimax comes closest, but it isn't a feature I
>> > > use a lot, so it hasn't been improved in a while.
>> > 
>> > Again, looking at what ox-latex does for org's names and captions
>> > might be helpful. Ox-pandoc seems to do a decent job on docx
>> > output.
>> > > John
>> > > 
>> > > -----------------------------------
>> > > Professor John Kitchin 
>> > > Doherty Hall A207F
>> > > Department of Chemical Engineering
>> > > Carnegie Mellon University
>> > > Pittsburgh, PA 15213
>> > > 412-268-7803
>> > > @johnkitchin
>> > > http://kitchingroup.cheme.cmu.edu
>> > > 
>> > > 
>> > > 
>> > > On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
>> > > emm.charpentier@free.fr> wrote:
>> > > > Dear list,
>> > > > 
>> > > > 
>> > > > 
>> > > > one of my uses od org-mode is to prepare documents wrapping R
>> > > > (and
>> > > > 
>> > > > sometimes Sagemath) call results in interpretation text. My
>> > > > reference
>> > > > 
>> > > > output is .pdf documents, but I *have* to prepare a .docx
>> > > > version (for
>> > > > 
>> > > > use in managerial spheres, where computer literacy is *very*
>> > > > low.
>> > > > 
>> > > > Cross-references and citations are a sine qua non, maths are
>> > > > useful.
>> > > > 
>> > > > 
>> > > > 
>> > > > I have been annoyed by a couple of deficiencies and
>> > > > inconsistencies
>> > > > 
>> > > > between exporters, so I prepared a test document testing
>> > > > various cases.
>> > > > 
>> > > > This documents and some exports are attached (NE = Native
>> > > > exporter, PE
>> > > > 
>> > > > = ox-pandoc exporter).
>> > > > 
>> > > > 
>> > > > 
>> > > > TL;DR :
>> > > > 
>> > > > 
>> > > > 
>> > > >   * I tested the built-in latex/pdf exporter as well as ox-
>> > > > pandoc, the
>> > > > 
>> > > > latter both for .pdf and .docx export. The built-in ODT
>> > > > exporter
>> > > > 
>> > > > doesn't export citations ; therefore, I didn't test it further.
>> > > > 
>> > > > 
>> > > > 
>> > > > 
>> > > > 
>> > > >   * org-ref's :labels and :refs do not export to anything but
>> > > > the
>> > > > 
>> > > > built-in latex exporter. The native system of #+NAME:s and
>> > > > #+CAPTION:s,
>> > > > 
>> > > > a bit on the heavy side, seems not to fail (except that they do
>> > > > not
>> > > > 
>> > > > expand in a caption...).
>> > > > 
>> > > > 
>> > > > 
>> > > >   * Maths, tables, figures are unproblematic.
>> > > > 
>> > > > 
>> > > > 
>> > > >   * The requirements of org-reftex, the built-in latex exporter
>> > > > and ox-
>> > > > 
>> > > > pandoc being mutually incompatible, and some ingenuity is
>> > > > required. see
>> > > > 
>> > > > the attached org source. Org-ref's requirements do not simplify
>> > > > the
>> > > > 
>> > > > situation...
>> > > > 
>> > > > 
>> > > > 
>> > > >   * Code snippets (i. e. source blocks exporting code) have a
>> > > > 
>> > > > captioning/numbering problem :
>> > > > 
>> > > > 
>> > > > 
>> > > >     - With the built-in latex exporter, they are numbered and
>> > > > labeled
>> > > > 
>> > > > as figures.
>> > > > 
>> > > > 
>> > > > 
>> > > >     - The pandoc latex exporter numbers them separately (as
>> > > > seen by
>> > > > 
>> > > > referencing them), but do not output this number (nor the
>> > > > category)
>> > > > 
>> > > > before the caption.
>> > > > 
>> > > > 
>> > > > 
>> > > >     - The pandoc .docx exporter works as advertised.
>> > > > 
>> > > > 
>> > > > 
>> > > > So I have a couple of questions:
>> > > > 
>> > > > 
>> > > > 
>> > > >   * What can be done to reconcile org-ref's, latex-exporter's
>> > > > and ox-
>> > > > 
>> > > > pandoc's requirements for bibliographies ?
>> > > > 
>> > > > 
>> > > > 
>> > > >   * How to fix the pdf exporters' quirks with code snippets ?
>> > > > 
>> > > > 
>> > > > 
>> > > > HTH,
>> > > > 
>> > > > 
>> > > > 
>> > > > --
>> > > > 
>> > > > Emmanuel Charpentier
>> > > > 

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

* Re: Slight problems with links
  2019-04-30  6:43         ` Ken Mankoff
@ 2019-04-30  7:45           ` Emmanuel Charpentier
  2019-04-30 18:11           ` John Kitchin
  1 sibling, 0 replies; 9+ messages in thread
From: Emmanuel Charpentier @ 2019-04-30  7:45 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: emacs-orgmode, John Kitchin

Le mardi 30 avril 2019 à 04:43 -0200, Ken Mankoff a écrit :
> Hi Emmanuel,
> 
> I have looked into PDF and DOCX export repeatedly over the years with
> different versions of Org and Pandoc and Google Docs and keep finding
> that the best method is Org -> LaTeX, and then LaTeX -> DOCX with
> Pandoc.

That's also basically the advice given by John Kitchin.

> I use this babel block to achieve this:
> 
> #+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension
> (buffer-name))
> bibexport -o ${fn}.bib ${fn}.aux
> pandoc -f latex -i ${fn}.tex -t DOCX -o ${fn}.docx --bibliography
> ./${fn}.bib
> #+END_SRC
> 
> The first line may not be needed. That extracts the references used
> in this document from my single massive (3500 element) bib file.

Whew ! How do you manage this ? 

I gave up using JabRef fo a large collection, and use Zotero (which
allows me to share my bibliographic base with Wordheads co-workers.1
have about 14 000 references dispatched in one (small) personal library
and three (large: academic physicians are (have to be) chatty...)
shared libraries. 

I create a problem specific collection to collect the relevant
references, and export that. I found GetterBibtex's auto-export feature
to be very useful.

> The advantage of this Org -> LaTeX -> Pandoc -> DOCX  method is that
> if you need to patch something for Pandoc (e.g. to fix your code
> captions or something) you could insert a NoWeb <<fix-tex-for-
> pandoc>> block before the pandoc line that generates a second,
> corrected, LaTeX file.

Hmmm... this way lies madness : it multiplies the possible sources for
a  bug. I'd rather avoid that, and fight for a *correct* LaTeX source,
which is not the case at the moment.

> 
> Note that I don't use org-ref, just the standard Org referencing
> code, but I don't see why this would change anything, if you're able
> to generate PDFs that meet your requirements.

Org-ref has its points : it offers the ability to create/update and
maintain a document-specific .bib file, ythanks to a set of interfaces
to PubMed/DOI/etc.... I don't give up on the idea of suggesting to John
Kitchin an interface to Zotero : a very crude interface r(Totxt)
exists, that can be used to communicate with a local Zotero process.
But this is now too rough (remaining bugs, etc..) to prepare a patch-
request (I'm not much of a programmer...).

Back to the problem at hand : I'm still bugged by the fact that ox-
pandoc does the right thing in the present case (as well as the built-
in HTML exporter, by the way), and that the built-in LaTeX exporter is
buggy. I just posted a formal bug report limited to this.

Cordially yours,

--
Emmanuel Charpentier

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

* Re: Slight problems with links
  2019-04-30  6:43         ` Ken Mankoff
  2019-04-30  7:45           ` Emmanuel Charpentier
@ 2019-04-30 18:11           ` John Kitchin
  1 sibling, 0 replies; 9+ messages in thread
From: John Kitchin @ 2019-04-30 18:11 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: Emmanuel Charpentier, emacs-orgmode

I second the need for the first line, in my past efforts pandoc would
choke on my large bibtex file, and trimming it down to just the
essential entries was helpful. I would achieve that with M-x
org-ref-extract-bibtex-to-file :). But it is otherwise the same.

Ken Mankoff <mankoff@gmail.com> writes:

> Hi Emmanuel,
>
> I have looked into PDF and DOCX export repeatedly over the years with different versions of Org and Pandoc and Google Docs and keep finding that the best method is Org -> LaTeX, and then LaTeX -> DOCX with Pandoc. I use this babel block to achieve this:
>
> #+BEGIN_SRC sh :results verbatim :var fn=(file-name-sans-extension (buffer-name))
> bibexport -o ${fn}.bib ${fn}.aux
> pandoc -f latex -i ${fn}.tex -t DOCX -o ${fn}.docx --bibliography ./${fn}.bib
> #+END_SRC
>
> The first line may not be needed. That extracts the references used in this document from my single massive (3500 element) bib file. The advantage of this Org -> LaTeX -> Pandoc -> DOCX  method is that if you need to patch something for Pandoc (e.g. to fix your code captions or something) you could insert a NoWeb <<fix-tex-for-pandoc>> block before the pandoc line that generates a second, corrected, LaTeX file.
>
> Note that I don't use org-ref, just the standard Org referencing code, but I don't see why this would change anything, if you're able to generate PDFs that meet your requirements.
>
>   -k.
>
>
> On 2019-04-29 at 19:48 -0200, Emmanuel Charpentier <emm.charpentier@free.fr> wrote...
>> Dear John,
>> Indeed, I missed your point. I'll have to bet back to you after
>> reading, understanding the code (org-mode is a tall order...) and
>> *thinking*.
>> However, the troubling fact that ox-latex manages to export org's
>> labelling correctly shows that its author might be up to somethong.
>> Indeed I just checked that its exported docx can be converted by pandoc
>> into a "correct" docx (correct here meaning that my captions are
>> correctly labelled and numbered).
>> Have to think again...
>> --Emmanuel Charpentier
>> Le lundi 29 avril 2019 à 17:23 -0400, John Kitchin a écrit :
>>> I think you have missed the main point. My point was first to find
>>> some format that pandoc faithfully converts to docx with all the
>>> features you need, and then we can figure out how to turn org-ref/org
>>> into that format. So, if you can write a LaTeX document that is
>>> correctly converted to docx (correct bibliography, figure labels, and
>>> cross-references, correct code, etc), then we can probably get org to
>>> output the right latex. But if LaTeX isn't converted to docx
>>> correctly in pandoc, it does not seem likely that org will either
>>> with any simple exporter.
>>> John
>>>
>>> -----------------------------------
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>>
>>>
>>> On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <
>>> emm.charpentier@free.fr> wrote:
>>> > Dear John,
>>> > Le lundi 29 avril 2019 à 16:57 -0400, John Kitchin a écrit :
>>> > > For org-ref, there isn't much magic on what happens on export.
>>> > > LaTeX is certainly the most well supported, and it seems like org
>>> > > -> latex -> pandoc is the only way that makes sense to get to
>>> > > docx to me.  Using pandoc on org files directly is probably
>>> > > hopeless unless you can get pandoc to include some definitions
>>> > > for the org-ref links.
>>> >
>>> > This might be difficult : the development of ox-pandoc seems to not
>>> > be very active at the moment...
>>> > > Some of the link types in org-ref have some exports defined for
>>> > > org, html, latex, sometimes ascii. If one of these works well
>>> > > with pandoc we could try to make them output something useful for
>>> > > them, or at least make sure that org->org export turns them into
>>> > > something useful.
>>> >
>>> > I'm currently looking at the ox-latex exporter in order to
>>> > understand what it does for source blocks with org's names and
>>> > captions (and try to fix the fact that they are labeled and nubered
>>> > as figures...). Theis understanding might help me to go in the
>>> > direction  you suggest.
>>> > > Getting figure/table numbers has always been tricky; I don't
>>> > > think this worked well with pandoc, and handling it on the org
>>> > > side requires some preprocessing to add numbers. For now, the ox-
>>> > > word exporter in scimax comes closest, but it isn't a feature I
>>> > > use a lot, so it hasn't been improved in a while.
>>> >
>>> > Again, looking at what ox-latex does for org's names and captions
>>> > might be helpful. Ox-pandoc seems to do a decent job on docx
>>> > output.
>>> > > John
>>> > >
>>> > > -----------------------------------
>>> > > Professor John Kitchin
>>> > > Doherty Hall A207F
>>> > > Department of Chemical Engineering
>>> > > Carnegie Mellon University
>>> > > Pittsburgh, PA 15213
>>> > > 412-268-7803
>>> > > @johnkitchin
>>> > > http://kitchingroup.cheme.cmu.edu
>>> > >
>>> > >
>>> > >
>>> > > On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier <
>>> > > emm.charpentier@free.fr> wrote:
>>> > > > Dear list,
>>> > > >
>>> > > >
>>> > > >
>>> > > > one of my uses od org-mode is to prepare documents wrapping R
>>> > > > (and
>>> > > >
>>> > > > sometimes Sagemath) call results in interpretation text. My
>>> > > > reference
>>> > > >
>>> > > > output is .pdf documents, but I *have* to prepare a .docx
>>> > > > version (for
>>> > > >
>>> > > > use in managerial spheres, where computer literacy is *very*
>>> > > > low.
>>> > > >
>>> > > > Cross-references and citations are a sine qua non, maths are
>>> > > > useful.
>>> > > >
>>> > > >
>>> > > >
>>> > > > I have been annoyed by a couple of deficiencies and
>>> > > > inconsistencies
>>> > > >
>>> > > > between exporters, so I prepared a test document testing
>>> > > > various cases.
>>> > > >
>>> > > > This documents and some exports are attached (NE = Native
>>> > > > exporter, PE
>>> > > >
>>> > > > = ox-pandoc exporter).
>>> > > >
>>> > > >
>>> > > >
>>> > > > TL;DR :
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * I tested the built-in latex/pdf exporter as well as ox-
>>> > > > pandoc, the
>>> > > >
>>> > > > latter both for .pdf and .docx export. The built-in ODT
>>> > > > exporter
>>> > > >
>>> > > > doesn't export citations ; therefore, I didn't test it further.
>>> > > >
>>> > > >
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * org-ref's :labels and :refs do not export to anything but
>>> > > > the
>>> > > >
>>> > > > built-in latex exporter. The native system of #+NAME:s and
>>> > > > #+CAPTION:s,
>>> > > >
>>> > > > a bit on the heavy side, seems not to fail (except that they do
>>> > > > not
>>> > > >
>>> > > > expand in a caption...).
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * Maths, tables, figures are unproblematic.
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * The requirements of org-reftex, the built-in latex exporter
>>> > > > and ox-
>>> > > >
>>> > > > pandoc being mutually incompatible, and some ingenuity is
>>> > > > required. see
>>> > > >
>>> > > > the attached org source. Org-ref's requirements do not simplify
>>> > > > the
>>> > > >
>>> > > > situation...
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * Code snippets (i. e. source blocks exporting code) have a
>>> > > >
>>> > > > captioning/numbering problem :
>>> > > >
>>> > > >
>>> > > >
>>> > > >     - With the built-in latex exporter, they are numbered and
>>> > > > labeled
>>> > > >
>>> > > > as figures.
>>> > > >
>>> > > >
>>> > > >
>>> > > >     - The pandoc latex exporter numbers them separately (as
>>> > > > seen by
>>> > > >
>>> > > > referencing them), but do not output this number (nor the
>>> > > > category)
>>> > > >
>>> > > > before the caption.
>>> > > >
>>> > > >
>>> > > >
>>> > > >     - The pandoc .docx exporter works as advertised.
>>> > > >
>>> > > >
>>> > > >
>>> > > > So I have a couple of questions:
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * What can be done to reconcile org-ref's, latex-exporter's
>>> > > > and ox-
>>> > > >
>>> > > > pandoc's requirements for bibliographies ?
>>> > > >
>>> > > >
>>> > > >
>>> > > >   * How to fix the pdf exporters' quirks with code snippets ?
>>> > > >
>>> > > >
>>> > > >
>>> > > > HTH,
>>> > > >
>>> > > >
>>> > > >
>>> > > > --
>>> > > >
>>> > > > Emmanuel Charpentier
>>> > > >


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2019-04-30 18:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29  6:33 Slight problems with links Emmanuel Charpentier
2019-04-29 20:57 ` John Kitchin
2019-04-29 21:18   ` Emmanuel Charpentier
2019-04-29 21:23     ` John Kitchin
2019-04-29 21:48       ` Emmanuel Charpentier
2019-04-30  6:43         ` Ken Mankoff
2019-04-30  7:45           ` Emmanuel Charpentier
2019-04-30 18:11           ` John Kitchin
  -- strict thread matches above, loose matches on Subject: below --
2019-04-29  7:35 Emmanuel Charpentier

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