Asilata Bapat <[email protected]> writes:

> But it seems to me that there is still the following problem in ox-html.el. 
> The documentation of org-html-format-latex does not make it clear that its 
> last argument, the info plist, *has to* contain the property :output-file in 
> order to avoid a runtime error!
>
> The further heart of the matter is the weird behaviour of 
> file-name-directory: in particular, running (file-name-directory "") gives 
> nil, while running (file-name-directory nil) throws an error. I don't 
> understand why those two calls should behave differently.
>
> Anyway, because of this issue, an unsuspecting external call to 
> org-html-format-latex is doomed to fail. Because it probably won't explicitly 
> include :output-file in its info plist. This does not seem good!

Right.
However, do note that we will likely deprecate org-html-format-latex in
one of the future releases, when we merge the latex preview branch.
CCing Karthik.
Karthik, could you please take a look and consider whether this
situation will be problematic on the branch?

As for more near-term solution, we should at least document :output-file
behavior in the docstring. Whether we need to throw an error if
:output-file is not defined is another question. It mainly boils down
what is more useful - is it better to throw the problem into the caller's
face or is it better to avoid failures.

Another, even more radical, option could be falling back to
mathjax/verbatim when :output-file is nil.

I also note that the reported problem affects exporting to buffer from
emacs -Q. If org-html-with-latex is set to, say, 'dvipng, exporting an
Org buffer with latex fragments to buffer and not to file, will err.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to