emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Anthony Lander <anthonylander@yahoo.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: Re: BUG: Export images to LaTeX
Date: Sat, 22 Oct 2011 15:45:19 -0400	[thread overview]
Message-ID: <26745.1319312719@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Anthony Lander <anthonylander@yahoo.com> of "Sat, 22 Oct 2011 07:53:44 EDT." <3D666319-4172-428D-9622-7B912B2AD6C7@yahoo.com>

Anthony Lander <anthonylander@yahoo.com> wrote:

> On 11-Oct-21, at 7:26 PM, Nick Dokos wrote:
> > Anthony Lander <anthonylander@yahoo.com> wrote:
> > 
> >> Hi List,
> >> 
> >> I've run into a strange problem with the latest org pull. Exporting inlined images with the LaTeX exporter works or not depending on whether I include org-jsinfo in org-modules(!). This is with emacs -q on the emacs recent release.
> >> 
> >> Can someone please try to reproduce this to confirm?
> > 
> > Pretty weird - I can reproduce this by omitting org-jsinfo from org-modules and 
> > starting with a minimal .emacs.
> Thanks for reproducing this. It is indeed weird, as you describe below. 
> Unfortunately, I pull infrequently, so I can't really narrow down when it started happening.
>   -Anthony
> > 
> > But there seems to be something else as well: after the export (where I get the
> > href link that Anthony mentions) I require org-jsinfo and reexport and get the
> > \includegraphics, again as mentioned. I then unload-feature org-jsinfo, and
> > try again: I get an error because org-export-options-filters now contains a function
> > from org-jsinfo that is no longer present. So I reset org-export-options-filters back
> > to nil: this time the reexport succeeds, but I get the \includegraphics, not the \href:
> > the act of loading and unloading org-jsinfo seems to have changed the state enough
> > so that latex export now does the right thing.
> > 
> > And no, it's not a remnant of the previous export: I delete the .tex file and recreate
> > it in this last case.
> > 

Oy, vey: this was painful (and I'm still not sure I got it right):
setting export options for the various backends looks like the Wild
West - everybody takes the law into his own hands and becomes judge,
jury and executioner.

The whole thing hinges on the value of :inline-images in the export
options plist: without org-jsinfo in the picture, this turns out to be
nil in the latex exporter, but with org-jsinfo, it becomes 'maybe and
that's enough to make the difference you observe.

Part of the weirdness seems to be [fn:1] that :inline-images originated
in the html exporter and then was pressed into action in the latex
exporter - the proverbial panda's thumb.

When org-jsinfo is loaded, it adds org-jsinfo-handle-options to
org-export-options-filters and that adds :inline-info 'maybe to the
latex default export options plist. The latex exporter then "works":
even when org-jsinfo is unloaded, org-export-latex-options-plist still
contains the :inline-images 'maybe setting. This is the kind of side
effect that makes the hair in the back of my neck stand up in horror :-)

But with all the the ways of getting options into the export plist,
I couldn't find a good way to do it for latex. I think that the
best way is to imitate what jsinfo does and add an options handler
to org-export-options-filters, say org-latex-handle-options. These
functions take a plist as input, modify it and return the modified
list as their output, something like this:

--8<---------------cut here---------------start------------->8---
(defun org-latex-handle-options (exp-plist)
  (let ((inlineimg (plist-get exp-plist :inline-images)))
    (if inlineimg
      (plist-put exp-plist :inline-images t))))

(add-to-list 'org-export-options-filters (function org-latex-handle-options))
--8<---------------cut here---------------end--------------->8---

But I think the whole area of export options needs a radical reorg and



[fn:1] this is pure conjecture on my part

  parent reply	other threads:[~2011-10-22 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 21:22 BUG: Export images to LaTeX Anthony Lander
     [not found] ` <12962.1319239571@alphaville.americas.hpqcorp.net>
2011-10-22 11:53   ` Anthony Lander
2011-10-22 14:12     ` Bernt Hansen
2011-10-22 14:21       ` Jambunathan K
2011-10-22 19:45     ` Nick Dokos [this message]
2011-10-22 13:42 ` Bastien

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:

  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=26745.1319312719@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=anthonylander@yahoo.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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