From mboxrd@z Thu Jan 1 00:00:00 1970 From: Emmanuel Charpentier Subject: Re: Slight problems with links Date: Mon, 29 Apr 2019 23:48:24 +0200 Message-ID: <450323f31e177a8a66aea436c688ec066caf4f26.camel@free.fr> References: <602b6645ab39fabcceb851b8e4f12a15b0c04c20.camel@free.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-Gwkox2oxPpLbDpG1MkeD" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:34766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLE8X-0008O9-ET for emacs-orgmode@gnu.org; Mon, 29 Apr 2019 17:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLE8V-0000KF-AX for emacs-orgmode@gnu.org; Mon, 29 Apr 2019 17:48:33 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:29871) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hLE8V-0000JT-1R for emacs-orgmode@gnu.org; Mon, 29 Apr 2019 17:48:31 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: emacs-orgmode --=-Gwkox2oxPpLbDpG1MkeD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =C3=A0 17:23 -0400, John Kitchin a =C3=A9crit : > 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=20 > 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 >=20 > ----------------------------------- > Professor John Kitchin=20 > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu >=20 >=20 >=20 > On Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier < > emm.charpentier@free.fr> wrote: > > Dear John, > > Le lundi 29 avril 2019 =C3=A0 16:57 -0400, John Kitchin a =C3=A9crit = : > > > 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. > >=20 > > 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.=20 > >=20 > > 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. > >=20 > > 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 > > >=20 > > > ----------------------------------- > > > Professor John Kitchin=20 > > > Doherty Hall A207F > > > Department of Chemical Engineering > > > Carnegie Mellon University > > > Pittsburgh, PA 15213 > > > 412-268-7803 > > > @johnkitchin > > > http://kitchingroup.cheme.cmu.edu > > >=20 > > >=20 > > >=20 > > > On Mon, Apr 29, 2019 at 1:06 PM Emmanuel Charpentier < > > > emm.charpentier@free.fr> wrote: > > > > Dear list, > > > >=20 > > > >=20 > > > >=20 > > > > one of my uses od org-mode is to prepare documents wrapping R > > > > (and > > > >=20 > > > > sometimes Sagemath) call results in interpretation text. My > > > > reference > > > >=20 > > > > output is .pdf documents, but I *have* to prepare a .docx > > > > version (for > > > >=20 > > > > use in managerial spheres, where computer literacy is *very* > > > > low. > > > >=20 > > > > Cross-references and citations are a sine qua non, maths are > > > > useful. > > > >=20 > > > >=20 > > > >=20 > > > > I have been annoyed by a couple of deficiencies and > > > > inconsistencies > > > >=20 > > > > between exporters, so I prepared a test document testing > > > > various cases. > > > >=20 > > > > This documents and some exports are attached (NE =3D Native > > > > exporter, PE > > > >=20 > > > > =3D ox-pandoc exporter). > > > >=20 > > > >=20 > > > >=20 > > > > TL;DR : > > > >=20 > > > >=20 > > > >=20 > > > > * I tested the built-in latex/pdf exporter as well as ox- > > > > pandoc, the > > > >=20 > > > > latter both for .pdf and .docx export. The built-in ODT > > > > exporter > > > >=20 > > > > doesn't export citations ; therefore, I didn't test it further. > > > >=20 > > > >=20 > > > >=20 > > > >=20 > > > >=20 > > > > * org-ref's :labels and :refs do not export to anything but > > > > the > > > >=20 > > > > built-in latex exporter. The native system of #+NAME:s and > > > > #+CAPTION:s, > > > >=20 > > > > a bit on the heavy side, seems not to fail (except that they do > > > > not > > > >=20 > > > > expand in a caption...). > > > >=20 > > > >=20 > > > >=20 > > > > * Maths, tables, figures are unproblematic. > > > >=20 > > > >=20 > > > >=20 > > > > * The requirements of org-reftex, the built-in latex exporter > > > > and ox- > > > >=20 > > > > pandoc being mutually incompatible, and some ingenuity is > > > > required. see > > > >=20 > > > > the attached org source. Org-ref's requirements do not simplify > > > > the > > > >=20 > > > > situation... > > > >=20 > > > >=20 > > > >=20 > > > > * Code snippets (i. e. source blocks exporting code) have a > > > >=20 > > > > captioning/numbering problem : > > > >=20 > > > >=20 > > > >=20 > > > > - With the built-in latex exporter, they are numbered and > > > > labeled > > > >=20 > > > > as figures. > > > >=20 > > > >=20 > > > >=20 > > > > - The pandoc latex exporter numbers them separately (as > > > > seen by > > > >=20 > > > > referencing them), but do not output this number (nor the > > > > category) > > > >=20 > > > > before the caption. > > > >=20 > > > >=20 > > > >=20 > > > > - The pandoc .docx exporter works as advertised. > > > >=20 > > > >=20 > > > >=20 > > > > So I have a couple of questions: > > > >=20 > > > >=20 > > > >=20 > > > > * What can be done to reconcile org-ref's, latex-exporter's > > > > and ox- > > > >=20 > > > > pandoc's requirements for bibliographies ? > > > >=20 > > > >=20 > > > >=20 > > > > * How to fix the pdf exporters' quirks with code snippets ? > > > >=20 > > > >=20 > > > >=20 > > > > HTH, > > > >=20 > > > >=20 > > > >=20 > > > > -- > > > >=20 > > > > Emmanuel Charpentier > > > >=20 --=-Gwkox2oxPpLbDpG1MkeD Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
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 sh= ows that its author might be up to somethong. Indeed I just checked that it= s exported docx can be converted by pandoc into a "correct" docx (correct h= ere meaning that my captions are correctly labelled and numbered).

Have to think again...

--
Emmanuel Charpentier

Le lundi 29 avril 2019 =C3= =A0 17:23 -0400, John Kitchin a =C3=A9crit :
I think you have missed the main point. My point wa= s first to find some format that pandoc faithfully converts to docx with al= l 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-reference= s, correct code, etc), then we can probably get org to output the right lat= ex. But if LaTeX isn't converted to docx correctly in pandoc, it does not s= eem likely that org will either with any simple exporter.

John

-----------= ------------------------
Professor John Kitchin 
Doherty Hall A2= 07F
Department of Chemical Engineering
Carnegie Mellon University
= Pittsburgh, PA 15213
412-268-7803

<= /div>
O= n Mon, Apr 29, 2019 at 5:19 PM Emmanuel Charpentier <emm.charpentier@free.fr> wrote:
D= ear John,

Le lundi 29 avril 2019 =C3=A0 16:57 -040= 0, John Kitchin a =C3=A9crit :
For org-ref, there isn't much magic on what happens on export. La= TeX 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 h= ave some exports defined for org, html, latex, sometimes ascii. If one of t= hese works well with pandoc we could try to make them output something usef= ul for them, or at least make sure that org->org export turns them into = something useful.

I'm currentl= y 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 t= hey are labeled and nubered as figures...). Theis understanding might help = me to go in the direction you suggest.

Getting figure/table numbers has always b= een 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-wo= rd 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 mig= ht 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
Pit= tsburgh, PA 15213
412-268-7803


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 =3D Native exporter, PE =3D 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 lab= eled
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-<= br> pandoc's requirements for bibliographies ?

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

HTH,

--
Emmanuel Charpentier
--=-Gwkox2oxPpLbDpG1MkeD--