emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] ob-doc-maxima.org and ob-maxima.el


From: Leo Butler
Subject: Re: [BUG] ob-doc-maxima.org and ob-maxima.el
Date: Thu, 3 Nov 2022 18:15:18 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Ihor,

On Thu, Nov 03 2022, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>> In worg's documentation of ob-maxima.el[fn:1], there are several bugs.
>
> Thanks for reporting!

Thank you for the feedback. I will comment inline below.

>
>> 1. In the subsection `Inline Display of Maxima LaTeX Output', the
>> results are missing.
>
> It is because source block evaluation is disabled on server side when
> generating WORG website from org sources.

Ahhh! Of course.

>
> You basically need to evaluate the code block manually to have it
> present in the original file without a need to evaluate during export.
>
> I do not have maxima on my system. It would be welcome if you evaluate
> the code blocks with missing results manually and submit a patch with.

Attached.

>
>> ... This is because the code block is named
>> `solve-maxima', the same as in the section `Solver'. Export results in
>> that output being put in the `Solver' section (I don't know if that
>> should be considered a bug in Org).
>
> No, the source block in the Solver section is different. It just has
> the same name. Name duplicate should be fixed indeed.

That was fixed in the patch I sent, and the attached one.

>
>> 2. In `3D Plots', the header arguments do not result in a link to a
>> generated file being created on evaluation of the code block. I am
>> unsure if this is a bug in Org, ob-maxima.el or ob-doc-maxima.org or
>> what.
>> On reading the description of the =:results graphics=
>> header[fn:2], it looks like there is blame to go around.
>
> Makes sense. Can you please report this inconsistency in more details in
> a separate email? It looks like something is not right with ob-maxima
> code in the treatment of :results graphics.

Sure. I was playing with ob-doc-octave.org, too, and I see that there is
a similar problem there.

>
>> @@ -145,7 +151,7 @@ This example is from 
>> [[http://maxima.sourceforge.net/maxima-gnuplot.html][a tuto
>>  ,#+name: 3d-maxima
>>  ,#+header: :file images/maxima-3d.png
>>  ,#+header: :exports results
>> -,#+header: :results graphics
>> +,#+header: :results graphics file
>
> Using graphics together with file does not make sense.

Ok. But I am not sure the code agrees with you. In ob-core.el,
`org-babel-graphical-output-file' is defined as:

(defun org-babel-graphical-output-file (params)
  "File where a babel block should send graphical output, per PARAMS.
Return nil if no graphical output is expected.  Raise an error if
the output file is ill-defined."
  (let ((file (cdr (assq :file params))))
    (cond (file (and (member "graphics" (cdr (assq :result-params params)))
                     file))
                     ...

Is it, in your opinion, ob-maxima's responsibility to add "graphics" to
:result-params when :results file is specified?

> We should probably fix ob-maxima with :results file first.
> Ideally, the code here should be simply
> ,#+header: :results file

The attached patch to lisp/ob-maxima.el makes the example work with your
suggested header.

>
>>  #+begin_example
>> -,#+NAME: solve-maxima
>> -,#+HEADER: :exports none
>> -,#+BEGIN_SRC maxima :results raw
>> +,#+NAME: tex-maxima
>> +,#+HEADER: :exports results
>> +,#+BEGIN_SRC maxima :results latex
>
> This will break WORG page. We are exporting to HTML, not latex and the
> results wrapped into #+begin_export latex will not be exported to the
> website. What's wrong with raw?

Yes, you are right about WORG. I was testing by building a pdf and
didn't think to build the html page. My mistake. The patch I am sending
builds a working html page.

There is a problem, though. When evaluating the code block

#+NAME: tex-maxima
#+HEADER: :exports results
#+BEGIN_SRC maxima :results raw
  tex(exp(-x)/x);
#+END_SRC

multiple times, the results are appended below each other. Adding the
option `drawer', or changing the results to latex (or html), prevents
this. I will open a separate email report about this.

Leo

Attachment: ob-doc-maxima.org.diff
Description: Patch to worg's ob-doc-maxima.org.diff

Attachment: ob-maxima.el.diff
Description: Patch to org's ob-maxima.el that makes :results file equivalent to :results file graphics.diff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]