From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: BUG: Export images to LaTeX Date: Sat, 22 Oct 2011 15:45:19 -0400 Message-ID: <26745.1319312719@alphaville.dokosmarshall.org> References: <2901336D-F5F2-430B-84C8-8E903FEFE7FB@yahoo.com> <12962.1319239571@alphaville.americas.hpqcorp.net> <3D666319-4172-428D-9622-7B912B2AD6C7@yahoo.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHhVT-0000i0-Id for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 15:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHhVS-00020F-De for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 15:45:23 -0400 Received: from g1t0027.austin.hp.com ([15.216.28.34]:36789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHhVS-0001zz-69 for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 15:45:22 -0400 In-Reply-To: Message from Anthony Lander of "Sat, 22 Oct 2011 07:53:44 EDT." <3D666319-4172-428D-9622-7B912B2AD6C7@yahoo.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Anthony Lander Cc: nicholas.dokos@hp.com, emacs-orgmode Mode Anthony Lander wrote: > > On 11-Oct-21, at 7:26 PM, Nick Dokos wrote: > > > Anthony Lander 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 24.0.90.1 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 exp-plist (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 cleanup. Nick Footnotes: [fn:1] this is pure conjecture on my part