Anthony Lander <anthonylan...@yahoo.com> wrote: > > On 11-Oct-21, at 7:26 PM, Nick Dokos wrote: > > > Anthony Lander <anthonylan...@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 > >> 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