From: Emmanuel Charpentier <emanuel.charpentier@gmail.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Problem with references to babel source blocks (possible bug).
Date: Fri, 21 Dec 2018 17:29:25 +0100 [thread overview]
Message-ID: <CAFG8T6XqxMOBJZ1A9z2OQgs5vok_TDYYJP+_-hL04tRcyqkF8Q@mail.gmail.com> (raw)
In-Reply-To: <m2lg4kx6vn.fsf@andrew.cmu.edu>
Dear John, dear list,
Indeed using minted works (at least when using labels. I have not yet
tried to use #+NAME:s). See a few remarks below.
Le jeu. 20 déc. 2018 à 21:47, John Kitchin <jkitchin@andrew.cmu.edu> a écrit :
>
> I guess there is some subtle point missing. For the source blocks I
> usually use the minted package, which I think makes code blocks as a
> listing float. In your tex file, they are verbatim environments, and you
> have \captionof{figure} under them which is presumably why they are
> labeled as figures.
>
> Try adding ("" "minted" nil) to # org-latex-packages-alist:
>
> and add this to an init file: (setq org-latex-listings 'minted).
The mistery starts with the "Src blocks" part of ox-latex (starting
line 895 in today's version of this file). In the default case (i. e.
when org-latex-listing is not set), this modules exports a verbatim
environment ... and a \labelof{figure} label !!!
Another part of the mystery is explained in the function
org-latex-keyword (starting at line 2218 of today's version of
org-latex.el). This function is, among others, in charge of
determining the environment of a table of contents for code snippets.
This tests org-latex-listings and switches :
nil --> listoffigures
minted --> listoflistings
otherwise --> lstlistoflitings
BTW, reading this code also allows to understand why org-mode complies
to #+TOC: headings, #+TOC: tables, #+TOC: listings, but NOT #+TOC:
figures.
I wonder why this choice has been made. Probably because this avoids
the need for a latex package for source code listings. hich is indeed
a bit of a quandary :
* listings is obsolete, unmaintained and has serious issues with
anything not strict ASCII (plays fast and loose with TeX catcodes...).
* minted needs to write and read intermediate file, which is a bt of a
security risk, hence not enabled by default.
The choice of figures as a default environment for code snippets has a
couple consequences :
* Problems at exporting anywhere but latex
* No way to have simultaneously a list of figures and list of listings
* No list of figures bt by direct use of "\listoffigures" in LaTeX.
Shouldn't we consider this a bit of a misdesign ? I dont (yet) seem a
way to en hance this.
Suggestions ?
--
Emmanuel Charpentier
> Best wishes,
>
> Emmanuel Charpentier <emanuel.charpentier@gmail.com> writes:
>
> > I wish to be able to reference (i. e cross-references, lists) both some
> > tables or figures AND the code producing the objects.
> >
> > To this effect, I added (distinct) #+caption:s to the source blocks AND
> > to the results, adorned with (distinct) org-ref's labels. An example (
> > Min-Ref.org) is included in this Google Drive directory*:
> > https://drive.google.com/drive/folders/1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i?usp=sharing
> > .
> >
> > The comparison of this source, the LaTeX code obtained by org-latex
> > export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
> > by org-latex-export-to-pdf.pdf) show that the labels attributed to
> > source blocks are mislabeled as figures. Furthermore, while the org
> > source requests a list of figure, a list of table and a list of
> > listings (in that order), the list of figures appears *after* the list
> > of tables.
> >
> > I am tempted to conclude that there is some confusion between figures
> > and listings. Further attempts tend to show that the problem may live n
> > the core org's code, rather than any specific exporter :
> >
> > The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
> > as shown in Min-Ref exported by org-odt-export-to-odt.odt.
> >
> > Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
> > export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
> > to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
> > some specific configurations in order to be even vaguely usable.
> >
> > Previous trials, using #+names: rather than org-ref's labels, gave
> > similar failures. If needed, I can reproduce these trials.
> >
> > So I have a couple questions :
> >
> > 1) Is the confusion of source blocks and figures a bug, or do I miss a
> > subtle point ?
> >
> > 2) Is there some introductory material to the care and feeding of ox-
> > pandoc demonstrating the use of this exporter's options to enable the
> > addition of the needed features (figure inclusion, tables of tables /
> > figures / listings, etc...) ? The "manual" available as a README is way
> > too terse to be usable without diving in the source code and pandoc's
> > documentation.
> >
> > Sincerely,
>
>
> --
> 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
next prev parent reply other threads:[~2018-12-21 16:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 19:26 Problem with references to babel source blocks (possible bug) Emmanuel Charpentier
2018-12-20 20:47 ` John Kitchin
2018-12-21 16:29 ` Emmanuel Charpentier [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-12-19 16:05 Emmanuel Charpentier
[not found] <1669578320.377567952.1545064721537.JavaMail.root@zimbra43-e7.priv.proxad.net>
2018-12-17 16:40 ` emm.charpentier
2018-12-18 17:00 ` Emmanuel Charpentier
2018-12-17 15:32 Emmanuel Charpentier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFG8T6XqxMOBJZ1A9z2OQgs5vok_TDYYJP+_-hL04tRcyqkF8Q@mail.gmail.com \
--to=emanuel.charpentier@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jkitchin@andrew.cmu.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.